1 module source.app;
2 
3 //@safe:
4 import foxid;
5 import source.dasher;
6 import source.screen;
7 
8 import jmisc;
9 
10 version(unittest)
11     import unit_threaded;
12 
13 import jmisc;
14 
15 immutable g_stepSize = 24;
16 
17 /+
18 	Create our first scene
19 +/
20 final class RockDashScene : Scene
21 {
22 	import foxid.sdl;
23 
24 	private Font fontgame;
25 	
26 	this() @trusted {
27 		name = "RockDashScene";
28 
29         auto fileName = "assets/screen.txt";
30         import std.file, std..string;
31         auto data = readText(fileName).split('\n');
32         auto p = Vec(0,0);
33         foreach(lineNum, line; data) {
34             foreach(s; line) {
35 				add(new Piece(p, s));
36                 p.x += g_stepSize;
37             }
38             p.x = 0;
39             p.y += g_stepSize;
40         }
41 
42 		fontgame = loader.loadFont("assets/arcade_classic.ttf",14);
43 		add(new Dasher());
44 		//add(new Screen("assets/screen.txt"));
45 	}
46 
47 	override void draw(Display graph) @safe {
48 		graph.drawText("Hello Rock Dash fan!", fontgame, Color(255,180,0), Vec(0,0));
49 	}
50 }
51 
52 version(unittest) {
53 } else {
54 	int main(string[] args)
55 	{
56 		// game setup
57 		Game game = new Game(640, 480, "* Rock Dash *");
58 		window.background = Color(0,0,0);
59 
60 		/+
61 			Add to the scene in the manager.
62 		+/
63 		sceneManager.add(new RockDashScene());
64 
65 		/+
66 			We put the very first added scene active
67 		+/
68 		sceneManager.inbegin();
69 
70 		game.handle();
71 
72 		return 0;
73 	}
74 }