mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-24 14:55:11 +00:00
check SDL_UpdateTexture return code as well
This commit is contained in:
parent
297046ec14
commit
2afded6e05
1 changed files with 5 additions and 3 deletions
|
@ -156,8 +156,9 @@ set_size(Uint16 width, Uint16 height, int is_resize)
|
||||||
SDL_RenderSetLogicalSize(gRenderer, ppu.width + PAD * 2, ppu.height + PAD * 2);
|
SDL_RenderSetLogicalSize(gRenderer, ppu.width + PAD * 2, ppu.height + PAD * 2);
|
||||||
gTexture = SDL_CreateTexture(gRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, ppu.width + PAD * 2, ppu.height + PAD * 2);
|
gTexture = SDL_CreateTexture(gRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, ppu.width + PAD * 2, ppu.height + PAD * 2);
|
||||||
if(gTexture == NULL || SDL_SetTextureBlendMode(gTexture, SDL_BLENDMODE_NONE))
|
if(gTexture == NULL || SDL_SetTextureBlendMode(gTexture, SDL_BLENDMODE_NONE))
|
||||||
return error("sdl_texture", SDL_GetError());
|
return error("gTexture", SDL_GetError());
|
||||||
SDL_UpdateTexture(gTexture, NULL, ppu_screen, sizeof(Uint32));
|
if(SDL_UpdateTexture(gTexture, NULL, ppu_screen, sizeof(Uint32)) != 0)
|
||||||
|
return error("SDL_UpdateTexture", SDL_GetError());
|
||||||
if(is_resize)
|
if(is_resize)
|
||||||
set_window_size(gWindow, (ppu.width + PAD * 2) * zoom, (ppu.height + PAD * 2) * zoom);
|
set_window_size(gWindow, (ppu.width + PAD * 2) * zoom, (ppu.height + PAD * 2) * zoom);
|
||||||
ppu.reqdraw = 1;
|
ppu.reqdraw = 1;
|
||||||
|
@ -219,7 +220,8 @@ redraw(Uxn *u)
|
||||||
for(y = 0; y < ppu.height; ++y)
|
for(y = 0; y < ppu.height; ++y)
|
||||||
for(x = 0; x < ppu.width; ++x)
|
for(x = 0; x < ppu.width; ++x)
|
||||||
ppu_screen[x + y * ppu.width] = palette[ppu_read(&ppu, x, y)];
|
ppu_screen[x + y * ppu.width] = palette[ppu_read(&ppu, x, y)];
|
||||||
SDL_UpdateTexture(gTexture, &gRect, ppu_screen, ppu.width * sizeof(Uint32));
|
if(SDL_UpdateTexture(gTexture, &gRect, ppu_screen, ppu.width * sizeof(Uint32)) != 0)
|
||||||
|
error("SDL_UpdateTexture", SDL_GetError());
|
||||||
SDL_RenderClear(gRenderer);
|
SDL_RenderClear(gRenderer);
|
||||||
SDL_RenderCopy(gRenderer, gTexture, NULL, NULL);
|
SDL_RenderCopy(gRenderer, gTexture, NULL, NULL);
|
||||||
SDL_RenderPresent(gRenderer);
|
SDL_RenderPresent(gRenderer);
|
||||||
|
|
Loading…
Reference in a new issue