test/snake/snake.c

changeset 96
9e25f080a33e
parent 93
52611a99e574
equal deleted inserted replaced
95:622887f7e954 96:9e25f080a33e
34 TEX_SHIP = 0, 34 TEX_SHIP = 0,
35 TEX2D_COUNT 35 TEX2D_COUNT
36 }; 36 };
37 static AscTexture tex2d[TEX2D_COUNT]; 37 static AscTexture tex2d[TEX2D_COUNT];
38 #define TEXTURE_SHIP &tex2d[TEX_SHIP] 38 #define TEXTURE_SHIP &tex2d[TEX_SHIP]
39
40 #define MAIN_SCENE asc_window_scene(0)
39 41
40 static void destroy_textures(void *dummy) { 42 static void destroy_textures(void *dummy) {
41 asc_texture_destroy(tex2d, TEX2D_COUNT); 43 asc_texture_destroy(tex2d, TEX2D_COUNT);
42 } 44 }
43 45
99 .y = 300, 101 .y = 300,
100 .width = 64, 102 .width = 64,
101 .height = 64 103 .height = 64
102 ); 104 );
103 105
104 // TODO: add to 2D scene instead of UI scene, once we have one 106 asc_scene_add_node(MAIN_SCENE, sprite);
105 asc_add_ui_node(sprite);
106 107
107 // TODO: return something 108 // TODO: return something
108 } 109 }
109 110
110 int main(int argc, char** argv) { 111 int main(int argc, char** argv) {
125 // create window 126 // create window
126 AscWindowSettings settings; 127 AscWindowSettings settings;
127 asc_window_settings_init_defaults(&settings); 128 asc_window_settings_init_defaults(&settings);
128 settings.title = "Snake"; 129 settings.title = "Snake";
129 asc_window_initialize(0, &settings); 130 asc_window_initialize(0, &settings);
131
132 // initialize the main scene (a 500x500 game field)
133 asc_scene_init(MAIN_SCENE);
134 // TODO: this is intentionally bullshit at the moment to force me to care about aspect ratio
135 asc_camera_ortho(&MAIN_SCENE->camera, (asc_recti){0, 0, 500, 500});
130 136
131 // load textures 137 // load textures
132 init_textures(); 138 init_textures();
133 139
134 // create UI elements 140 // create UI elements

mercurial