Skip to content

Commit cbf4470

Browse files
maia-sslouken
authored andcommitted
bytepusher example: always render text to render target and remove unused variable
1 parent faddff1 commit cbf4470

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

examples/demo/04-bytepusher/bytepusher.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
typedef struct {
2929
Uint8 ram[RAM_SIZE + 8];
30-
Uint8 screenbuf[SCREEN_W * SCREEN_H];
3130
Uint64 last_tick;
3231
Uint64 tick_acc;
3332
SDL_Window* window;
@@ -187,7 +186,7 @@ SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[]) {
187186
}
188187

189188
if (!(vm->screen = SDL_CreateSurfaceFrom(
190-
SCREEN_W, SCREEN_H, SDL_PIXELFORMAT_INDEX8, vm->screenbuf, SCREEN_W
189+
SCREEN_W, SCREEN_H, SDL_PIXELFORMAT_INDEX8, vm->ram, SCREEN_W
191190
))) {
192191
return SDL_APP_FAILURE;
193192
}
@@ -296,18 +295,18 @@ SDL_AppResult SDL_AppIterate(void* appstate) {
296295
SDL_UnlockTexture(vm->screentex);
297296

298297
SDL_RenderTexture(vm->renderer, vm->screentex, NULL, NULL);
299-
}
300298

301-
if (vm->display_help) {
302-
print(vm, 4, 4, "Drop a BytePusher file in this");
303-
print(vm, 8, 12, "window to load and run it!");
304-
print(vm, 4, 28, "Press ENTER to switch between");
305-
print(vm, 8, 36, "positional and symbolic input.");
306-
}
299+
if (vm->display_help) {
300+
print(vm, 4, 4, "Drop a BytePusher file in this");
301+
print(vm, 8, 12, "window to load and run it!");
302+
print(vm, 4, 28, "Press ENTER to switch between");
303+
print(vm, 8, 36, "positional and symbolic input.");
304+
}
307305

308-
if (vm->status_ticks > 0) {
309-
vm->status_ticks -= 1;
310-
print(vm, 4, SCREEN_H - 12, vm->status);
306+
if (vm->status_ticks > 0) {
307+
vm->status_ticks -= 1;
308+
print(vm, 4, SCREEN_H - 12, vm->status);
309+
}
311310
}
312311

313312
SDL_SetRenderTarget(vm->renderer, NULL);

0 commit comments

Comments
 (0)