diff options
Diffstat (limited to 'demos/checkerboard/checkerboard.c')
-rw-r--r-- | demos/checkerboard/checkerboard.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/demos/checkerboard/checkerboard.c b/demos/checkerboard/checkerboard.c index dbc817c..9d1791e 100644 --- a/demos/checkerboard/checkerboard.c +++ b/demos/checkerboard/checkerboard.c | |||
@@ -76,11 +76,10 @@ static bool init(GfxAppState* state, int argc, const char** argv) { | |||
76 | isogfx_resize(iso, SCREEN_WIDTH, SCREEN_HEIGHT); | 76 | isogfx_resize(iso, SCREEN_WIDTH, SCREEN_HEIGHT); |
77 | 77 | ||
78 | if (!isogfx_make_world( | 78 | if (!isogfx_make_world( |
79 | iso, &(WorldDesc){ | 79 | iso, &(WorldDesc){.tile_width = TILE_WIDTH, |
80 | .tile_width = TILE_WIDTH, | 80 | .tile_height = TILE_HEIGHT, |
81 | .tile_height = TILE_HEIGHT, | 81 | .world_width = WORLD_WIDTH, |
82 | .world_width = WORLD_WIDTH, | 82 | .world_height = WORLD_HEIGHT})) { |
83 | .world_height = WORLD_HEIGHT})) { | ||
84 | return false; | 83 | return false; |
85 | } | 84 | } |
86 | 85 | ||
@@ -89,7 +88,7 @@ static bool init(GfxAppState* state, int argc, const char** argv) { | |||
89 | state->red = isogfx_make_tile(iso, &tile_set[Red]); | 88 | state->red = isogfx_make_tile(iso, &tile_set[Red]); |
90 | make_checkerboard(iso, black, white); | 89 | make_checkerboard(iso, black, white); |
91 | 90 | ||
92 | if (!(state->backend = IsoBackendInit(iso))) { | 91 | if (!(state->backend = iso_backend_init(iso))) { |
93 | return false; | 92 | return false; |
94 | } | 93 | } |
95 | 94 | ||
@@ -99,7 +98,7 @@ static bool init(GfxAppState* state, int argc, const char** argv) { | |||
99 | static void shutdown(GfxAppState* state) { | 98 | static void shutdown(GfxAppState* state) { |
100 | assert(state); | 99 | assert(state); |
101 | 100 | ||
102 | IsoBackendShutdown(&state->backend); | 101 | iso_backend_shutdown(&state->backend); |
103 | isogfx_del(&state->iso); | 102 | isogfx_del(&state->iso); |
104 | } | 103 | } |
105 | 104 | ||
@@ -116,7 +115,7 @@ static void update(GfxAppState* state, double t, double dt) { | |||
116 | gfx_app_get_mouse_position(&mouse_x, &mouse_y); | 115 | gfx_app_get_mouse_position(&mouse_x, &mouse_y); |
117 | 116 | ||
118 | // Map from window coordinates to virtual screen coordinates. | 117 | // Map from window coordinates to virtual screen coordinates. |
119 | IsoBackendGetMousePosition( | 118 | iso_backend_get_mouse_position( |
120 | state->backend, mouse_x, mouse_y, &mouse_x, &mouse_y); | 119 | state->backend, mouse_x, mouse_y, &mouse_x, &mouse_y); |
121 | 120 | ||
122 | isogfx_pick_tile(iso, mouse_x, mouse_y, &state->xpick, &state->ypick); | 121 | isogfx_pick_tile(iso, mouse_x, mouse_y, &state->xpick, &state->ypick); |
@@ -135,32 +134,31 @@ static void render(GfxAppState* state) { | |||
135 | isogfx_draw_tile(iso, state->xpick, state->ypick, state->red); | 134 | isogfx_draw_tile(iso, state->xpick, state->ypick, state->red); |
136 | } | 135 | } |
137 | 136 | ||
138 | IsoBackendRender(state->backend, iso); | 137 | iso_backend_render(state->backend, iso); |
139 | } | 138 | } |
140 | 139 | ||
141 | static void resize(GfxAppState* state, int width, int height) { | 140 | static void resize(GfxAppState* state, int width, int height) { |
142 | assert(state); | 141 | assert(state); |
143 | 142 | ||
144 | IsoBackendResizeWindow(state->backend, state->iso, width, height); | 143 | iso_backend_resize_window(state->backend, state->iso, width, height); |
145 | } | 144 | } |
146 | 145 | ||
147 | int main(int argc, const char** argv) { | 146 | int main(int argc, const char** argv) { |
148 | GfxAppState state = {0}; | 147 | GfxAppState state = {0}; |
149 | gfx_app_run( | 148 | gfx_app_run( |
150 | &(GfxAppDesc){ | 149 | &(GfxAppDesc){.argc = argc, |
151 | .argc = argc, | 150 | .argv = argv, |
152 | .argv = argv, | 151 | .width = WINDOW_WIDTH, |
153 | .width = WINDOW_WIDTH, | 152 | .height = WINDOW_HEIGHT, |
154 | .height = WINDOW_HEIGHT, | 153 | .max_fps = MAX_FPS, |
155 | .max_fps = MAX_FPS, | 154 | .update_delta_time = |
156 | .update_delta_time = MAX_FPS > 0 ? 1.0 / (double)MAX_FPS : 0.0, | 155 | MAX_FPS > 0 ? 1.0 / (double)MAX_FPS : 0.0, |
157 | .title = "Isometric Renderer", | 156 | .title = "Isometric Renderer", |
158 | .app_state = &state}, | 157 | .app_state = &state}, |
159 | &(GfxAppCallbacks){ | 158 | &(GfxAppCallbacks){.init = init, |
160 | .init = init, | 159 | .update = update, |
161 | .update = update, | 160 | .render = render, |
162 | .render = render, | 161 | .resize = resize, |
163 | .resize = resize, | 162 | .shutdown = shutdown}); |
164 | .shutdown = shutdown}); | ||
165 | return 0; | 163 | return 0; |
166 | } | 164 | } |