mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Reload the textures (target) when the window size changes
This commit is contained in:
parent
63285d466e
commit
fc37ddd017
@ -1640,6 +1640,8 @@ void CEvent::SetWindowSize (Uint8 prevScale, Uint8 newScale)
|
|||||||
else
|
else
|
||||||
SDL_RenderSetLogicalSize (g_renderer, LXIMAGE, LYIMAGE);
|
SDL_RenderSetLogicalSize (g_renderer, LXIMAGE, LYIMAGE);
|
||||||
|
|
||||||
|
m_pPixmap->ReloadTargetTextures ();
|
||||||
|
|
||||||
/* Force this update before otherwise the coordinates retrieved with
|
/* Force this update before otherwise the coordinates retrieved with
|
||||||
* the Warp SDL function are corresponding to the previous size.
|
* the Warp SDL function are corresponding to the previous size.
|
||||||
*/
|
*/
|
||||||
|
@ -171,9 +171,31 @@ Sint32 CPixmap::BltFast (SDL_Texture *lpSDL, size_t channel, POINT dst,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Reload textures created with access target flag.
|
||||||
|
*
|
||||||
|
* \returns true on success.
|
||||||
|
*/
|
||||||
|
bool CPixmap::ReloadTargetTextures ()
|
||||||
|
{
|
||||||
|
for (auto &tex: m_SDLTextureInfo)
|
||||||
|
{
|
||||||
|
if (!tex.second.target)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!Cache (tex.first,
|
||||||
|
tex.second.file,
|
||||||
|
tex.second.dimTotal,
|
||||||
|
tex.second.dimIcon))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Cache une image contenant des ic�nes.
|
// Cache une image contenant des ic�nes.
|
||||||
|
|
||||||
bool CPixmap::Cache (size_t channel, const char *pFilename, POINT totalDim,
|
bool CPixmap::Cache (size_t channel, const std::string &pFilename, POINT totalDim,
|
||||||
POINT iconDim)
|
POINT iconDim)
|
||||||
{
|
{
|
||||||
std::string file = GetBaseDir() + pFilename;
|
std::string file = GetBaseDir() + pFilename;
|
||||||
@ -230,7 +252,7 @@ bool CPixmap::Cache (size_t channel, const char *pFilename, POINT totalDim,
|
|||||||
|
|
||||||
// Cache une image globale.
|
// Cache une image globale.
|
||||||
|
|
||||||
bool CPixmap::Cache (size_t channel, const char *pFilename, POINT totalDim)
|
bool CPixmap::Cache (size_t channel, const std::string &pFilename, POINT totalDim)
|
||||||
{
|
{
|
||||||
POINT iconDim;
|
POINT iconDim;
|
||||||
|
|
||||||
|
@ -32,9 +32,10 @@ public:
|
|||||||
bool Create (POINT dim, Sint32 mouseType);
|
bool Create (POINT dim, Sint32 mouseType);
|
||||||
void Fill (RECT rect, COLORREF color);
|
void Fill (RECT rect, COLORREF color);
|
||||||
|
|
||||||
bool Cache (size_t channel, const char *pFilename, POINT totalDim,
|
bool ReloadTargetTextures ();
|
||||||
|
bool Cache (size_t channel, const std::string &pFilename, POINT totalDim,
|
||||||
POINT iconDim);
|
POINT iconDim);
|
||||||
bool Cache (size_t channel, const char *pFilename, POINT totalDim);
|
bool Cache (size_t channel, const std::string &pFilename, POINT totalDim);
|
||||||
bool Cache (size_t channel, SDL_Surface *surface, POINT totalDim);
|
bool Cache (size_t channel, SDL_Surface *surface, POINT totalDim);
|
||||||
void SetClipping (RECT clip);
|
void SetClipping (RECT clip);
|
||||||
RECT GetClipping();
|
RECT GetClipping();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user