void SDLHardwareRenderDevice::windowResize() { windowResizeInternal(); SDL_RenderSetLogicalSize(renderer, VIEW_W, VIEW_H); if (texture) SDL_DestroyTexture(texture); texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, VIEW_W, VIEW_H); SDL_SetRenderTarget(renderer, texture); updateScreenVars(); }
void SDLHardwareRenderDevice::windowResize() { int w,h; SDL_GetWindowSize(window, &w, &h); SCREEN_W = static_cast<unsigned short>(w); SCREEN_H = static_cast<unsigned short>(h); float scale = static_cast<float>(VIEW_H) / static_cast<float>(SCREEN_H); VIEW_W = static_cast<unsigned short>(static_cast<float>(SCREEN_W) * scale); // letterbox if too tall if (VIEW_W < MIN_SCREEN_W) { VIEW_W = MIN_SCREEN_W; } VIEW_W_HALF = VIEW_W/2; SDL_RenderSetLogicalSize(renderer, VIEW_W, VIEW_H); if (texture) SDL_DestroyTexture(texture); texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, VIEW_W, VIEW_H); SDL_SetRenderTarget(renderer, texture); updateScreenVars(); }