/source/icmadness.ooc

http://github.com/aguspiza/icmadness · Unknown · 68 lines · 51 code · 17 blank · 0 comment · 0 complexity · 5d2e04c56ffd03afd5b48c6218574c25 MD5 · raw file

  1. use inception
  2. import engine/[Engine, Entity, Property, Update, EventMapper, Message, Types]
  3. import gfx/[RenderWindow, Cube, Scene, Quad, Line, Camera, Texture]
  4. import gfx/r2m/[R2MLoader]
  5. import physics/PhysicsEngine
  6. import io/File
  7. import text/StringTokenizer
  8. import console/[Console, Command]
  9. import hud/[Hud, Window, ConvertCoords, SpeedoMeter]
  10. import gameplay/Kart
  11. main: func (argc: Int, argv: CString*) {
  12. engine := Engine new()
  13. //--------------- Setup the window
  14. width := 1280
  15. height := 800
  16. win := RenderWindow new(width, height, 32, false, "Ice Cream Madness")
  17. engine addEntity(win)
  18. //--------------- Create the ingame console
  19. console := Console new(10, 10, width * 2/5, height * 2/5)
  20. engine addEntity(console)
  21. //--------------- Set up the keyboard / mouse input
  22. engine addEntity(EventMapper new())
  23. //--------------- Set up the physics engine
  24. engine addEntity(PhysicsEngine new())
  25. //--------------- Load the track
  26. track := Quad new("track")
  27. trackSide := 600.0
  28. track set("x_range", Float2 new(-trackSide, trackSide))
  29. track set("y_range", Float2 new(-trackSide, trackSide))
  30. track texture = Texture new("data/maps/circuit_couleur1.png")
  31. engine scene addModel(track)
  32. loader := R2MLoader new()
  33. loader trackScale = trackSide * 2
  34. level := loader load("data/maps/edited_track.r2m")
  35. level name = "level"
  36. engine addEntity(level)
  37. //--------------- Add our kart
  38. kart := Kart new()
  39. kart body get("position", Float3) set(-500, 350, 0)
  40. engine addEntity(kart)
  41. //--------------- Add the speedometer
  42. engine addEntity(SpeedoMeter new(kart))
  43. //--------------- Load and interpret the autoexec.cfg file
  44. autoPath := "autoexec.cfg"
  45. if(File new(autoPath) exists?()) {
  46. "Loading script file '" + autoPath + "'"
  47. console load(autoPath)
  48. }
  49. //--------------- Start the engine!
  50. engine run()
  51. }