Groundwork for sys, palette

This commit is contained in:
2024-02-25 17:54:57 -08:00
parent 56eaee9d08
commit 95c03d25d5
8 changed files with 201 additions and 8 deletions

View File

@ -121,6 +121,7 @@ void sdl_host_suggest_dimensions(uint32_t* window_w, uint32_t* window_h) {
void sdl_host_loop() {
uint32_t ticks_per_frame = 1000/60;
uint32_t real_pixels[DEVICE_H][DEVICE_W];
game_init();
while (true) {
@ -139,7 +140,13 @@ void sdl_host_loop() {
game_update();
game_draw();
SDL_UpdateTexture(sdl_host_target, NULL, &device_pixels, sizeof(device_pixels[0]));
for (int x = 0; x < DEVICE_W; x++) {
for (int y = 0; y < DEVICE_H; y++) {
real_pixels[y][x] = device_palette[device_pixels[y][x]];
}
}
SDL_UpdateTexture(sdl_host_target, NULL, &real_pixels, sizeof(real_pixels[0]));
SDL_RenderClear(sdl_host_renderer);
SDL_RenderCopy(sdl_host_renderer, sdl_host_target, NULL, NULL);
SDL_RenderPresent(sdl_host_renderer);