PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/source/icmadness.ooc

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