don't use SDL_UpdateTexture() for this
This commit is contained in:
parent
4e3e41036d
commit
59b9305bb8
1 changed files with 7 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue