don't use SDL_UpdateTexture() for this

This commit is contained in:
erysdren 2024-10-14 15:08:21 -05:00
parent 4e3e41036d
commit 59b9305bb8

View file

@ -10,6 +10,8 @@ static SDL_Texture *texture = nullptr;
static void editor_yeti_tick(void)
{
void *pixels;
int pitch;
const bool *keys = SDL_GetKeyboardState(nullptr);
yeti.keyboard.state.up = keys[SDL_SCANCODE_UP] || keys[SDL_SCANCODE_W];
@ -24,7 +26,11 @@ static void editor_yeti_tick(void)
game_loop(&yeti);
SDL_UpdateTexture(texture, nullptr, backbuffer, YETI_FRAMEBUFFER_WIDTH * sizeof(u16));
if (SDL_LockTexture(texture, NULL, &pixels, &pitch))
{
SDL_memcpy(pixels, (void *)backbuffer, sizeof(backbuffer));
SDL_UnlockTexture(texture);
}
}
void editor_init(void)