mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
dim adventuremap
This commit is contained in:
parent
695a51d8c8
commit
40c7ddcaf4
@ -24,6 +24,9 @@
|
||||
#include "../mapView/mapHandler.h"
|
||||
#include "../mapView/MapView.h"
|
||||
#include "../windows/InfoWindows.h"
|
||||
#include "../windows/CCastleInterface.h"
|
||||
#include "../windows/CHeroWindow.h"
|
||||
#include "../windows/CKingdomInterface.h"
|
||||
#include "../CGameInfo.h"
|
||||
#include "../gui/CursorHandler.h"
|
||||
#include "../gui/CGuiHandler.h"
|
||||
@ -153,15 +156,25 @@ void AdventureMapInterface::deactivate()
|
||||
void AdventureMapInterface::showAll(Canvas & to)
|
||||
{
|
||||
CIntObject::showAll(to);
|
||||
dim(to);
|
||||
LOCPLINT->cingconsole->show(to);
|
||||
}
|
||||
|
||||
void AdventureMapInterface::show(Canvas & to)
|
||||
{
|
||||
CIntObject::show(to);
|
||||
dim(to);
|
||||
LOCPLINT->cingconsole->show(to);
|
||||
}
|
||||
|
||||
void AdventureMapInterface::dim(Canvas & to)
|
||||
{
|
||||
if(!GH.windows().findWindows<CCastleInterface>().empty() ||
|
||||
!GH.windows().findWindows<CHeroWindow>().empty() ||
|
||||
!GH.windows().findWindows<CKingdomInterface>().empty())
|
||||
to.drawColor(Rect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y), ColorRGBA(0, 0, 0, 128));
|
||||
}
|
||||
|
||||
void AdventureMapInterface::tick(uint32_t msPassed)
|
||||
{
|
||||
handleMapScrollingUpdate(msPassed);
|
||||
|
@ -89,6 +89,9 @@ private:
|
||||
/// casts current spell at specified location
|
||||
void performSpellcasting(const int3 & castTarget);
|
||||
|
||||
/// dim interface if some windows opened
|
||||
void dim(Canvas & to);
|
||||
|
||||
protected:
|
||||
/// CIntObject interface implementation
|
||||
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
/// renders multiple lines of text with specified parameters
|
||||
void drawText(const Point & position, const EFonts & font, const ColorRGBA & colorDest, ETextAlignment alignment, const std::vector<std::string> & text );
|
||||
|
||||
/// fills selected area with solid color, ignoring any transparency
|
||||
/// fills selected area with solid color
|
||||
void drawColor(const Rect & target, const ColorRGBA & color);
|
||||
|
||||
/// Compatibility method. AVOID USAGE. To be removed once SDL abstraction layer is finished.
|
||||
|
@ -804,7 +804,10 @@ void CSDL_Ext::fillRect( SDL_Surface *dst, const Rect & dstrect, const SDL_Color
|
||||
SDL_Rect newRect = CSDL_Ext::toSDL(dstrect);
|
||||
|
||||
uint32_t sdlColor = SDL_MapRGBA(dst->format, color.r, color.g, color.b, color.a);
|
||||
SDL_FillRect(dst, &newRect, sdlColor);
|
||||
SDL_Surface * tmp = SDL_CreateRGBSurface(0, newRect.w, newRect.h, dst->format->BitsPerPixel, dst->format->Rmask, dst->format->Gmask, dst->format->Bmask, dst->format->Amask);
|
||||
SDL_FillRect(tmp, NULL, sdlColor);
|
||||
SDL_BlitSurface(tmp, NULL, dst, &newRect);
|
||||
SDL_FreeSurface(tmp);
|
||||
}
|
||||
|
||||
STRONG_INLINE static uint32_t mapColor(SDL_Surface * surface, SDL_Color color)
|
||||
|
Loading…
Reference in New Issue
Block a user