Commit 416a3123 authored by edo9300's avatar edo9300

resizable game

parent e41eaecb
...@@ -646,12 +646,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -646,12 +646,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case irr::EMIE_MOUSE_MOVED: { case irr::EMIE_MOUSE_MOVED: {
int x = event.MouseInput.X; position2di pos = mainGame->Resize(event.MouseInput.X, event.MouseInput.Y, true);
int y = event.MouseInput.Y; position2di mousepos(event.MouseInput.X, event.MouseInput.Y);
irr::core::position2di mouse_pos(x, y); s32 x = pos.X;
irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement(); s32 y = pos.Y;
if(root->getElementFromPoint(mouse_pos) != root)
break;
int pre_code = hovered_code; int pre_code = hovered_code;
if(x >= 314 && x <= 794 && y >= 164 && y <= 435) { if(x >= 314 && x <= 794 && y >= 164 && y <= 435) {
int lx = 10, px, py = (y - 164) / 68; int lx = 10, px, py = (y - 164) / 68;
...@@ -710,8 +708,8 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -710,8 +708,8 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
hovered_code = 0; hovered_code = 0;
} }
if(is_draging) { if(is_draging) {
dragx = x; dragx = mousepos.X;
dragy = y; dragy = mousepos.Y;
} }
if(!is_draging && pre_code != hovered_code) { if(!is_draging && pre_code != hovered_code) {
if(hovered_code) { if(hovered_code) {
......
This diff is collapsed.
...@@ -1103,10 +1103,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1103,10 +1103,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case irr::EMIE_LMOUSE_LEFT_UP: { case irr::EMIE_LMOUSE_LEFT_UP: {
if(!mainGame->dInfo.isStarted) if(!mainGame->dInfo.isStarted)
break; break;
s32 x = event.MouseInput.X;
s32 y = event.MouseInput.Y;
hovered_location = 0; hovered_location = 0;
irr::core::position2di pos(x, y); position2di pos = mainGame->Resize(event.MouseInput.X, event.MouseInput.Y, true);
position2di mousepos(event.MouseInput.X, event.MouseInput.Y);
s32 x = pos.X;
s32 y = pos.Y;
if(x < 300) if(x < 300)
break; break;
if(mainGame->gameConf.control_mode == 1) { if(mainGame->gameConf.control_mode == 1) {
...@@ -1115,7 +1116,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1115,7 +1116,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->chain_when_avail = false; mainGame->chain_when_avail = false;
UpdateChainButtons(); UpdateChainButtons();
} }
if(mainGame->wCmdMenu->isVisible() && !mainGame->wCmdMenu->getRelativePosition().isPointInside(pos)) if(mainGame->wCmdMenu->isVisible() && !mainGame->wCmdMenu->getRelativePosition().isPointInside(mousepos))
mainGame->wCmdMenu->setVisible(false); mainGame->wCmdMenu->setVisible(false);
if(panel && panel->isVisible()) if(panel && panel->isVisible())
break; break;
...@@ -1630,9 +1631,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1630,9 +1631,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(!mainGame->dInfo.isStarted) if(!mainGame->dInfo.isStarted)
break; break;
bool should_show_tip = false; bool should_show_tip = false;
s32 x = event.MouseInput.X; position2di pos = mainGame->Resize(event.MouseInput.X, event.MouseInput.Y, true);
s32 y = event.MouseInput.Y; position2di mousepos = position2di(event.MouseInput.X, event.MouseInput.Y);
irr::core::position2di pos(x, y); s32 x = pos.X;
s32 y = pos.Y;
wchar_t formatBuffer[2048]; wchar_t formatBuffer[2048];
if(x < 300) { if(x < 300) {
irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement(); irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement();
...@@ -1667,9 +1669,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1667,9 +1669,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(deck[hovered_controler].size()) if(deck[hovered_controler].size())
mcard = deck[hovered_controler].back(); mcard = deck[hovered_controler].back();
} else { } else {
if(irr::core::recti(327, 8, 630, 51).isPointInside(pos)) if(mainGame->Resize(327, 8, 630, 51).isPointInside(mousepos))
mplayer = 0; mplayer = 0;
else if(irr::core::recti(689, 8, 991, 51).isPointInside(pos)) else if(mainGame->Resize(689, 8, 991, 51).isPointInside(mousepos))
mplayer = 1; mplayer = 1;
} }
} }
...@@ -1682,7 +1684,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1682,7 +1684,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(mainGame->stTip->isVisible()) { if(mainGame->stTip->isVisible()) {
should_show_tip = true; should_show_tip = true;
irr::core::recti tpos = mainGame->stTip->getRelativePosition(); irr::core::recti tpos = mainGame->stTip->getRelativePosition();
mainGame->stTip->setRelativePosition(irr::core::position2di(x - tpos.getWidth() - 10, mcard ? y - tpos.getHeight() - 10 : y + 10)); mainGame->stTip->setRelativePosition(irr::core::position2di(mousepos.X - tpos.getWidth() - 10, mcard ? mousepos.Y - tpos.getHeight() - 10 : y + 10));
} }
} }
if(mcard != hovered_card) { if(mcard != hovered_card) {
...@@ -2204,7 +2206,10 @@ void ClientField::ShowMenu(int flag, int x, int y) { ...@@ -2204,7 +2206,10 @@ void ClientField::ShowMenu(int flag, int x, int y) {
} else mainGame->btnReset->setVisible(false); } else mainGame->btnReset->setVisible(false);
panel = mainGame->wCmdMenu; panel = mainGame->wCmdMenu;
mainGame->wCmdMenu->setVisible(true); mainGame->wCmdMenu->setVisible(true);
mainGame->wCmdMenu->setRelativePosition(irr::core::recti(x - 20 , y - 20 - height, x + 80, y - 20)); position2di mouse = mainGame->Resize(x, y);
x = mouse.X;
y = mouse.Y;
mainGame->wCmdMenu->setRelativePosition(irr::core::recti(x - 20, y - 20 - height, x + 80, y - 20));
} }
void ClientField::UpdateChainButtons() { void ClientField::UpdateChainButtons() {
if(mainGame->btnChainAlways->isVisible()) { if(mainGame->btnChainAlways->isVisible()) {
......
This diff is collapsed.
...@@ -97,7 +97,7 @@ public: ...@@ -97,7 +97,7 @@ public:
void HideElement(irr::gui::IGUIElement* element, bool set_action = false); void HideElement(irr::gui::IGUIElement* element, bool set_action = false);
void PopupElement(irr::gui::IGUIElement* element, int hideframe = 0); void PopupElement(irr::gui::IGUIElement* element, int hideframe = 0);
void WaitFrameSignal(int frame); void WaitFrameSignal(int frame);
void DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, int>* lflist); void DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, int>* lflist, bool drag = false);
void DrawDeckBd(); void DrawDeckBd();
void LoadConfig(); void LoadConfig();
void SaveConfig(); void SaveConfig();
...@@ -114,6 +114,13 @@ public: ...@@ -114,6 +114,13 @@ public:
return focus && focus->hasType(type); return focus && focus->hasType(type);
} }
void OnResize();
recti Resize(s32 x, s32 y, s32 x2, s32 y2);
recti Resize(s32 x, s32 y, s32 x2, s32 y2, s32 dx, s32 dy, s32 dx2, s32 dy2);
position2di Resize(s32 x, s32 y, bool reverse = false);
recti ResizeElem(s32 x, s32 y, s32 x2, s32 y2);
recti ResizeWin(s32 x, s32 y, s32 x2, s32 y2, bool chat = false);
Mutex gMutex; Mutex gMutex;
Mutex gBuffer; Mutex gBuffer;
Signal frameSignal; Signal frameSignal;
...@@ -159,6 +166,8 @@ public: ...@@ -159,6 +166,8 @@ public:
bool is_building; bool is_building;
bool is_siding; bool is_siding;
irr::core::dimension2d<irr::u32> window_size;
ClientField dField; ClientField dField;
DeckBuilder deckBuilder; DeckBuilder deckBuilder;
MenuHandler menuHandler; MenuHandler menuHandler;
...@@ -362,6 +371,17 @@ public: ...@@ -362,6 +371,17 @@ public:
irr::gui::IGUIButton* btnSaveDeckAs; irr::gui::IGUIButton* btnSaveDeckAs;
irr::gui::IGUIButton* btnSideOK; irr::gui::IGUIButton* btnSideOK;
irr::gui::IGUIEditBox* ebDeckname; irr::gui::IGUIEditBox* ebDeckname;
irr::gui::IGUIStaticText* stBanlist;
irr::gui::IGUIStaticText* stDeck;
irr::gui::IGUIStaticText* stCategory;
irr::gui::IGUIStaticText* stLimit;
irr::gui::IGUIStaticText* stAttribute;
irr::gui::IGUIStaticText* stRace;
irr::gui::IGUIStaticText* stAttack;
irr::gui::IGUIStaticText* stDefense;
irr::gui::IGUIStaticText* stStar;
irr::gui::IGUIStaticText* stSearch;
irr::gui::IGUIStaticText* stScale;
//filter //filter
irr::gui::IGUIStaticText* wFilter; irr::gui::IGUIStaticText* wFilter;
irr::gui::IGUIScrollBar* scrFilter; irr::gui::IGUIScrollBar* scrFilter;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment