mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Merge pull request #3040 from Laserlicht/infobox_next
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
#include "../mapView/mapHandler.h"
|
#include "../mapView/mapHandler.h"
|
||||||
#include "../mapView/MapView.h"
|
#include "../mapView/MapView.h"
|
||||||
#include "../windows/InfoWindows.h"
|
#include "../windows/InfoWindows.h"
|
||||||
|
#include "../widgets/RadialMenu.h"
|
||||||
#include "../CGameInfo.h"
|
#include "../CGameInfo.h"
|
||||||
#include "../gui/CursorHandler.h"
|
#include "../gui/CursorHandler.h"
|
||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
@@ -169,8 +170,7 @@ void AdventureMapInterface::dim(Canvas & to)
|
|||||||
{
|
{
|
||||||
for (auto window : GH.windows().findWindows<IShowActivatable>())
|
for (auto window : GH.windows().findWindows<IShowActivatable>())
|
||||||
{
|
{
|
||||||
std::shared_ptr<AdventureMapInterface> casted = std::dynamic_pointer_cast<AdventureMapInterface>(window);
|
if (!std::dynamic_pointer_cast<AdventureMapInterface>(window) && !std::dynamic_pointer_cast<RadialMenu>(window) && !window->isPopupWindow())
|
||||||
if (!casted && !window->isPopupWindow())
|
|
||||||
{
|
{
|
||||||
Rect targetRect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y);
|
Rect targetRect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y);
|
||||||
ColorRGBA colorToFill(0, 0, 0, std::clamp<int>(backgroundDimLevel, 0, 255));
|
ColorRGBA colorToFill(0, 0, 0, std::clamp<int>(backgroundDimLevel, 0, 255));
|
||||||
|
@@ -289,16 +289,14 @@ void CInfoBar::tick(uint32_t msPassed)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoBar::clickReleased(const Point & cursorPosition)
|
void CInfoBar::clickReleased(const Point & cursorPosition, bool lastActivated)
|
||||||
{
|
{
|
||||||
timerCounter = 0;
|
timerCounter = 0;
|
||||||
removeUsedEvents(TIME); //expiration trigger from just clicked element is not valid anymore
|
removeUsedEvents(TIME); //expiration trigger from just clicked element is not valid anymore
|
||||||
|
|
||||||
if(state == HERO || state == TOWN)
|
if(state == HERO || state == TOWN)
|
||||||
{
|
{
|
||||||
if(settings["gameTweaks"]["infoBarCreatureManagement"].Bool())
|
if(lastActivated)
|
||||||
return;
|
|
||||||
|
|
||||||
showGameStatus();
|
showGameStatus();
|
||||||
}
|
}
|
||||||
else if(state == GAME)
|
else if(state == GAME)
|
||||||
|
@@ -159,7 +159,7 @@ private:
|
|||||||
|
|
||||||
void tick(uint32_t msPassed) override;
|
void tick(uint32_t msPassed) override;
|
||||||
|
|
||||||
void clickReleased(const Point & cursorPosition) override;
|
void clickReleased(const Point & cursorPosition, bool lastActivated) override;
|
||||||
void showPopupWindow(const Point & cursorPosition) override;
|
void showPopupWindow(const Point & cursorPosition) override;
|
||||||
void hover(bool on) override;
|
void hover(bool on) override;
|
||||||
|
|
||||||
|
@@ -203,6 +203,7 @@ void EventDispatcher::handleLeftButtonClick(const Point & position, int toleranc
|
|||||||
// POSSIBLE SOLUTION: make EventReceivers inherit from create_shared_from this and store weak_ptr's in lists
|
// POSSIBLE SOLUTION: make EventReceivers inherit from create_shared_from this and store weak_ptr's in lists
|
||||||
AEventsReceiver * nearestElement = findElementInToleranceRange(lclickable, position, AEventsReceiver::LCLICK, tolerance);
|
AEventsReceiver * nearestElement = findElementInToleranceRange(lclickable, position, AEventsReceiver::LCLICK, tolerance);
|
||||||
auto hlp = lclickable;
|
auto hlp = lclickable;
|
||||||
|
bool lastActivated = true;
|
||||||
|
|
||||||
for(auto & i : hlp)
|
for(auto & i : hlp)
|
||||||
{
|
{
|
||||||
@@ -212,12 +213,19 @@ void EventDispatcher::handleLeftButtonClick(const Point & position, int toleranc
|
|||||||
if( i->receiveEvent(position, AEventsReceiver::LCLICK) || i == nearestElement)
|
if( i->receiveEvent(position, AEventsReceiver::LCLICK) || i == nearestElement)
|
||||||
{
|
{
|
||||||
if(isPressed)
|
if(isPressed)
|
||||||
|
{
|
||||||
i->clickPressed(position);
|
i->clickPressed(position);
|
||||||
|
i->clickPressed(position, lastActivated);
|
||||||
|
}
|
||||||
|
|
||||||
if (i->mouseClickedState && !isPressed)
|
if (i->mouseClickedState && !isPressed)
|
||||||
|
{
|
||||||
i->clickReleased(position);
|
i->clickReleased(position);
|
||||||
|
i->clickReleased(position, lastActivated);
|
||||||
|
}
|
||||||
|
|
||||||
i->mouseClickedState = isPressed;
|
i->mouseClickedState = isPressed;
|
||||||
|
lastActivated = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -45,6 +45,8 @@ protected:
|
|||||||
public:
|
public:
|
||||||
virtual void clickPressed(const Point & cursorPosition) {}
|
virtual void clickPressed(const Point & cursorPosition) {}
|
||||||
virtual void clickReleased(const Point & cursorPosition) {}
|
virtual void clickReleased(const Point & cursorPosition) {}
|
||||||
|
virtual void clickPressed(const Point & cursorPosition, bool lastActivated) {}
|
||||||
|
virtual void clickReleased(const Point & cursorPosition, bool lastActivated) {}
|
||||||
virtual void clickCancel(const Point & cursorPosition) {}
|
virtual void clickCancel(const Point & cursorPosition) {}
|
||||||
virtual void showPopupWindow(const Point & cursorPosition) {}
|
virtual void showPopupWindow(const Point & cursorPosition) {}
|
||||||
virtual void clickDouble(const Point & cursorPosition) {}
|
virtual void clickDouble(const Point & cursorPosition) {}
|
||||||
|
Reference in New Issue
Block a user