Commit d08a248a authored by mercury233's avatar mercury233

fix GetHoveredCard

fix: if the mouse move directly to the left panel, hovered_pos
won't be updated
parent 35cdec55
...@@ -676,14 +676,14 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -676,14 +676,14 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
return false; return false;
} }
void DeckBuilder::GetHoveredCard() { void DeckBuilder::GetHoveredCard() {
hovered_pos = 0;
hovered_code = 0;
irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement(); irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement();
if(root->getElementFromPoint(mouse_pos) != root) if(root->getElementFromPoint(mouse_pos) != root)
return; return;
int x = mouse_pos.X; int x = mouse_pos.X;
int y = mouse_pos.Y; int y = mouse_pos.Y;
int pre_code = hovered_code; int pre_code = hovered_code;
hovered_pos = 0;
hovered_code = 0;
is_lastcard = 0; is_lastcard = 0;
if(x >= 314 && x <= 794) { if(x >= 314 && x <= 794) {
if(y >= 164 && y <= 435) { if(y >= 164 && y <= 435) {
......
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