1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Merge branch 'master' into wip/landscape

This commit is contained in:
Mathieu Schroeter 2017-10-11 16:21:40 +02:00
commit e56b83e87c
4 changed files with 13 additions and 7 deletions

View File

@ -875,7 +875,7 @@ DoInit (int argc, char * argv[], bool & exit)
}
// Load all cursors
g_pPixmap->LoadCursors ();
g_pPixmap->LoadCursors (g_windowScale);
g_pPixmap->ChangeSprite (SPRITE_WAIT); // met le sablier maison
// Create the sound manager.

View File

@ -1657,6 +1657,7 @@ CEvent::SetFullScreen (bool bFullScreen)
SDL_SetWindowPosition (
g_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
m_pPixmap->LoadCursors (m_WindowScale);
m_pPixmap->ReloadTargetTextures ();
/* Force this update before otherwise the coordinates retrieved with
@ -1715,6 +1716,7 @@ CEvent::SetWindowSize (Uint8 prevScale, Uint8 newScale)
SDL_SetWindowPosition (
g_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
m_pPixmap->LoadCursors (newScale);
m_pPixmap->ReloadTargetTextures ();
/* Force this update before otherwise the coordinates retrieved with

View File

@ -821,7 +821,7 @@ CPixmap::GetCursorRect (MouseSprites sprite)
}
void
CPixmap::LoadCursors ()
CPixmap::LoadCursors (Uint8 scale)
{
Uint32 rmask, gmask, bmask, amask;
@ -842,16 +842,20 @@ on the endianness (byte order) of the machine */
for (int i = SPRITE_BEGIN; i <= SPRITE_END; ++i)
{
MouseSprites sprite = static_cast<MouseSprites> (i);
if (m_lpSDLCursors[sprite - 1])
SDL_FreeCursor (m_lpSDLCursors[sprite - 1]);
SDL_Point hotspot = this->GetCursorHotSpot (sprite);
SDL_Rect rect = this->GetCursorRect (sprite);
SDL_Surface * surface =
SDL_CreateRGBSurface (0, rect.w, rect.h, 32, rmask, gmask, bmask, amask);
SDL_BlitSurface (m_lpSDLBlupi, &rect, surface, nullptr);
SDL_Surface * surface = SDL_CreateRGBSurface (
0, rect.w * scale, rect.h * scale, 32, rmask, gmask, bmask, amask);
SDL_BlitScaled (m_lpSDLBlupi, &rect, surface, nullptr);
// FIXME: change cursor first value to 0
m_lpSDLCursors[sprite - 1] =
SDL_CreateColorCursor (surface, hotspot.x, hotspot.y);
SDL_CreateColorCursor (surface, hotspot.x * scale, hotspot.y * scale);
SDL_FreeSurface (surface);
}
}

View File

@ -86,7 +86,7 @@ public:
void SetMouseSprite (MouseSprites sprite);
void MouseShow (bool bShow);
void LoadCursors ();
void LoadCursors (Uint8 scale);
void ChangeSprite (MouseSprites sprite);
protected: