mirror of
https://github.com/vcmi/vcmi.git
synced 2025-10-08 23:22:25 +02:00
resizable battle window
This commit is contained in:
@@ -148,8 +148,9 @@ void BattleWindow::createQueue()
|
||||
//re-center, taking into account stack queue position
|
||||
pos.y -= queue->pos.h;
|
||||
pos.h += queue->pos.h;
|
||||
pos = center();
|
||||
}
|
||||
if(showQueue)
|
||||
pos = center();
|
||||
|
||||
if (!showQueue)
|
||||
queue->disable();
|
||||
@@ -236,6 +237,9 @@ void BattleWindow::showStickyQuickSpellWindow()
|
||||
quickSpellWindow->setEnabled(quickSpellWindowVisible);
|
||||
unitActionWindow->setEnabled(unitActionWindowVisible);
|
||||
|
||||
if(owner.actionsController && unitActionWindowVisible) // needed after resize of window
|
||||
owner.actionsController->activateStack();
|
||||
|
||||
createTimerInfoWindows();
|
||||
setPositionInfoWindow();
|
||||
ENGINE->windows().totalRedraw();
|
||||
@@ -317,8 +321,8 @@ void BattleWindow::hideQueue()
|
||||
//re-center, taking into account stack queue position
|
||||
pos.y += queue->pos.h;
|
||||
pos.h -= queue->pos.h;
|
||||
pos = center();
|
||||
}
|
||||
pos = center();
|
||||
setPositionInfoWindow();
|
||||
ENGINE->windows().totalRedraw();
|
||||
}
|
||||
@@ -859,6 +863,25 @@ void BattleWindow::show(Canvas & to)
|
||||
GAME->interface()->cingconsole->show(to);
|
||||
}
|
||||
|
||||
void BattleWindow::onScreenResize()
|
||||
{
|
||||
if(settings["battle"]["showQueue"].Bool())
|
||||
{
|
||||
hideQueue();
|
||||
showQueue();
|
||||
}
|
||||
if(settings["battle"]["enableQuickSpellPanel"].Bool())
|
||||
{
|
||||
hideStickyQuickSpellWindow();
|
||||
showStickyQuickSpellWindow();
|
||||
}
|
||||
if(settings["battle"]["stickyHeroInfoWindows"].Bool())
|
||||
{
|
||||
hideStickyHeroWindows();
|
||||
showStickyHeroWindows();
|
||||
}
|
||||
}
|
||||
|
||||
void BattleWindow::close()
|
||||
{
|
||||
if(!ENGINE->windows().isTopWindow(this))
|
||||
|
@@ -133,6 +133,7 @@ public:
|
||||
void clickPressed(const Point & cursorPosition) override;
|
||||
void show(Canvas & to) override;
|
||||
void showAll(Canvas & to) override;
|
||||
void onScreenResize() override;
|
||||
|
||||
/// Toggle UI to displaying tactics phase
|
||||
void tacticPhaseStarted();
|
||||
|
@@ -35,7 +35,7 @@ UnitActionPanel::UnitActionPanel(BattleInterface & owner)
|
||||
{
|
||||
OBJECT_CONSTRUCTION;
|
||||
|
||||
addUsedEvents(LCLICK | SHOW_POPUP | MOVE | INPUT_MODE_CHANGE);
|
||||
addUsedEvents(LCLICK | SHOW_POPUP | MOVE);
|
||||
|
||||
pos = Rect(0, 0, 52, 600);
|
||||
background = std::make_shared<CFilledTexture>(ImagePath::builtin("DIBOXBCK"), pos);
|
||||
|
@@ -91,21 +91,21 @@ public:
|
||||
/// These are the arguments that can be used to determine what kind of input UI element will receive
|
||||
enum
|
||||
{
|
||||
LCLICK = 1,
|
||||
SHOW_POPUP = 2,
|
||||
HOVER = 4,
|
||||
MOVE = 8,
|
||||
KEYBOARD = 16,
|
||||
TIME = 32,
|
||||
GENERAL = 64,
|
||||
WHEEL = 128,
|
||||
DOUBLECLICK = 256,
|
||||
TEXTINPUT = 512,
|
||||
GESTURE = 1024,
|
||||
DRAG = 2048,
|
||||
INPUT_MODE_CHANGE = 4096,
|
||||
DRAG_POPUP = 8192,
|
||||
KEY_NAME = 16384
|
||||
LCLICK = 1 << 0,
|
||||
SHOW_POPUP = 1 << 1,
|
||||
HOVER = 1 << 2,
|
||||
MOVE = 1 << 3,
|
||||
KEYBOARD = 1 << 4,
|
||||
TIME = 1 << 5,
|
||||
GENERAL = 1 << 6,
|
||||
WHEEL = 1 << 7,
|
||||
DOUBLECLICK = 1 << 8,
|
||||
TEXTINPUT = 1 << 9,
|
||||
GESTURE = 1 << 10,
|
||||
DRAG = 1 << 11,
|
||||
INPUT_MODE_CHANGE = 1 << 12,
|
||||
DRAG_POPUP = 1 << 13,
|
||||
KEY_NAME = 1 << 14
|
||||
};
|
||||
|
||||
/// Returns true if element is currently hovered by mouse
|
||||
|
Reference in New Issue
Block a user