This commit is contained in:
Andrea Odetti 2020-11-11 11:20:06 +00:00
parent c2105bfe1f
commit 0dda605c36
2 changed files with 14 additions and 5 deletions

View file

@ -31,6 +31,7 @@ namespace
getScreenData(data, width, height, sx, sy, sw, sh);
#if 0
void * pixels;
int pitch;
SDL_LockTexture(tex.get(), nullptr, &pixels, &pitch);
@ -38,7 +39,9 @@ namespace
memcpy(pixels, data, width * height * 4);
SDL_UnlockTexture(tex.get());
#else
SDL_UpdateTexture(tex.get(), nullptr, data, width * 4);
#endif
SDL_Rect srect;
srect.x = sx;
srect.y = sy;

View file

@ -178,8 +178,6 @@ void run_sdl(int argc, const char * argv [])
const int width = GetFrameBufferWidth();
const int height = GetFrameBufferHeight();
const int sx = GetFrameBufferBorderWidth();
const int sy = GetFrameBufferBorderHeight();
const int sw = GetFrameBufferBorderlessWidth();
const int sh = GetFrameBufferBorderlessHeight();
@ -197,8 +195,16 @@ void run_sdl(int argc, const char * argv [])
return;
}
const Uint32 format = SDL_PIXELFORMAT_BGRA32;
std::shared_ptr<SDL_Texture> tex(SDL_CreateTexture(ren.get(), format, SDL_TEXTUREACCESS_STREAMING, width, height), SDL_DestroyTexture);
SDL_RendererInfo info;
SDL_GetRendererInfo(ren.get(), &info);
for (size_t i = 0; i < info.num_texture_formats; ++i)
{
std::cerr << SDL_GetPixelFormatName(info.texture_formats[i]) << std::endl;
}
const Uint32 format = SDL_PIXELFORMAT_ARGB8888;
std::shared_ptr<SDL_Texture> tex(SDL_CreateTexture(ren.get(), format, SDL_TEXTUREACCESS_STATIC, width, height), SDL_DestroyTexture);
Emulator emulator(win, ren, tex);