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) {
......
...@@ -352,20 +352,20 @@ void Game::DrawMisc() { ...@@ -352,20 +352,20 @@ void Game::DrawMisc() {
} }
//lp bar //lp bar
if((dInfo.turn % 2 && dInfo.isFirst) || (!(dInfo.turn % 2) && !dInfo.isFirst)) { if((dInfo.turn % 2 && dInfo.isFirst) || (!(dInfo.turn % 2) && !dInfo.isFirst)) {
driver->draw2DRectangle(0xa0000000, recti(327, 8, 630, 51)); driver->draw2DRectangle(0xa0000000, mainGame->Resize(327, 8, 630, 51));
driver->draw2DRectangleOutline(recti(327, 8, 630, 51), 0xffff8080); driver->draw2DRectangleOutline(mainGame->Resize(327, 8, 630, 51), 0xffff8080);
} else { } else {
driver->draw2DRectangle(0xa0000000, recti(689, 8, 991, 51)); driver->draw2DRectangle(0xa0000000, mainGame->Resize(689, 8, 991, 51));
driver->draw2DRectangleOutline(recti(689, 8, 991, 51), 0xffff8080); driver->draw2DRectangleOutline(mainGame->Resize(689, 8, 991, 51), 0xffff8080);
} }
driver->draw2DImage(imageManager.tLPFrame, recti(330, 10, 629, 30), recti(0, 0, 200, 20), 0, 0, true); driver->draw2DImage(imageManager.tLPFrame, mainGame->Resize(330, 10, 629, 30), recti(0, 0, 200, 20), 0, 0, true);
driver->draw2DImage(imageManager.tLPFrame, recti(691, 10, 990, 30), recti(0, 0, 200, 20), 0, 0, true); driver->draw2DImage(imageManager.tLPFrame, mainGame->Resize(691, 10, 990, 30), recti(0, 0, 200, 20), 0, 0, true);
if(dInfo.lp[0] >= _wtoi(mainGame->ebStartLP->getText())) if(dInfo.lp[0] >= _wtoi(mainGame->ebStartLP->getText()))
driver->draw2DImage(imageManager.tLPBar, recti(335, 12, 625, 28), recti(0, 0, 16, 16), 0, 0, true); driver->draw2DImage(imageManager.tLPBar, mainGame->Resize(335, 12, 625, 28), recti(0, 0, 16, 16), 0, 0, true);
else driver->draw2DImage(imageManager.tLPBar, recti(335, 12, 335 + 290 * dInfo.lp[0] / _wtoi(mainGame->ebStartLP->getText()), 28), recti(0, 0, 16, 16), 0, 0, true); else driver->draw2DImage(imageManager.tLPBar, mainGame->Resize(335, 12, 335 + 290 * dInfo.lp[0] / _wtoi(mainGame->ebStartLP->getText()), 28), recti(0, 0, 16, 16), 0, 0, true);
if(dInfo.lp[1] >= _wtoi(mainGame->ebStartLP->getText())) if(dInfo.lp[1] >= _wtoi(mainGame->ebStartLP->getText()))
driver->draw2DImage(imageManager.tLPBar, recti(696, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true); driver->draw2DImage(imageManager.tLPBar, mainGame->Resize(696, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true);
else driver->draw2DImage(imageManager.tLPBar, recti(986 - 290 * dInfo.lp[1] / _wtoi(mainGame->ebStartLP->getText()), 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true); else driver->draw2DImage(imageManager.tLPBar, mainGame->Resize(986 - 290 * dInfo.lp[1] / _wtoi(mainGame->ebStartLP->getText()), 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true);
if(lpframe) { if(lpframe) {
dInfo.lp[lpplayer] -= lpd; dInfo.lp[lpplayer] -= lpd;
myswprintf(dInfo.strLP[lpplayer], L"%d", dInfo.lp[lpplayer]); myswprintf(dInfo.strLP[lpplayer], L"%d", dInfo.lp[lpplayer]);
...@@ -374,69 +374,73 @@ void Game::DrawMisc() { ...@@ -374,69 +374,73 @@ void Game::DrawMisc() {
} }
if(lpcstring) { if(lpcstring) {
if(lpplayer == 0) { if(lpplayer == 0) {
lpcFont->draw(lpcstring, recti(400, 470, 920, 520), lpccolor | 0x00ffffff, true, false, 0); lpcFont->draw(lpcstring, mainGame->Resize(400, 470, 920, 520), lpccolor | 0x00ffffff, true, false, 0);
lpcFont->draw(lpcstring, recti(400, 472, 922, 520), lpccolor, true, false, 0); lpcFont->draw(lpcstring, mainGame->Resize(400, 472, 922, 520), lpccolor, true, false, 0);
} else { } else {
lpcFont->draw(lpcstring, recti(400, 160, 920, 210), lpccolor | 0x00ffffff, true, false, 0); lpcFont->draw(lpcstring, mainGame->Resize(400, 160, 920, 210), lpccolor | 0x00ffffff, true, false, 0);
lpcFont->draw(lpcstring, recti(400, 162, 922, 210), lpccolor, true, false, 0); lpcFont->draw(lpcstring, mainGame->Resize(400, 162, 922, 210), lpccolor, true, false, 0);
} }
} }
if(!dInfo.isReplay && dInfo.player_type < 7 && dInfo.time_limit) { if(!dInfo.isReplay && dInfo.player_type < 7 && dInfo.time_limit) {
driver->draw2DRectangle(recti(525, 34, 525 + dInfo.time_left[0] * 100 / dInfo.time_limit, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0); driver->draw2DRectangle(mainGame->Resize(525, 34, 525 + dInfo.time_left[0] * 100 / dInfo.time_limit, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0);
driver->draw2DRectangleOutline(recti(525, 34, 625, 44), 0xffffffff); driver->draw2DRectangleOutline(mainGame->Resize(525, 34, 625, 44), 0xffffffff);
driver->draw2DRectangle(recti(795 - dInfo.time_left[1] * 100 / dInfo.time_limit, 34, 795, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0); driver->draw2DRectangle(mainGame->Resize(795 - dInfo.time_left[1] * 100 / dInfo.time_limit, 34, 795, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0);
driver->draw2DRectangleOutline(recti(695, 34, 795, 44), 0xffffffff); driver->draw2DRectangleOutline(mainGame->Resize(695, 34, 795, 44), 0xffffffff);
} }
numFont->draw(dInfo.strLP[0], recti(330, 11, 629, 30), 0xff000000, true, false, 0); numFont->draw(dInfo.strLP[0], mainGame->Resize(330, 11, 629, 30), 0xff000000, true, false, 0);
numFont->draw(dInfo.strLP[0], recti(330, 12, 631, 30), 0xffffff00, true, false, 0); numFont->draw(dInfo.strLP[0], mainGame->Resize(330, 12, 631, 30), 0xffffff00, true, false, 0);
numFont->draw(dInfo.strLP[1], recti(691, 11, 990, 30), 0xff000000, true, false, 0); numFont->draw(dInfo.strLP[1], mainGame->Resize(691, 11, 990, 30), 0xff000000, true, false, 0);
numFont->draw(dInfo.strLP[1], recti(691, 12, 992, 30), 0xffffff00, true, false, 0); numFont->draw(dInfo.strLP[1], mainGame->Resize(691, 12, 992, 30), 0xffffff00, true, false, 0);
recti p1size = mainGame->Resize(335, 31, 629, 50);
recti p2size = mainGame->Resize(986, 31, 986, 50);
if(!dInfo.isTag || !dInfo.tag_player[0]) if(!dInfo.isTag || !dInfo.tag_player[0])
textFont->draw(dInfo.hostname, recti(335, 31, 629, 50), 0xffffffff, false, false, 0); textFont->draw(dInfo.hostname, p1size, 0xffffffff, false, false, 0);
else else
textFont->draw(dInfo.hostname_tag, recti(335, 31, 629, 50), 0xffffffff, false, false, 0); textFont->draw(dInfo.hostname_tag, p1size, 0xffffffff, false, false, 0);
if(!dInfo.isTag || !dInfo.tag_player[1]) { if(!dInfo.isTag || !dInfo.tag_player[1]) {
auto cld = textFont->getDimension(dInfo.clientname); auto cld = textFont->getDimension(dInfo.clientname);
textFont->draw(dInfo.clientname, recti(986 - cld.Width, 31, 986, 50), 0xffffffff, false, false, 0); p2size.UpperLeftCorner.X -= cld.Width;
textFont->draw(dInfo.clientname, p2size, 0xffffffff, false, false, 0);
} else { } else {
auto cld = textFont->getDimension(dInfo.clientname_tag); auto cld = textFont->getDimension(dInfo.clientname_tag);
textFont->draw(dInfo.clientname_tag, recti(986 - cld.Width, 31, 986, 50), 0xffffffff, false, false, 0); p2size.UpperLeftCorner.X -= cld.Width;
textFont->draw(dInfo.clientname_tag, p2size, 0xffffffff, false, false, 0);
} }
driver->draw2DRectangle(recti(632, 10, 688, 30), 0x00000000, 0x00000000, 0xffffffff, 0xffffffff); driver->draw2DRectangle(mainGame->Resize(632, 10, 688, 30), 0x00000000, 0x00000000, 0xffffffff, 0xffffffff);
driver->draw2DRectangle(recti(632, 30, 688, 50), 0xffffffff, 0xffffffff, 0x00000000, 0x00000000); driver->draw2DRectangle(mainGame->Resize(632, 30, 688, 50), 0xffffffff, 0xffffffff, 0x00000000, 0x00000000);
lpcFont->draw(dataManager.GetNumString(dInfo.turn), recti(635, 5, 685, 40), 0x80000000, true, false, 0); lpcFont->draw(dataManager.GetNumString(dInfo.turn), mainGame->Resize(635, 5, 685, 40), 0x80000000, true, false, 0);
lpcFont->draw(dataManager.GetNumString(dInfo.turn), recti(635, 5, 687, 40), 0x8000ffff, true, false, 0); lpcFont->draw(dataManager.GetNumString(dInfo.turn), mainGame->Resize(635, 5, 687, 40), 0x8000ffff, true, false, 0);
ClientCard* pcard; ClientCard* pcard;
for(int i = 0; i < 5; ++i) { for(int i = 0; i < 5; ++i) {
pcard = dField.mzone[0][i]; pcard = dField.mzone[0][i];
if(pcard && pcard->code != 0) { if(pcard && pcard->code != 0) {
int m = 493 + i * 85; int m = 493 + i * 85;
int m2 = 473 + i * 80; int m2 = 473 + i * 80;
adFont->draw(L"/", recti(m - 4, 416, m + 4, 436), 0xff000000, true, false, 0); adFont->draw(L"/", mainGame->Resize(m - 4, 416, m + 4, 436), 0xff000000, true, false, 0);
adFont->draw(L"/", recti(m - 3, 417, m + 5, 437), 0xffffffff, true, false, 0); adFont->draw(L"/", mainGame->Resize(m - 3, 417, m + 5, 437), 0xffffffff, true, false, 0);
int w = adFont->getDimension(pcard->atkstring).Width; int w = adFont->getDimension(pcard->atkstring).Width;
adFont->draw(pcard->atkstring, recti(m - 5 - w, 416, m - 5, 436), 0xff000000, false, false, 0); adFont->draw(pcard->atkstring, mainGame->Resize(m - 5, 416, m - 5, 436, -w, 0, 0, 0), 0xff000000, false, false, 0);
adFont->draw(pcard->atkstring, recti(m - 4 - w, 417, m - 4, 437), adFont->draw(pcard->atkstring, mainGame->Resize(m - 4, 417, m - 4, 437, -w, 0, 0, 0),
pcard->attack > pcard->base_attack ? 0xffffff00 : pcard->attack < pcard->base_attack ? 0xffff2090 : 0xffffffff , false, false, 0); pcard->attack > pcard->base_attack ? 0xffffff00 : pcard->attack < pcard->base_attack ? 0xffff2090 : 0xffffffff , false, false, 0);
w = adFont->getDimension(pcard->defstring).Width; w = adFont->getDimension(pcard->defstring).Width;
adFont->draw(pcard->defstring, recti(m + 4, 416, m + 4 + w, 436), 0xff000000, false, false, 0); adFont->draw(pcard->defstring, mainGame->Resize(m + 4, 416, m + 4 + w, 436), 0xff000000, false, false, 0);
adFont->draw(pcard->defstring, recti(m + 5, 417, m + 5 + w, 437), adFont->draw(pcard->defstring, mainGame->Resize(m + 5, 417, m + 5 + w, 437),
pcard->defense > pcard->base_defense ? 0xffffff00 : pcard->defense < pcard->base_defense ? 0xffff2090 : 0xffffffff , false, false, 0); pcard->defense > pcard->base_defense ? 0xffffff00 : pcard->defense < pcard->base_defense ? 0xffff2090 : 0xffffffff , false, false, 0);
if (pcard->level!=0 && pcard->rank!=0) { if (pcard->level!=0 && pcard->rank!=0) {
adFont->draw(L"/", recti(m2 - 4, 356, m2 + 4, 366), 0xff000000, true, false, 0); adFont->draw(L"/", mainGame->Resize(m2 - 4, 356, m2 + 4, 366), 0xff000000, true, false, 0);
adFont->draw(L"/", recti(m2 - 3, 357, m2 + 5, 367), 0xffffffff, true, false, 0); adFont->draw(L"/", mainGame->Resize(m2 - 3, 357, m2 + 5, 367), 0xffffffff, true, false, 0);
int w2 = adFont->getDimension(pcard->lvstring).Width; int w2 = adFont->getDimension(pcard->lvstring).Width;
adFont->draw(pcard->lvstring, recti(m2 - 5 - w2, 356, m - 5, 366), 0xff000000, false, false, 0); adFont->draw(pcard->lvstring, mainGame->Resize(m2 - 5, 356, m2 - 5, 366, -w2, 0, 0, 0), 0xff000000, false, false, 0);
adFont->draw(pcard->lvstring, recti(m2 - 4 - w2, 357, m - 5, 367), (pcard->type & TYPE_TUNER) ? 0xffffff00 : 0xffffffff, false, false, 0); adFont->draw(pcard->lvstring, mainGame->Resize(m2 - 4, 357, m2 - 4, 367, -w2, 0, 0, 0), (pcard->type & TYPE_TUNER) ? 0xffffff00 : 0xffffffff, false, false, 0);
adFont->draw(pcard->rkstring, recti(m2 + 4, 356, m2 + 4 + w2, 366), 0xff000000, false, false, 0); adFont->draw(pcard->rkstring, mainGame->Resize(m2 + 4, 356, m2 + 4 + w2, 366), 0xff000000, false, false, 0);
adFont->draw(pcard->rkstring, recti(m2 + 5, 357, m2 + 5 + w2, 367), 0xffff80ff, false, false, 0); adFont->draw(pcard->rkstring, mainGame->Resize(m2 + 5, 357, m2 + 5 + w2, 367), 0xffff80ff, false, false, 0);
}else if (pcard->rank != 0) { }else if (pcard->rank != 0) {
adFont->draw(pcard->rkstring, recti(473 + i * 80, 356, 475 + i * 80, 366), 0xff000000, false, false, 0); adFont->draw(pcard->rkstring, mainGame->Resize(473 + i * 80, 356, 475 + i * 80, 366), 0xff000000, false, false, 0);
adFont->draw(pcard->rkstring, recti(474 + i * 80, 357, 476 + i * 80, 367),0xffff80ff, false, false, 0); adFont->draw(pcard->rkstring, mainGame->Resize(474 + i * 80, 357, 476 + i * 80, 367),0xffff80ff, false, false, 0);
}else if (pcard->level != 0) { }else if (pcard->level != 0) {
adFont->draw(pcard->lvstring, recti(473 + i * 80, 356, 475 + i * 80, 366), 0xff000000, false, false, 0); adFont->draw(pcard->lvstring, mainGame->Resize(473 + i * 80, 356, 475 + i * 80, 366), 0xff000000, false, false, 0);
adFont->draw(pcard->lvstring, recti(474 + i * 80, 357, 476 + i * 80, 367),(pcard->type & TYPE_TUNER) ? 0xffffff00 : 0xffffffff, false, false, 0); adFont->draw(pcard->lvstring, mainGame->Resize(474 + i * 80, 357, 476 + i * 80, 367),(pcard->type & TYPE_TUNER) ? 0xffffff00 : 0xffffffff, false, false, 0);
} }
} }
} }
...@@ -445,90 +449,90 @@ void Game::DrawMisc() { ...@@ -445,90 +449,90 @@ void Game::DrawMisc() {
if(pcard && (pcard->position & POS_FACEUP)) { if(pcard && (pcard->position & POS_FACEUP)) {
int m = 803 - i * 68; int m = 803 - i * 68;
int m2 = 779 - i * 71; int m2 = 779 - i * 71;
adFont->draw(L"/", recti(m - 4, 235, m + 4, 255), 0xff000000, true, false, 0); adFont->draw(L"/", mainGame->Resize(m - 4, 235, m + 4, 255), 0xff000000, true, false, 0);
adFont->draw(L"/", recti(m - 3, 236, m + 5, 256), 0xffffffff, true, false, 0); adFont->draw(L"/", mainGame->Resize(m - 3, 236, m + 5, 256), 0xffffffff, true, false, 0);
int w = adFont->getDimension(pcard->atkstring).Width; int w = adFont->getDimension(pcard->atkstring).Width;
adFont->draw(pcard->atkstring, recti(m - 5 - w, 235, m - 5, 255), 0xff000000, false, false, 0); adFont->draw(pcard->atkstring, mainGame->Resize(m - 5, 235, m - 5, 255, -w, 0, 0, 0), 0xff000000, false, false, 0);
adFont->draw(pcard->atkstring, recti(m - 4 - w, 236, m - 4, 256), adFont->draw(pcard->atkstring, mainGame->Resize(m - 4, 236, m - 4, 256, -w, 0, 0, 0),
pcard->attack > pcard->base_attack ? 0xffffff00 : pcard->attack < pcard->base_attack ? 0xffff2090 : 0xffffffff , false, false, 0); pcard->attack > pcard->base_attack ? 0xffffff00 : pcard->attack < pcard->base_attack ? 0xffff2090 : 0xffffffff , false, false, 0);
w = adFont->getDimension(pcard->defstring).Width; w = adFont->getDimension(pcard->defstring).Width;
adFont->draw(pcard->defstring, recti(m + 4, 235, m + 4 + w, 255), 0xff000000, false, false, 0); adFont->draw(pcard->defstring, mainGame->Resize(m + 4, 235, m + 4 + w, 255), 0xff000000, false, false, 0);
adFont->draw(pcard->defstring, recti(m + 5, 236, m + 5 + w, 256), adFont->draw(pcard->defstring, mainGame->Resize(m + 5, 236, m + 5 + w, 256),
pcard->defense > pcard->base_defense ? 0xffffff00 : pcard->defense < pcard->base_defense ? 0xffff2090 : 0xffffffff , false, false, 0); pcard->defense > pcard->base_defense ? 0xffffff00 : pcard->defense < pcard->base_defense ? 0xffff2090 : 0xffffffff , false, false, 0);
if (pcard->level!=0 && pcard->rank!=0) { if (pcard->level!=0 && pcard->rank!=0) {
adFont->draw(L"/", recti(m2 - 4, 272, m2 + 4, 292), 0xff000000, true, false, 0); adFont->draw(L"/", mainGame->Resize(m2 - 4, 272, m2 + 4, 292), 0xff000000, true, false, 0);
adFont->draw(L"/", recti(m2 - 3, 273, m2 + 5, 293), 0xffffffff, true, false, 0); adFont->draw(L"/", mainGame->Resize(m2 - 3, 273, m2 + 5, 293), 0xffffffff, true, false, 0);
int w2 = adFont->getDimension(pcard->lvstring).Width; int w2 = adFont->getDimension(pcard->lvstring).Width;
adFont->draw(pcard->lvstring, recti(m2 - 5 - w2, 272, m - 5, 292), 0xff000000, false, false, 0); adFont->draw(pcard->lvstring, mainGame->Resize(m2 - 5, 272, m2 - 5, 292, -w2, 0, 0, 0), 0xff000000, false, false, 0);
adFont->draw(pcard->lvstring, recti(m2 - 4 - w2, 273, m - 5, 293), (pcard->type & TYPE_TUNER) ? 0xffffff00 : 0xffffffff, false, false, 0); adFont->draw(pcard->lvstring, mainGame->Resize(m2 - 4, 273, m2 - 5, 293, -w2, 0, 0, 0), (pcard->type & TYPE_TUNER) ? 0xffffff00 : 0xffffffff, false, false, 0);
adFont->draw(pcard->rkstring, recti(m2 + 4, 272, m2 + 4 + w2, 292), 0xff000000, false, false, 0); adFont->draw(pcard->rkstring, mainGame->Resize(m2 + 4, 272, m2 + 4 + w2, 292), 0xff000000, false, false, 0);
adFont->draw(pcard->rkstring, recti(m2 + 5, 273, m2 + 5 + w2, 293), 0xffff80ff, false, false, 0); adFont->draw(pcard->rkstring, mainGame->Resize(m2 + 5, 273, m2 + 5 + w2, 293), 0xffff80ff, false, false, 0);
}else if (pcard->rank != 0) { }else if (pcard->rank != 0) {
adFont->draw(pcard->rkstring, recti(779 - i * 71, 272, 800 - i * 71, 292), 0xff000000, false, false, 0); adFont->draw(pcard->rkstring, mainGame->Resize(779 - i * 71, 272, 800 - i * 71, 292), 0xff000000, false, false, 0);
adFont->draw(pcard->rkstring, recti(780 - i * 71, 273, 800 - i * 71, 293),0xffff80ff, false, false, 0); adFont->draw(pcard->rkstring, mainGame->Resize(780 - i * 71, 273, 800 - i * 71, 293),0xffff80ff, false, false, 0);
}else if (pcard->level != 0) { }else if (pcard->level != 0) {
adFont->draw(pcard->lvstring, recti(779 - i * 71, 272, 800 - i * 71, 292), 0xff000000, false, false, 0); adFont->draw(pcard->lvstring, mainGame->Resize(779 - i * 71, 272, 800 - i * 71, 292), 0xff000000, false, false, 0);
adFont->draw(pcard->lvstring, recti(780 - i * 71, 273, 800 - i * 71, 293),(pcard->type & TYPE_TUNER) ? 0xffffff00 : 0xffffffff, false, false, 0); adFont->draw(pcard->lvstring, mainGame->Resize(780 - i * 71, 273, 800 - i * 71, 293),(pcard->type & TYPE_TUNER) ? 0xffffff00 : 0xffffffff, false, false, 0);
} }
} }
} }
pcard = dField.szone[0][6]; pcard = dField.szone[0][6];
if(pcard) { if(pcard) {
adFont->draw(pcard->lscstring, recti(426, 394, 438, 414), 0xff000000, true, false, 0); adFont->draw(pcard->lscstring, mainGame->Resize(426, 394, 438, 414), 0xff000000, true, false, 0);
adFont->draw(pcard->lscstring, recti(427, 395, 439, 415), 0xffffffff, true, false, 0); adFont->draw(pcard->lscstring, mainGame->Resize(427, 395, 439, 415), 0xffffffff, true, false, 0);
} }
pcard = dField.szone[0][7]; pcard = dField.szone[0][7];
if(pcard) { if(pcard) {
adFont->draw(pcard->rscstring, recti(880, 394, 912, 414), 0xff000000, true, false, 0); adFont->draw(pcard->rscstring, mainGame->Resize(880, 394, 912, 414), 0xff000000, true, false, 0);
adFont->draw(pcard->rscstring, recti(881, 395, 913, 415), 0xffffffff, true, false, 0); adFont->draw(pcard->rscstring, mainGame->Resize(881, 395, 913, 415), 0xffffffff, true, false, 0);
} }
pcard = dField.szone[1][6]; pcard = dField.szone[1][6];
if(pcard) { if(pcard) {
adFont->draw(pcard->lscstring, recti(839, 245, 871, 265), 0xff000000, true, false, 0); adFont->draw(pcard->lscstring, mainGame->Resize(839, 245, 871, 265), 0xff000000, true, false, 0);
adFont->draw(pcard->lscstring, recti(840, 246, 872, 266), 0xffffffff, true, false, 0); adFont->draw(pcard->lscstring, mainGame->Resize(840, 246, 872, 266), 0xffffffff, true, false, 0);
} }
pcard = dField.szone[1][7]; pcard = dField.szone[1][7];
if(pcard) { if(pcard) {
adFont->draw(pcard->rscstring, recti(463, 245, 495, 265), 0xff000000, true, false, 0); adFont->draw(pcard->rscstring, mainGame->Resize(463, 245, 495, 265), 0xff000000, true, false, 0);
adFont->draw(pcard->rscstring, recti(464, 246, 496, 266), 0xffffffff, true, false, 0); adFont->draw(pcard->rscstring, mainGame->Resize(464, 246, 496, 266), 0xffffffff, true, false, 0);
} }
if(dField.extra[0].size()) { if(dField.extra[0].size()) {
int offset = (dField.extra[0].size() >= 10) ? 0 : mainGame->textFont->getDimension(dataManager.GetNumString(1)).Width; int offset = (dField.extra[0].size() >= 10) ? 0 : mainGame->textFont->getDimension(dataManager.GetNumString(1)).Width;
numFont->draw(dataManager.GetNumString(dField.extra[0].size()), recti(320 + offset, 562, 371, 552), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra[0].size()), mainGame->Resize(320 + offset, 562, 371, 552), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra[0].size()), recti(320 + offset, 563, 373, 553), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra[0].size()), mainGame->Resize(320 + offset, 563, 373, 553), 0xffffff00, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra_p_count[0], true), recti(340, 562, 391, 552), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra_p_count[0], true), mainGame->Resize(340, 562, 391, 552), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra_p_count[0], true), recti(340, 563, 393, 553), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra_p_count[0], true), mainGame->Resize(340, 563, 393, 553), 0xffffff00, true, false, 0);
} }
if(dField.deck[0].size()) { if(dField.deck[0].size()) {
numFont->draw(dataManager.GetNumString(dField.deck[0].size()), recti(907, 562, 1021, 552), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.deck[0].size()), mainGame->Resize(907, 562, 1021, 552), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.deck[0].size()), recti(908, 563, 1023, 553), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.deck[0].size()), mainGame->Resize(908, 563, 1023, 553), 0xffffff00, true, false, 0);
} }
if(dField.grave[0].size()) { if(dField.grave[0].size()) {
numFont->draw(dataManager.GetNumString(dField.grave[0].size()), recti(837, 375, 984, 456), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.grave[0].size()), mainGame->Resize(837, 375, 984, 456), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.grave[0].size()), recti(837, 376, 986, 457), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.grave[0].size()), mainGame->Resize(837, 376, 986, 457), 0xffffff00, true, false, 0);
} }
if(dField.remove[0].size()) { if(dField.remove[0].size()) {
numFont->draw(dataManager.GetNumString(dField.remove[0].size()), recti(1015, 375, 957, 380), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.remove[0].size()), mainGame->Resize(1015, 375, 957, 380), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.remove[0].size()), recti(1015, 376, 959, 381), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.remove[0].size()), mainGame->Resize(1015, 376, 959, 381), 0xffffff00, true, false, 0);
} }
if(dField.extra[1].size()) { if(dField.extra[1].size()) {
int offset = (dField.extra[1].size() >= 10) ? 0 : mainGame->textFont->getDimension(dataManager.GetNumString(1)).Width; int offset = (dField.extra[1].size() >= 10) ? 0 : mainGame->textFont->getDimension(dataManager.GetNumString(1)).Width;
numFont->draw(dataManager.GetNumString(dField.extra[1].size()), recti(808 + offset, 207, 898, 232), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra[1].size()), mainGame->Resize(808 + offset, 207, 898, 232), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra[1].size()), recti(808 + offset, 208, 900, 233), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra[1].size()), mainGame->Resize(808 + offset, 208, 900, 233), 0xffffff00, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra_p_count[1], true), recti(828, 207, 918, 232), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra_p_count[1], true), mainGame->Resize(828, 207, 918, 232), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra_p_count[1], true), recti(828, 208, 920, 233), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra_p_count[1], true), mainGame->Resize(828, 208, 920, 233), 0xffffff00, true, false, 0);
} }
if(dField.deck[1].size()) { if(dField.deck[1].size()) {
numFont->draw(dataManager.GetNumString(dField.deck[1].size()), recti(465, 207, 481, 232), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.deck[1].size()), mainGame->Resize(465, 207, 481, 232), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.deck[1].size()), recti(465, 208, 483, 233), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.deck[1].size()), mainGame->Resize(465, 208, 483, 233), 0xffffff00, true, false, 0);
} }
if(dField.grave[1].size()) { if(dField.grave[1].size()) {
numFont->draw(dataManager.GetNumString(dField.grave[1].size()), recti(420, 310, 462, 281), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.grave[1].size()), mainGame->Resize(420, 310, 462, 281), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.grave[1].size()), recti(420, 311, 464, 282), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.grave[1].size()), mainGame->Resize(420, 311, 464, 282), 0xffffff00, true, false, 0);
} }
if(dField.remove[1].size()) { if(dField.remove[1].size()) {
numFont->draw(dataManager.GetNumString(dField.remove[1].size()), recti(300, 310, 443, 340), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.remove[1].size()), mainGame->Resize(300, 310, 443, 340), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.remove[1].size()), recti(300, 311, 445, 341), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.remove[1].size()), mainGame->Resize(300, 311, 445, 341), 0xffffff00, true, false, 0);
} }
} }
void Game::DrawGUI() { void Game::DrawGUI() {
...@@ -621,8 +625,8 @@ void Game::DrawSpec() { ...@@ -621,8 +625,8 @@ void Game::DrawSpec() {
if(showcard) { if(showcard) {
switch(showcard) { switch(showcard) {
case 1: { case 1: {
driver->draw2DImage(imageManager.GetTexture(showcardcode), position2di(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode), mainGame->Resize(574, 150));
driver->draw2DImage(imageManager.tMask, recti(574, 150, 574 + (showcarddif > 177 ? 177 : showcarddif), 404), driver->draw2DImage(imageManager.tMask, mainGame->ResizeElem(574, 150, 574 + (showcarddif > 177 ? 177 : showcarddif), 404),
recti(254 - showcarddif, 0, 254 - (showcarddif > 177 ? showcarddif - 177 : 0), 254), 0, 0, true); recti(254 - showcarddif, 0, 254 - (showcarddif > 177 ? showcarddif - 177 : 0), 254), 0, 0, true);
showcarddif += 15; showcarddif += 15;
if(showcarddif >= 254) { if(showcarddif >= 254) {
...@@ -632,8 +636,8 @@ void Game::DrawSpec() { ...@@ -632,8 +636,8 @@ void Game::DrawSpec() {
break; break;
} }
case 2: { case 2: {
driver->draw2DImage(imageManager.GetTexture(showcardcode), position2di(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode), mainGame->Resize(574, 150));
driver->draw2DImage(imageManager.tMask, recti(574 + showcarddif, 150, 761, 404), recti(0, 0, 177 - showcarddif, 254), 0, 0, true); driver->draw2DImage(imageManager.tMask, mainGame->ResizeElem(574 + showcarddif, 150, 761, 404), recti(0, 0, 177 - showcarddif, 254), 0, 0, true);
showcarddif += 15; showcarddif += 15;
if(showcarddif >= 177) { if(showcarddif >= 177) {
showcard = 0; showcard = 0;
...@@ -641,8 +645,8 @@ void Game::DrawSpec() { ...@@ -641,8 +645,8 @@ void Game::DrawSpec() {
break; break;
} }
case 3: { case 3: {
driver->draw2DImage(imageManager.GetTexture(showcardcode), position2di(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode), mainGame->Resize(574, 150));
driver->draw2DImage(imageManager.tNegated, recti(536 + showcarddif, 141 + showcarddif, 793 - showcarddif, 397 - showcarddif), recti(0, 0, 128, 128), 0, 0, true); driver->draw2DImage(imageManager.tNegated, mainGame->ResizeElem(536 + showcarddif, 141 + showcarddif, 793 - showcarddif, 397 - showcarddif), recti(0, 0, 128, 128), 0, 0, true);
if(showcarddif < 64) if(showcarddif < 64)
showcarddif += 4; showcarddif += 4;
break; break;
...@@ -652,7 +656,7 @@ void Game::DrawSpec() { ...@@ -652,7 +656,7 @@ void Game::DrawSpec() {
matManager.c2d[1] = (showcarddif << 24) | 0xffffff; matManager.c2d[1] = (showcarddif << 24) | 0xffffff;
matManager.c2d[2] = (showcarddif << 24) | 0xffffff; matManager.c2d[2] = (showcarddif << 24) | 0xffffff;
matManager.c2d[3] = (showcarddif << 24) | 0xffffff; matManager.c2d[3] = (showcarddif << 24) | 0xffffff;
driver->draw2DImage(imageManager.GetTexture(showcardcode), recti(574, 154, 751, 404), driver->draw2DImage(imageManager.GetTexture(showcardcode), mainGame->ResizeElem(574, 154, 751, 404),
recti(0, 0, 177, 254), 0, matManager.c2d, true); recti(0, 0, 177, 254), 0, matManager.c2d, true);
if(showcarddif < 255) if(showcarddif < 255)
showcarddif += 17; showcarddif += 17;
...@@ -663,7 +667,7 @@ void Game::DrawSpec() { ...@@ -663,7 +667,7 @@ void Game::DrawSpec() {
matManager.c2d[1] = (showcarddif << 25) | 0xffffff; matManager.c2d[1] = (showcarddif << 25) | 0xffffff;
matManager.c2d[2] = (showcarddif << 25) | 0xffffff; matManager.c2d[2] = (showcarddif << 25) | 0xffffff;
matManager.c2d[3] = (showcarddif << 25) | 0xffffff; matManager.c2d[3] = (showcarddif << 25) | 0xffffff;
driver->draw2DImage(imageManager.GetTexture(showcardcode), recti(662 - showcarddif * 0.69685f, 277 - showcarddif, 662 + showcarddif * 0.69685f, 277 + showcarddif), driver->draw2DImage(imageManager.GetTexture(showcardcode), mainGame->ResizeElem(662 - showcarddif * 0.69685f, 277 - showcarddif, 662 + showcarddif * 0.69685f, 277 + showcarddif),
recti(0, 0, 177, 254), 0, matManager.c2d, true); recti(0, 0, 177, 254), 0, matManager.c2d, true);
if(showcarddif < 127) if(showcarddif < 127)
showcarddif += 9; showcarddif += 9;
...@@ -671,7 +675,7 @@ void Game::DrawSpec() { ...@@ -671,7 +675,7 @@ void Game::DrawSpec() {
} }
case 6: { case 6: {
driver->draw2DImage(imageManager.GetTexture(showcardcode), position2di(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode), position2di(574, 150));
driver->draw2DImage(imageManager.tNumber, recti(536 + showcarddif, 141 + showcarddif, 793 - showcarddif, 397 - showcarddif), driver->draw2DImage(imageManager.tNumber, mainGame->ResizeElem(536 + showcarddif, 141 + showcarddif, 793 - showcarddif, 397 - showcarddif),
recti((showcardp % 5) * 64, (showcardp / 5) * 64, (showcardp % 5 + 1) * 64, (showcardp / 5 + 1) * 64), 0, 0, true); recti((showcardp % 5) * 64, (showcardp / 5) * 64, (showcardp % 5 + 1) * 64, (showcardp / 5 + 1) * 64), 0, 0, true);
if(showcarddif < 64) if(showcarddif < 64)
showcarddif += 4; showcarddif += 4;
...@@ -756,21 +760,25 @@ void Game::DrawSpec() { ...@@ -756,21 +760,25 @@ void Game::DrawSpec() {
auto pos = lpcFont->getDimension(lstr); auto pos = lpcFont->getDimension(lstr);
if(showcardp < 10) { if(showcardp < 10) {
int alpha = (showcardp * 25) << 24; int alpha = (showcardp * 25) << 24;
lpcFont->draw(lstr, recti(651 - pos.Width / 2 - (9 - showcardp) * 40, 291, 950, 370), alpha); lpcFont->draw(lstr, mainGame->ResizeElem(651 - pos.Width / 2 - (9 - showcardp) * 40, 291, 950, 370), alpha);
lpcFont->draw(lstr, recti(650 - pos.Width / 2 - (9 - showcardp) * 40, 290, 950, 370), alpha | 0xffffff); lpcFont->draw(lstr, mainGame->ResizeElem(650 - pos.Width / 2 - (9 - showcardp) * 40, 290, 950, 370), alpha | 0xffffff);
} else if(showcardp < showcarddif) { } else if(showcardp < showcarddif) {
recti loc = recti(650 - pos.Width / 2, 290, 950, 370); recti loc = mainGame->ResizeElem(650 - pos.Width / 2, 290, 950, 370);
lpcFont->draw(lstr, recti(651 - pos.Width / 2, 291, 950, 370), 0xff000000); lpcFont->draw(lstr, mainGame->ResizeElem(651 - pos.Width / 2, 291, 950, 370), 0xff000000);
lpcFont->draw(lstr, loc, 0xffffffff); lpcFont->draw(lstr, loc, 0xffffffff);
if(dInfo.vic_string && (showcardcode == 1 || showcardcode == 2)) { if(dInfo.vic_string && (showcardcode == 1 || showcardcode == 2)) {
driver->draw2DRectangle(0xa0000000, recti(540, 320, 800, 340)); s32 vicx = (260 + pos.Width) / 2 - 260;
guiFont->draw(dInfo.vic_string, recti(502, 321, 840, 340), 0xff000000, true, true); recti vicloc = recti(loc.UpperLeftCorner.X + vicx, loc.UpperLeftCorner.Y + 50, loc.UpperLeftCorner.X + vicx + 260, loc.UpperLeftCorner.Y + 70);
guiFont->draw(dInfo.vic_string, recti(500, 320, 840, 340), 0xffffffff, true, true); driver->draw2DRectangle(0xa0000000, vicloc);
guiFont->draw(dInfo.vic_string, vicloc, 0xff000000, true, true);
vicloc.UpperLeftCorner.X -= 2;
vicloc.UpperLeftCorner.Y -= 1;
guiFont->draw(dInfo.vic_string, vicloc, 0xffffffff, true, true);
} }
} else if(showcardp < showcarddif + 10) { } else if(showcardp < showcarddif + 10) {
int alpha = ((showcarddif + 10 - showcardp) * 25) << 24; int alpha = ((showcarddif + 10 - showcardp) * 25) << 24;
lpcFont->draw(lstr, recti(651 - pos.Width / 2 + (showcardp - showcarddif) * 40, 291, 950, 370), alpha); lpcFont->draw(lstr, mainGame->ResizeElem(651 - pos.Width / 2 + (showcardp - showcarddif) * 40, 291, 950, 370), alpha);
lpcFont->draw(lstr, recti(650 - pos.Width / 2 + (showcardp - showcarddif) * 40, 290, 950, 370), alpha | 0xffffff); lpcFont->draw(lstr, mainGame->ResizeElem(650 - pos.Width / 2 + (showcardp - showcarddif) * 40, 290, 950, 370), alpha | 0xffffff);
} }
showcardp++; showcardp++;
break; break;
...@@ -892,44 +900,68 @@ void Game::WaitFrameSignal(int frame) { ...@@ -892,44 +900,68 @@ void Game::WaitFrameSignal(int frame) {
signalFrame = frame; signalFrame = frame;
frameSignal.Wait(); frameSignal.Wait();
} }
void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, int>* lflist) { void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, int>* lflist, bool drag) {
const int width = 44; //standard pic size, maybe it should be defined in game.h const int width = 44; //standard pic size, maybe it should be defined in game.h
const int height = 64; const int height = 64;
int code = cp->first; int code = cp->first;
int lcode = cp->second.alias; int lcode = cp->second.alias;
if(lcode == 0) if(lcode == 0)
lcode = code; lcode = code;
irr::video::ITexture* img = imageManager.GetTextureThumb(code); irr::video::ITexture* img;
if (mainGame->window_size.Width > 1024 || mainGame->window_size.Height > 640)
img = imageManager.GetTexture(code);
else
img = imageManager.GetTextureThumb(code);
if(img == NULL) if(img == NULL)
return; //NULL->getSize() will cause a crash return; //NULL->getSize() will cause a crash
dimension2d<u32> size = img->getOriginalSize(); dimension2d<u32> size = img->getOriginalSize();
driver->draw2DImage(img, rect<s32>(pos.X, pos.Y, pos.X + width, pos.Y + height), rect<s32>(0, 0, size.Width, size.Height));
if(lflist->count(lcode)) { if (drag) {
switch((*lflist)[lcode]) { recti dragloc = recti(pos.X, pos.Y, pos.X + width * mainGame->window_size.Width / 1024, pos.Y + height * mainGame->window_size.Height / 640);
case 0: recti limitloc = recti(pos.X, pos.Y, pos.X + 20 * mainGame->window_size.Width / 1024, pos.Y + 20 * mainGame->window_size.Height / 640);
driver->draw2DImage(imageManager.tLim, recti(pos.X, pos.Y, pos.X + 20, pos.Y + 20), recti(0, 0, 64, 64), 0, 0, true); driver->draw2DImage(img, dragloc, rect<s32>(0, 0, size.Width, size.Height));
break; if (lflist->count(lcode)) {
case 1: switch ((*lflist)[lcode]) {
driver->draw2DImage(imageManager.tLim, recti(pos.X, pos.Y, pos.X + 20, pos.Y + 20), recti(64, 0, 128, 64), 0, 0, true); case 0:
break; driver->draw2DImage(imageManager.tLim, limitloc, rect<s32>(0, 0, 64, 64), 0, 0, true);
case 2: break;
driver->draw2DImage(imageManager.tLim, recti(pos.X, pos.Y, pos.X + 20, pos.Y + 20), recti(0, 64, 64, 128), 0, 0, true); case 1:
break; driver->draw2DImage(imageManager.tLim, limitloc, rect<s32>(64, 0, 128, 64), 0, 0, true);
break;
case 2:
driver->draw2DImage(imageManager.tLim, limitloc, rect<s32>(0, 64, 64, 128), 0, 0, true);
break;
}
}
} else {
driver->draw2DImage(img, mainGame->Resize(pos.X, pos.Y, pos.X + width, pos.Y + height), rect<s32>(0, 0, size.Width, size.Height));
if(lflist->count(lcode)) {
switch((*lflist)[lcode]) {
case 0:
driver->draw2DImage(imageManager.tLim, mainGame->Resize(pos.X, pos.Y, pos.X + 20, pos.Y + 20), recti(0, 0, 64, 64), 0, 0, true);
break;
case 1:
driver->draw2DImage(imageManager.tLim, mainGame->Resize(pos.X, pos.Y, pos.X + 20, pos.Y + 20), recti(64, 0, 128, 64), 0, 0, true);
break;
case 2:
driver->draw2DImage(imageManager.tLim, mainGame->Resize(pos.X, pos.Y, pos.X + 20, pos.Y + 20), recti(0, 64, 64, 128), 0, 0, true);
break;
} }
} }
}
} }
void Game::DrawDeckBd() { void Game::DrawDeckBd() {
wchar_t textBuffer[64]; wchar_t textBuffer[64];
//main deck //main deck
driver->draw2DRectangle(recti(310, 137, 410, 157), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(mainGame->Resize(310, 137, 410, 157), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(309, 136, 410, 157)); driver->draw2DRectangleOutline(mainGame->Resize(309, 136, 410, 157));
textFont->draw(dataManager.GetSysString(1330), recti(314, 136, 409, 156), 0xff000000, false, true); textFont->draw(dataManager.GetSysString(1330), mainGame->Resize(314, 136, 409, 156), 0xff000000, false, true);
textFont->draw(dataManager.GetSysString(1330), recti(315, 137, 410, 157), 0xffffffff, false, true); textFont->draw(dataManager.GetSysString(1330), mainGame->Resize(315, 137, 410, 157), 0xffffffff, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.main.size()], recti(379, 137, 439, 157), 0xff000000, false, true); numFont->draw(dataManager.numStrings[deckManager.current_deck.main.size()], mainGame->Resize(379, 137, 439, 157), 0xff000000, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.main.size()], recti(380, 138, 440, 158), 0xffffffff, false, true); numFont->draw(dataManager.numStrings[deckManager.current_deck.main.size()], mainGame->Resize(380, 138, 440, 158), 0xffffffff, false, true);
driver->draw2DRectangle(recti(310, 160, 797, 436), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(mainGame->Resize(310, 160, 797, 436), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(309, 159, 797, 436)); driver->draw2DRectangleOutline(mainGame->Resize(309, 159, 797, 436));
int lx; int lx;
float dx; float dx;
if(deckManager.current_deck.main.size() <= 40) { if(deckManager.current_deck.main.size() <= 40) {
...@@ -942,64 +974,64 @@ void Game::DrawDeckBd() { ...@@ -942,64 +974,64 @@ void Game::DrawDeckBd() {
for(size_t i = 0; i < deckManager.current_deck.main.size(); ++i) { for(size_t i = 0; i < deckManager.current_deck.main.size(); ++i) {
DrawThumb(deckManager.current_deck.main[i], position2di(314 + (i % lx) * dx, 164 + (i / lx) * 68), deckBuilder.filterList); DrawThumb(deckManager.current_deck.main[i], position2di(314 + (i % lx) * dx, 164 + (i / lx) * 68), deckBuilder.filterList);
if(deckBuilder.hovered_pos == 1 && deckBuilder.hovered_seq == (int)i) if(deckBuilder.hovered_pos == 1 && deckBuilder.hovered_seq == (int)i)
driver->draw2DRectangleOutline(recti(313 + (i % lx) * dx, 163 + (i / lx) * 68, 359 + (i % lx) * dx, 228 + (i / lx) * 68)); driver->draw2DRectangleOutline(mainGame->Resize(313 + (i % lx) * dx, 163 + (i / lx) * 68, 359 + (i % lx) * dx, 228 + (i / lx) * 68));
} }
//extra deck //extra deck
driver->draw2DRectangle(recti(310, 440, 410, 460), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(mainGame->Resize(310, 440, 410, 460), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(309, 439, 410, 460)); driver->draw2DRectangleOutline(mainGame->Resize(309, 439, 410, 460));
textFont->draw(dataManager.GetSysString(1331), recti(314, 439, 409, 459), 0xff000000, false, true); textFont->draw(dataManager.GetSysString(1331), mainGame->Resize(314, 439, 409, 459), 0xff000000, false, true);
textFont->draw(dataManager.GetSysString(1331), recti(315, 440, 410, 460), 0xffffffff, false, true); textFont->draw(dataManager.GetSysString(1331), mainGame->Resize(315, 440, 410, 460), 0xffffffff, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.extra.size()], recti(379, 440, 439, 460), 0xff000000, false, true); numFont->draw(dataManager.numStrings[deckManager.current_deck.extra.size()], mainGame->Resize(379, 440, 439, 460), 0xff000000, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.extra.size()], recti(380, 441, 440, 461), 0xffffffff, false, true); numFont->draw(dataManager.numStrings[deckManager.current_deck.extra.size()], mainGame->Resize(380, 441, 440, 461), 0xffffffff, false, true);
driver->draw2DRectangle(recti(310, 463, 797, 533), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(mainGame->Resize(310, 463, 797, 533), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(309, 462, 797, 533)); driver->draw2DRectangleOutline(mainGame->Resize(309, 462, 797, 533));
if(deckManager.current_deck.extra.size() <= 10) if(deckManager.current_deck.extra.size() <= 10)
dx = 436.0f / 9; dx = 436.0f / 9;
else dx = 436.0f / (deckManager.current_deck.extra.size() - 1); else dx = 436.0f / (deckManager.current_deck.extra.size() - 1);
for(size_t i = 0; i < deckManager.current_deck.extra.size(); ++i) { for(size_t i = 0; i < deckManager.current_deck.extra.size(); ++i) {
DrawThumb(deckManager.current_deck.extra[i], position2di(314 + i * dx, 466), deckBuilder.filterList); DrawThumb(deckManager.current_deck.extra[i], position2di(314 + i * dx, 466), deckBuilder.filterList);
if(deckBuilder.hovered_pos == 2 && deckBuilder.hovered_seq == (int)i) if(deckBuilder.hovered_pos == 2 && deckBuilder.hovered_seq == (int)i)
driver->draw2DRectangleOutline(recti(313 + i * dx, 465, 359 + i * dx, 531)); driver->draw2DRectangleOutline(mainGame->Resize(313 + i * dx, 465, 359 + i * dx, 531));
} }
//side deck //side deck
driver->draw2DRectangle(recti(310, 537, 410, 557), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(mainGame->Resize(310, 537, 410, 557), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(309, 536, 410, 557)); driver->draw2DRectangleOutline(mainGame->Resize(309, 536, 410, 557));
textFont->draw(dataManager.GetSysString(1332), recti(314, 536, 409, 556), 0xff000000, false, true); textFont->draw(dataManager.GetSysString(1332), mainGame->Resize(314, 536, 409, 556), 0xff000000, false, true);
textFont->draw(dataManager.GetSysString(1332), recti(315, 537, 410, 557), 0xffffffff, false, true); textFont->draw(dataManager.GetSysString(1332), mainGame->Resize(315, 537, 410, 557), 0xffffffff, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.side.size()], recti(379, 537, 439, 557), 0xff000000, false, true); numFont->draw(dataManager.numStrings[deckManager.current_deck.side.size()], mainGame->Resize(379, 537, 439, 557), 0xff000000, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.side.size()], recti(380, 538, 440, 558), 0xffffffff, false, true); numFont->draw(dataManager.numStrings[deckManager.current_deck.side.size()], mainGame->Resize(380, 538, 440, 558), 0xffffffff, false, true);
driver->draw2DRectangle(recti(310, 560, 797, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(mainGame->Resize(310, 560, 797, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(309, 559, 797, 630)); driver->draw2DRectangleOutline(mainGame->Resize(309, 559, 797, 630));
if(deckManager.current_deck.side.size() <= 10) if(deckManager.current_deck.side.size() <= 10)
dx = 436.0f / 9; dx = 436.0f / 9;
else dx = 436.0f / (deckManager.current_deck.side.size() - 1); else dx = 436.0f / (deckManager.current_deck.side.size() - 1);
for(size_t i = 0; i < deckManager.current_deck.side.size(); ++i) { for(size_t i = 0; i < deckManager.current_deck.side.size(); ++i) {
DrawThumb(deckManager.current_deck.side[i], position2di(314 + i * dx, 564), deckBuilder.filterList); DrawThumb(deckManager.current_deck.side[i], position2di(314 + i * dx, 564), deckBuilder.filterList);
if(deckBuilder.hovered_pos == 3 && deckBuilder.hovered_seq == (int)i) if(deckBuilder.hovered_pos == 3 && deckBuilder.hovered_seq == (int)i)
driver->draw2DRectangleOutline(recti(313 + i * dx, 563, 359 + i * dx, 629)); driver->draw2DRectangleOutline(mainGame->Resize(313 + i * dx, 563, 359 + i * dx, 629));
} }
driver->draw2DRectangle(recti(805, 137, 915, 157), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(mainGame->Resize(805, 137, 915, 157), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(804, 136, 915, 157)); driver->draw2DRectangleOutline(mainGame->Resize(804, 136, 915, 157));
textFont->draw(dataManager.GetSysString(1333), recti(809, 136, 914, 156), 0xff000000, false, true); textFont->draw(dataManager.GetSysString(1333), mainGame->Resize(809, 136, 914, 156), 0xff000000, false, true);
textFont->draw(dataManager.GetSysString(1333), recti(810, 137, 915, 157), 0xffffffff, false, true); textFont->draw(dataManager.GetSysString(1333), mainGame->Resize(810, 137, 915, 157), 0xffffffff, false, true);
numFont->draw(deckBuilder.result_string, recti(874, 136, 934, 156), 0xff000000, false, true); numFont->draw(deckBuilder.result_string, mainGame->Resize(874, 136, 934, 156), 0xff000000, false, true);
numFont->draw(deckBuilder.result_string, recti(875, 137, 935, 157), 0xffffffff, false, true); numFont->draw(deckBuilder.result_string, mainGame->Resize(875, 137, 935, 157), 0xffffffff, false, true);
driver->draw2DRectangle(recti(805, 160, 1020, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(mainGame->Resize(805, 160, 1020, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(804, 159, 1020, 630)); driver->draw2DRectangleOutline(mainGame->Resize(804, 159, 1020, 630));
for(size_t i = 0; i < 7 && i + mainGame->scrFilter->getPos() < deckBuilder.results.size(); ++i) { for(size_t i = 0; i < 7 && i + mainGame->scrFilter->getPos() < deckBuilder.results.size(); ++i) {
code_pointer ptr = deckBuilder.results[i + mainGame->scrFilter->getPos()]; code_pointer ptr = deckBuilder.results[i + mainGame->scrFilter->getPos()];
if(deckBuilder.hovered_pos == 4 && deckBuilder.hovered_seq == (int)i) if(deckBuilder.hovered_pos == 4 && deckBuilder.hovered_seq == (int)i)
driver->draw2DRectangle(0x80000000, recti(806, 164 + i * 66, 1019, 230 + i * 66)); driver->draw2DRectangle(0x80000000, mainGame->Resize(806, 164 + i * 66, 1019, 230 + i * 66));
DrawThumb(ptr, position2di(810, 165 + i * 66), deckBuilder.filterList); DrawThumb(ptr, position2di(810, 165 + i * 66), deckBuilder.filterList);
if(ptr->second.type & TYPE_MONSTER) { if(ptr->second.type & TYPE_MONSTER) {
int form = 0x2605; int form = 0x2605;
if(ptr->second.type & TYPE_XYZ) ++form; if(ptr->second.type & TYPE_XYZ) ++form;
myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first)); myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first));
textFont->draw(textBuffer, recti(859, 164 + i * 66, 955, 185 + i * 66), 0xff000000, false, false); textFont->draw(textBuffer, mainGame->Resize(859, 164 + i * 66, 955, 185 + i * 66), 0xff000000, false, false);
textFont->draw(textBuffer, recti(860, 165 + i * 66, 955, 185 + i * 66), 0xffffffff, false, false); textFont->draw(textBuffer, mainGame->Resize(860, 165 + i * 66, 955, 185 + i * 66), 0xffffffff, false, false);
myswprintf(textBuffer, L"%ls/%ls %c%d", dataManager.FormatAttribute(ptr->second.attribute), dataManager.FormatRace(ptr->second.race), form, ptr->second.level); myswprintf(textBuffer, L"%ls/%ls %c%d", dataManager.FormatAttribute(ptr->second.attribute), dataManager.FormatRace(ptr->second.race), form, ptr->second.level);
textFont->draw(textBuffer, recti(859, 186 + i * 66, 955, 207 + i * 66), 0xff000000, false, false); textFont->draw(textBuffer, mainGame->Resize(859, 186 + i * 66, 955, 207 + i * 66), 0xff000000, false, false);
textFont->draw(textBuffer, recti(860, 187 + i * 66, 955, 207 + i * 66), 0xffffffff, false, false); textFont->draw(textBuffer, mainGame->Resize(860, 187 + i * 66, 955, 207 + i * 66), 0xffffffff, false, false);
if(ptr->second.attack < 0 && ptr->second.defense < 0) if(ptr->second.attack < 0 && ptr->second.defense < 0)
myswprintf(textBuffer, L"?/?"); myswprintf(textBuffer, L"?/?");
else if(ptr->second.attack < 0) else if(ptr->second.attack < 0)
...@@ -1018,15 +1050,15 @@ void Game::DrawDeckBd() { ...@@ -1018,15 +1050,15 @@ void Game::DrawDeckBd() {
wcscat(textBuffer, L" [TCG]"); wcscat(textBuffer, L" [TCG]");
else if((ptr->second.ot & 0x7) == 4) else if((ptr->second.ot & 0x7) == 4)
wcscat(textBuffer, L" [Custom]"); wcscat(textBuffer, L" [Custom]");
textFont->draw(textBuffer, recti(859, 208 + i * 66, 955, 229 + i * 66), 0xff000000, false, false); textFont->draw(textBuffer, mainGame->Resize(859, 208 + i * 66, 955, 229 + i * 66), 0xff000000, false, false);
textFont->draw(textBuffer, recti(860, 209 + i * 66, 955, 229 + i * 66), 0xffffffff, false, false); textFont->draw(textBuffer, mainGame->Resize(860, 209 + i * 66, 955, 229 + i * 66), 0xffffffff, false, false);
} else { } else {
myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first)); myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first));
textFont->draw(textBuffer, recti(859, 164 + i * 66, 955, 185 + i * 66), 0xff000000, false, false); textFont->draw(textBuffer, mainGame->Resize(859, 164 + i * 66, 955, 185 + i * 66), 0xff000000, false, false);
textFont->draw(textBuffer, recti(860, 165 + i * 66, 955, 185 + i * 66), 0xffffffff, false, false); textFont->draw(textBuffer, mainGame->Resize(860, 165 + i * 66, 955, 185 + i * 66), 0xffffffff, false, false);
const wchar_t* ptype = dataManager.FormatType(ptr->second.type); const wchar_t* ptype = dataManager.FormatType(ptr->second.type);
textFont->draw(ptype, recti(859, 186 + i * 66, 955, 207 + i * 66), 0xff000000, false, false); textFont->draw(ptype, mainGame->Resize(859, 186 + i * 66, 955, 207 + i * 66), 0xff000000, false, false);
textFont->draw(ptype, recti(860, 187 + i * 66, 955, 207 + i * 66), 0xffffffff, false, false); textFont->draw(ptype, mainGame->Resize(860, 187 + i * 66, 955, 207 + i * 66), 0xffffffff, false, false);
textBuffer[0] = 0; textBuffer[0] = 0;
if((ptr->second.ot & 0x3) == 1) if((ptr->second.ot & 0x3) == 1)
wcscat(textBuffer, L"[OCG]"); wcscat(textBuffer, L"[OCG]");
...@@ -1034,12 +1066,12 @@ void Game::DrawDeckBd() { ...@@ -1034,12 +1066,12 @@ void Game::DrawDeckBd() {
wcscat(textBuffer, L"[TCG]"); wcscat(textBuffer, L"[TCG]");
else if((ptr->second.ot & 0x7) == 4) else if((ptr->second.ot & 0x7) == 4)
wcscat(textBuffer, L"[Custom]"); wcscat(textBuffer, L"[Custom]");
textFont->draw(textBuffer, recti(859, 208 + i * 66, 955, 229 + i * 66), 0xff000000, false, false); textFont->draw(textBuffer, mainGame->Resize(859, 208 + i * 66, 955, 229 + i * 66), 0xff000000, false, false);
textFont->draw(textBuffer, recti(860, 209 + i * 66, 955, 229 + i * 66), 0xffffffff, false, false); textFont->draw(textBuffer, mainGame->Resize(860, 209 + i * 66, 955, 229 + i * 66), 0xffffffff, false, false);
} }
} }
if(deckBuilder.is_draging) { if(deckBuilder.is_draging) {
DrawThumb(deckBuilder.draging_pointer, position2di(deckBuilder.dragx - 22, deckBuilder.dragy - 32), deckBuilder.filterList); DrawThumb(deckBuilder.draging_pointer, position2di(deckBuilder.dragx - 22, deckBuilder.dragy - 32), deckBuilder.filterList, true);
} }
} }
} }
...@@ -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()) {
......
...@@ -68,8 +68,8 @@ bool Game::Initialize() { ...@@ -68,8 +68,8 @@ bool Game::Initialize() {
guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize); guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize);
textFont = guiFont; textFont = guiFont;
smgr = device->getSceneManager(); smgr = device->getSceneManager();
device->setWindowCaption(L"YGOPro"); device->setWindowCaption(L"EDOPro");
device->setResizable(false); device->setResizable(true);
#ifdef _WIN32 #ifdef _WIN32
HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL); HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL);
HICON hSmallIcon = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(1), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); HICON hSmallIcon = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(1), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
...@@ -85,7 +85,7 @@ bool Game::Initialize() { ...@@ -85,7 +85,7 @@ bool Game::Initialize() {
#endif #endif
//main menu //main menu
wchar_t strbuf[256]; wchar_t strbuf[256];
myswprintf(strbuf, L"YGOPro Version:%X.0%X.%X", PRO_VERSION >> 12, (PRO_VERSION >> 4) & 0xff, PRO_VERSION & 0xf); myswprintf(strbuf, L"EDOPro Version:%X.0%X.%X", PRO_VERSION >> 12, (PRO_VERSION >> 4) & 0xff, PRO_VERSION & 0xf);
wMainMenu = env->addWindow(rect<s32>(370, 200, 650, 415), false, strbuf); wMainMenu = env->addWindow(rect<s32>(370, 200, 650, 415), false, strbuf);
wMainMenu->getCloseButton()->setVisible(false); wMainMenu->getCloseButton()->setVisible(false);
btnLanMode = env->addButton(rect<s32>(10, 30, 270, 60), wMainMenu, BUTTON_LAN_MODE, dataManager.GetSysString(1200)); btnLanMode = env->addButton(rect<s32>(10, 30, 270, 60), wMainMenu, BUTTON_LAN_MODE, dataManager.GetSysString(1200));
...@@ -414,10 +414,10 @@ bool Game::Initialize() { ...@@ -414,10 +414,10 @@ bool Game::Initialize() {
//deck edit //deck edit
wDeckEdit = env->addStaticText(L"", rect<s32>(309, 5, 605, 130), true, false, 0, -1, true); wDeckEdit = env->addStaticText(L"", rect<s32>(309, 5, 605, 130), true, false, 0, -1, true);
wDeckEdit->setVisible(false); wDeckEdit->setVisible(false);
env->addStaticText(dataManager.GetSysString(1300), rect<s32>(10, 9, 100, 29), false, false, wDeckEdit); stBanlist = env->addStaticText(dataManager.GetSysString(1300), rect<s32>(10, 9, 100, 29), false, false, wDeckEdit);
cbDBLFList = env->addComboBox(rect<s32>(80, 5, 220, 30), wDeckEdit, COMBOBOX_DBLFLIST); cbDBLFList = env->addComboBox(rect<s32>(80, 5, 220, 30), wDeckEdit, COMBOBOX_DBLFLIST);
cbDBLFList->setMaxSelectionRows(10); cbDBLFList->setMaxSelectionRows(10);
env->addStaticText(dataManager.GetSysString(1301), rect<s32>(10, 39, 100, 59), false, false, wDeckEdit); stDeck = env->addStaticText(dataManager.GetSysString(1301), rect<s32>(10, 39, 100, 59), false, false, wDeckEdit);
cbDBDecks = env->addComboBox(rect<s32>(80, 35, 220, 60), wDeckEdit, COMBOBOX_DBDECKS); cbDBDecks = env->addComboBox(rect<s32>(80, 35, 220, 60), wDeckEdit, COMBOBOX_DBDECKS);
cbDBDecks->setMaxSelectionRows(15); cbDBDecks->setMaxSelectionRows(15);
for(unsigned int i = 0; i < deckManager._lfList.size(); ++i) for(unsigned int i = 0; i < deckManager._lfList.size(); ++i)
...@@ -447,7 +447,7 @@ bool Game::Initialize() { ...@@ -447,7 +447,7 @@ bool Game::Initialize() {
//filters //filters
wFilter = env->addStaticText(L"", rect<s32>(610, 5, 1020, 130), true, false, 0, -1, true); wFilter = env->addStaticText(L"", rect<s32>(610, 5, 1020, 130), true, false, 0, -1, true);
wFilter->setVisible(false); wFilter->setVisible(false);
env->addStaticText(dataManager.GetSysString(1311), rect<s32>(10, 25 / 6 + 2, 70, 22 + 25 / 6), false, false, wFilter); stCategory = env->addStaticText(dataManager.GetSysString(1311), rect<s32>(10, 25 / 6 + 2, 70, 22 + 25 / 6), false, false, wFilter);
cbCardType = env->addComboBox(rect<s32>(60, 25 / 6, 120, 20 + 25 / 6), wFilter, COMBOBOX_MAINTYPE); cbCardType = env->addComboBox(rect<s32>(60, 25 / 6, 120, 20 + 25 / 6), wFilter, COMBOBOX_MAINTYPE);
cbCardType->addItem(dataManager.GetSysString(1310)); cbCardType->addItem(dataManager.GetSysString(1310));
cbCardType->addItem(dataManager.GetSysString(1312)); cbCardType->addItem(dataManager.GetSysString(1312));
...@@ -456,7 +456,7 @@ bool Game::Initialize() { ...@@ -456,7 +456,7 @@ bool Game::Initialize() {
cbCardType2 = env->addComboBox(rect<s32>(125, 25 / 6, 200, 20 + 25 / 6), wFilter, -1); cbCardType2 = env->addComboBox(rect<s32>(125, 25 / 6, 200, 20 + 25 / 6), wFilter, -1);
cbCardType2->setMaxSelectionRows(10); cbCardType2->setMaxSelectionRows(10);
cbCardType2->addItem(dataManager.GetSysString(1310), 0); cbCardType2->addItem(dataManager.GetSysString(1310), 0);
env->addStaticText(dataManager.GetSysString(1315), rect<s32>(205, 2 + 25 / 6, 280, 22 + 25 / 6), false, false, wFilter); stLimit = env->addStaticText(dataManager.GetSysString(1315), rect<s32>(205, 2 + 25 / 6, 280, 22 + 25 / 6), false, false, wFilter);
cbLimit = env->addComboBox(rect<s32>(260, 25 / 6, 390, 20 + 25 / 6), wFilter, -1); cbLimit = env->addComboBox(rect<s32>(260, 25 / 6, 390, 20 + 25 / 6), wFilter, -1);
cbLimit->setMaxSelectionRows(10); cbLimit->setMaxSelectionRows(10);
cbLimit->addItem(dataManager.GetSysString(1310)); cbLimit->addItem(dataManager.GetSysString(1310));
...@@ -467,31 +467,31 @@ bool Game::Initialize() { ...@@ -467,31 +467,31 @@ bool Game::Initialize() {
cbLimit->addItem(dataManager.GetSysString(1241)); cbLimit->addItem(dataManager.GetSysString(1241));
cbLimit->addItem(dataManager.GetSysString(1242)); cbLimit->addItem(dataManager.GetSysString(1242));
cbLimit->addItem(dataManager.GetSysString(1243)); cbLimit->addItem(dataManager.GetSysString(1243));
env->addStaticText(dataManager.GetSysString(1319), rect<s32>(10, 22 + 50 / 6, 70, 42 + 50 / 6), false, false, wFilter); stAttribute = env->addStaticText(dataManager.GetSysString(1319), rect<s32>(10, 22 + 50 / 6, 70, 42 + 50 / 6), false, false, wFilter);
cbAttribute = env->addComboBox(rect<s32>(60, 20 + 50 / 6, 190, 40 + 50 / 6), wFilter, -1); cbAttribute = env->addComboBox(rect<s32>(60, 20 + 50 / 6, 190, 40 + 50 / 6), wFilter, -1);
cbAttribute->setMaxSelectionRows(10); cbAttribute->setMaxSelectionRows(10);
cbAttribute->addItem(dataManager.GetSysString(1310), 0); cbAttribute->addItem(dataManager.GetSysString(1310), 0);
for(int filter = 0x1; filter != 0x80; filter <<= 1) for(int filter = 0x1; filter != 0x80; filter <<= 1)
cbAttribute->addItem(dataManager.FormatAttribute(filter), filter); cbAttribute->addItem(dataManager.FormatAttribute(filter), filter);
env->addStaticText(dataManager.GetSysString(1321), rect<s32>(10, 42 + 75 / 6, 70, 62 + 75 / 6), false, false, wFilter); stRace = env->addStaticText(dataManager.GetSysString(1321), rect<s32>(10, 42 + 75 / 6, 70, 62 + 75 / 6), false, false, wFilter);
cbRace = env->addComboBox(rect<s32>(60, 40 + 75 / 6, 190, 60 + 75 / 6), wFilter, -1); cbRace = env->addComboBox(rect<s32>(60, 40 + 75 / 6, 190, 60 + 75 / 6), wFilter, -1);
cbRace->setMaxSelectionRows(10); cbRace->setMaxSelectionRows(10);
cbRace->addItem(dataManager.GetSysString(1310), 0); cbRace->addItem(dataManager.GetSysString(1310), 0);
for(int filter = 0x1; filter != 0x1000000; filter <<= 1) for(int filter = 0x1; filter != 0x1000000; filter <<= 1)
cbRace->addItem(dataManager.FormatRace(filter), filter); cbRace->addItem(dataManager.FormatRace(filter), filter);
env->addStaticText(dataManager.GetSysString(1322), rect<s32>(205, 22 + 50 / 6, 280, 42 + 50 / 6), false, false, wFilter); stAttack = env->addStaticText(dataManager.GetSysString(1322), rect<s32>(205, 22 + 50 / 6, 280, 42 + 50 / 6), false, false, wFilter);
ebAttack = env->addEditBox(L"", rect<s32>(260, 20 + 50 / 6, 340, 40 + 50 / 6), true, wFilter); ebAttack = env->addEditBox(L"", rect<s32>(260, 20 + 50 / 6, 340, 40 + 50 / 6), true, wFilter);
ebAttack->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebAttack->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1323), rect<s32>(205, 42 + 75 / 6, 280, 62 + 75 / 6), false, false, wFilter); stDefense = env->addStaticText(dataManager.GetSysString(1323), rect<s32>(205, 42 + 75 / 6, 280, 62 + 75 / 6), false, false, wFilter);
ebDefense = env->addEditBox(L"", rect<s32>(260, 40 + 75 / 6, 340, 60 + 75 / 6), true, wFilter); ebDefense = env->addEditBox(L"", rect<s32>(260, 40 + 75 / 6, 340, 60 + 75 / 6), true, wFilter);
ebDefense->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebDefense->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1324), rect<s32>(10, 62 + 100 / 6, 80, 82 + 100 / 6), false, false, wFilter); stStar = env->addStaticText(dataManager.GetSysString(1324), rect<s32>(10, 62 + 100 / 6, 80, 82 + 100 / 6), false, false, wFilter);
ebStar = env->addEditBox(L"", rect<s32>(60, 60 + 100 / 6, 190, 80 + 100 / 6), true, wFilter); ebStar = env->addEditBox(L"", rect<s32>(60, 60 + 100 / 6, 190, 80 + 100 / 6), true, wFilter);
ebStar->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebStar->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1336), rect<s32>(10, 82 + 125 / 6, 80, 102 + 125 / 6), false, false, wFilter); stScale = env->addStaticText(dataManager.GetSysString(1336), rect<s32>(10, 82 + 125 / 6, 80, 102 + 125 / 6), false, false, wFilter);
ebScale = env->addEditBox(L"", rect<s32>(60, 80 + 125 / 6, 190, 100 + 125 / 6), true, wFilter); ebScale = env->addEditBox(L"", rect<s32>(60, 80 + 125 / 6, 190, 100 + 125 / 6), true, wFilter);
ebScale->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebScale->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1325), rect<s32>(205, 62 + 100 / 6, 280, 82 + 100 / 6), false, false, wFilter); stSearch = env->addStaticText(dataManager.GetSysString(1325), rect<s32>(205, 62 + 100 / 6, 280, 82 + 100 / 6), false, false, wFilter);
ebCardName = env->addEditBox(L"", rect<s32>(260, 60 + 100 / 6, 390, 80 + 100 / 6), true, wFilter, EDITBOX_KEYWORD); ebCardName = env->addEditBox(L"", rect<s32>(260, 60 + 100 / 6, 390, 80 + 100 / 6), true, wFilter, EDITBOX_KEYWORD);
ebCardName->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebCardName->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnEffectFilter = env->addButton(rect<s32>(345, 20 + 50 / 6, 390, 60 + 75 / 6), wFilter, BUTTON_EFFECT_FILTER, dataManager.GetSysString(1326)); btnEffectFilter = env->addButton(rect<s32>(345, 20 + 50 / 6, 390, 60 + 75 / 6), wFilter, BUTTON_EFFECT_FILTER, dataManager.GetSysString(1326));
...@@ -500,14 +500,14 @@ bool Game::Initialize() { ...@@ -500,14 +500,14 @@ bool Game::Initialize() {
btnStartFilter->setRelativePosition(rect<s32>(260, 80 + 125 / 6, 390, 100 + 125 / 6)); btnStartFilter->setRelativePosition(rect<s32>(260, 80 + 125 / 6, 390, 100 + 125 / 6));
btnClearFilter = env->addButton(rect<s32>(205, 80 + 125 / 6, 255, 100 + 125 / 6), wFilter, BUTTON_CLEAR_FILTER, dataManager.GetSysString(1304)); btnClearFilter = env->addButton(rect<s32>(205, 80 + 125 / 6, 255, 100 + 125 / 6), wFilter, BUTTON_CLEAR_FILTER, dataManager.GetSysString(1304));
} }
wCategories = env->addWindow(rect<s32>(630, 60, 1000, 270), false, dataManager.strBuffer); wCategories = env->addWindow(rect<s32>(450, 60, 1000, 270), false, dataManager.strBuffer);
wCategories->getCloseButton()->setVisible(false); wCategories->getCloseButton()->setVisible(false);
wCategories->setDrawTitlebar(false); wCategories->setDrawTitlebar(false);
wCategories->setDraggable(false); wCategories->setDraggable(false);
wCategories->setVisible(false); wCategories->setVisible(false);
btnCategoryOK = env->addButton(rect<s32>(135, 175, 235, 200), wCategories, BUTTON_CATEGORY_OK, dataManager.GetSysString(1211)); btnCategoryOK = env->addButton(rect<s32>(200, 175, 300, 200), wCategories, BUTTON_CATEGORY_OK, dataManager.GetSysString(1211));
for(int i = 0; i < 32; ++i) for(int i = 0; i < 32; ++i)
chkCategory[i] = env->addCheckBox(false, recti(10 + (i % 4) * 90, 10 + (i / 4) * 20, 100 + (i % 4) * 90, 30 + (i / 4) * 20), wCategories, -1, dataManager.GetSysString(1100 + i)); chkCategory[i] = env->addCheckBox(false, recti(10 + (i % 4) * 130, 10 + (i / 4) * 20, 140 + (i % 4) * 130, 30 + (i / 4) * 20), wCategories, -1, dataManager.GetSysString(1100 + i));
//replay window //replay window
wReplay = env->addWindow(rect<s32>(220, 100, 800, 520), false, dataManager.GetSysString(1202)); wReplay = env->addWindow(rect<s32>(220, 100, 800, 520), false, dataManager.GetSysString(1202));
wReplay->getCloseButton()->setVisible(false); wReplay->getCloseButton()->setVisible(false);
...@@ -606,6 +606,11 @@ void Game::MainLoop() { ...@@ -606,6 +606,11 @@ void Game::MainLoop() {
int fps = 0; int fps = 0;
int cur_time = 0; int cur_time = 0;
while(device->run()) { while(device->run()) {
dimension2du size = driver->getScreenSize();
if (window_size != size) {
window_size = size;
OnResize();
}
if(gameConf.use_d3d) if(gameConf.use_d3d)
linePattern = (linePattern + 1) % 30; linePattern = (linePattern + 1) % 30;
else else
...@@ -614,7 +619,7 @@ void Game::MainLoop() { ...@@ -614,7 +619,7 @@ void Game::MainLoop() {
atkdy = (float)sin(atkframe); atkdy = (float)sin(atkframe);
driver->beginScene(true, true, SColor(0, 0, 0, 0)); driver->beginScene(true, true, SColor(0, 0, 0, 0));
if(imageManager.tBackGround) if(imageManager.tBackGround)
driver->draw2DImage(imageManager.tBackGround, recti(0, 0, 1024, 640), recti(0, 0, imageManager.tBackGround->getOriginalSize().Width, imageManager.tBackGround->getOriginalSize().Height)); driver->draw2DImage(imageManager.tBackGround, Resize(0, 0, 1024, 640), recti(0, 0, imageManager.tBackGround->getOriginalSize().Width, imageManager.tBackGround->getOriginalSize().Height));
gMutex.Lock(); gMutex.Lock();
if(dInfo.isStarted) { if(dInfo.isStarted) {
DrawBackGround(); DrawBackGround();
...@@ -625,11 +630,11 @@ void Game::MainLoop() { ...@@ -625,11 +630,11 @@ void Game::MainLoop() {
driver->clearZBuffer(); driver->clearZBuffer();
} else if(is_building) { } else if(is_building) {
if(imageManager.tBackGround_deck) if(imageManager.tBackGround_deck)
driver->draw2DImage(imageManager.tBackGround_deck, recti(0, 0, 1024, 640), recti(0, 0, imageManager.tBackGround->getOriginalSize().Width, imageManager.tBackGround->getOriginalSize().Height)); driver->draw2DImage(imageManager.tBackGround_deck, Resize(0, 0, 1024, 640), recti(0, 0, imageManager.tBackGround->getOriginalSize().Width, imageManager.tBackGround->getOriginalSize().Height));
DrawDeckBd(); DrawDeckBd();
} else { } else {
if(imageManager.tBackGround_menu) if(imageManager.tBackGround_menu)
driver->draw2DImage(imageManager.tBackGround_menu, recti(0, 0, 1024, 640), recti(0, 0, imageManager.tBackGround->getOriginalSize().Width, imageManager.tBackGround->getOriginalSize().Height)); driver->draw2DImage(imageManager.tBackGround_menu, Resize(0, 0, 1024, 640), recti(0, 0, imageManager.tBackGround->getOriginalSize().Width, imageManager.tBackGround->getOriginalSize().Height));
} }
DrawGUI(); DrawGUI();
DrawSpec(); DrawSpec();
...@@ -661,7 +666,7 @@ void Game::MainLoop() { ...@@ -661,7 +666,7 @@ void Game::MainLoop() {
usleep(20000); usleep(20000);
#endif #endif
if(cur_time >= 1000) { if(cur_time >= 1000) {
myswprintf(cap, L"YGOPro FPS: %d", fps); myswprintf(cap, L"EDOPro FPS: %d", fps);
device->setWindowCaption(cap); device->setWindowCaption(cap);
fps = 0; fps = 0;
cur_time -= 1000; cur_time -= 1000;
...@@ -1057,16 +1062,16 @@ void Game::ShowCardInfo(int code) { ...@@ -1057,16 +1062,16 @@ void Game::ShowCardInfo(int code) {
wcscat(formatBuffer, scaleBuffer); wcscat(formatBuffer, scaleBuffer);
} }
stDataInfo->setText(formatBuffer); stDataInfo->setText(formatBuffer);
stSetName->setRelativePosition(rect<s32>(15, 83, 296, 106)); stSetName->setRelativePosition(rect<s32>(15, 83, 316 * mainGame->window_size.Width / 1024 - 30, 116));
stText->setRelativePosition(rect<s32>(15, 83 + offset, 287, 324)); stText->setRelativePosition(rect<s32>(15, 83 + offset, 296 * mainGame->window_size.Width / 1024 - 30, 324 * mainGame->window_size.Height / 640));
scrCardText->setRelativePosition(rect<s32>(267, 83 + offset, 287, 324)); scrCardText->setRelativePosition(Resize(267, 83 + offset, 287, 324));
} else { } else {
myswprintf(formatBuffer, L"[%ls]", dataManager.FormatType(cd.type)); myswprintf(formatBuffer, L"[%ls]", dataManager.FormatType(cd.type));
stInfo->setText(formatBuffer); stInfo->setText(formatBuffer);
stDataInfo->setText(L""); stDataInfo->setText(L"");
stSetName->setRelativePosition(rect<s32>(15, 60, 296, 83)); stSetName->setRelativePosition(rect<s32>(15, 60, 316 * mainGame->window_size.Height / 640, 83));
stText->setRelativePosition(rect<s32>(15, 60 + offset, 287, 324)); stText->setRelativePosition(rect<s32>(15, 60 + offset, 287 * mainGame->window_size.Width / 1024 - 30, 324 * mainGame->window_size.Height / 640));
scrCardText->setRelativePosition(rect<s32>(267, 60 + offset, 287, 324)); scrCardText->setRelativePosition(Resize(267, 60 + offset, 287, 324));
} }
showingtext = dataManager.GetText(code); showingtext = dataManager.GetText(code);
const auto& tsize = stText->getRelativePosition(); const auto& tsize = stText->getRelativePosition();
...@@ -1170,5 +1175,166 @@ int Game::LocalPlayer(int player) { ...@@ -1170,5 +1175,166 @@ int Game::LocalPlayer(int player) {
const wchar_t* Game::LocalName(int local_player) { const wchar_t* Game::LocalName(int local_player) {
return local_player == 0 ? dInfo.hostname : dInfo.clientname; return local_player == 0 ? dInfo.hostname : dInfo.clientname;
} }
void Game::OnResize()
{
wMainMenu->setRelativePosition(mainGame->ResizeWin(370, 200, 650, 415));
wDeckEdit->setRelativePosition(mainGame->Resize(309, 8, 605, 130));
cbDBLFList->setRelativePosition(mainGame->Resize(80, 5, 220, 30));
cbDBDecks->setRelativePosition(mainGame->Resize(80, 35, 220, 60));
btnClearDeck->setRelativePosition(mainGame->Resize(115, 99, 165, 120));
btnSortDeck->setRelativePosition(mainGame->Resize(60, 99, 110, 120));
btnShuffleDeck->setRelativePosition(mainGame->Resize(5, 99, 55, 120));
btnSaveDeck->setRelativePosition(mainGame->Resize(225, 35, 290, 60));
btnSaveDeckAs->setRelativePosition(mainGame->Resize(225, 65, 290, 90));
ebDeckname->setRelativePosition(mainGame->Resize(80, 65, 220, 90));
wSort->setRelativePosition(mainGame->Resize(930, 132, 1020, 156));
cbSortType->setRelativePosition(mainGame->Resize(10, 2, 85, 22));
wFilter->setRelativePosition(mainGame->Resize(610, 8, 1020, 130));
scrFilter->setRelativePosition(mainGame->Resize(999, 161, 1019, 629));
cbCardType->setRelativePosition(mainGame->Resize(60, 3, 120, 23));
cbCardType2->setRelativePosition(mainGame->Resize(130, 3, 190, 23));
cbRace->setRelativePosition(mainGame->Resize(60, 49, 190, 69));
cbAttribute->setRelativePosition(mainGame->Resize(60, 26, 190, 46));
cbLimit->setRelativePosition(mainGame->Resize(260, 3, 390, 23));
ebStar->setRelativePosition(mainGame->Resize(60, 72, 100, 92));
ebScale->setRelativePosition(mainGame->Resize(150, 72, 190, 92));
ebAttack->setRelativePosition(mainGame->Resize(260, 26, 340, 46));
ebDefense->setRelativePosition(mainGame->Resize(260, 49, 340, 69));
ebCardName->setRelativePosition(mainGame->Resize(260, 72, 390, 92));
btnEffectFilter->setRelativePosition(mainGame->Resize(345, 28, 390, 69));
btnStartFilter->setRelativePosition(mainGame->Resize(260, 96, 390, 118));
btnClearFilter->setRelativePosition(mainGame->Resize(205, 96, 255, 118));
wCategories->setRelativePosition(mainGame->ResizeWin(450, 60, 1000, 270));
stBanlist->setRelativePosition(mainGame->ResizeWin(10, 9, 100, 29));
stDeck->setRelativePosition(mainGame->ResizeWin(10, 39, 100, 59));
stCategory->setRelativePosition(mainGame->ResizeWin(10, 5, 70, 25));
stLimit->setRelativePosition(mainGame->ResizeWin(205, 5, 280, 25));
stAttribute->setRelativePosition(mainGame->ResizeWin(10, 28, 70, 48));
stRace->setRelativePosition(mainGame->ResizeWin(10, 51, 70, 71));
stAttack->setRelativePosition(mainGame->ResizeWin(205, 28, 280, 48));
stDefense->setRelativePosition(mainGame->ResizeWin(205, 51, 280, 71));
stStar->setRelativePosition(mainGame->ResizeWin(10, 74, 80, 94));
stSearch->setRelativePosition(mainGame->ResizeWin(205, 74, 280, 94));
stScale->setRelativePosition(mainGame->ResizeWin(101, 74, 150, 94));
btnSideOK->setRelativePosition(mainGame->Resize(510, 40, 820, 80));
btnDeleteDeck->setRelativePosition(mainGame->Resize(225, 95, 290, 120));
wLanWindow->setRelativePosition(mainGame->ResizeWin(220, 100, 800, 520));
wCreateHost->setRelativePosition(mainGame->ResizeWin(320, 100, 700, 520));
wHostPrepare->setRelativePosition(mainGame->ResizeWin(270, 120, 750, 440));
wHostPrepare2->setRelativePosition(mainGame->ResizeWin(750, 120, 950, 440));
wRules->setRelativePosition(mainGame->ResizeWin(630, 100, 1000, 310));
wReplay->setRelativePosition(mainGame->ResizeWin(320, 100, 800, 510));
wSinglePlay->setRelativePosition(mainGame->ResizeWin(220, 100, 800, 520));
wChat->setRelativePosition(mainGame->ResizeWin(305, 615, 1020, 640, true));
ebChatInput->setRelativePosition(recti(3, 2, mainGame->window_size.Width - wChat->getRelativePosition().UpperLeftCorner.X - 6, 22));
wHand->setRelativePosition(ResizeWin(500, 450, 825, 605));
wFTSelect->setRelativePosition(ResizeWin(550, 240, 780, 340));
wMessage->setRelativePosition(ResizeWin(490, 200, 840, 340));
wACMessage->setRelativePosition(ResizeWin(490, 240, 840, 300));
wQuery->setRelativePosition(ResizeWin(490, 200, 840, 340));
wOptions->setRelativePosition(ResizeWin(490, 200, 840, 340));
wPosSelect->setRelativePosition(ResizeWin(340, 200, 935, 410));
wCardSelect->setRelativePosition(ResizeWin(320, 100, 1000, 400));
wANNumber->setRelativePosition(ResizeWin(550, 200, 780, 295));
wANCard->setRelativePosition(ResizeWin(560, 170, 970, 370));
wANAttribute->setRelativePosition(ResizeWin(500, 200, 830, 285));
wANRace->setRelativePosition(ResizeWin(480, 200, 850, 385));
wReplaySave->setRelativePosition(ResizeWin(510, 200, 820, 320));
stHintMsg->setRelativePosition(ResizeWin(500, 60, 820, 90));
wCardImg->setRelativePosition(mainGame->Resize(1, 1, 199, 273));
imgCard->setRelativePosition(mainGame->Resize(10, 9, 187, 263));
wInfos->setRelativePosition(mainGame->Resize(1, 275, 301, 639));
stName->setRelativePosition(recti(10, 10, 287 * mainGame->window_size.Width / 1024, 32));
stInfo->setRelativePosition(recti(15, 37, 296 * mainGame->window_size.Width / 1024, 60));
stDataInfo->setRelativePosition(recti(15, 60, 296 * mainGame->window_size.Width / 1024, 83));
stText->setRelativePosition(recti(15, 83, 296 * mainGame->window_size.Width / 1024 - 30, 324 * mainGame->window_size.Height / 640));
scrCardText->setRelativePosition(Resize(267, 106, 287, 324));
lstLog->setRelativePosition(mainGame->Resize(10, 10, 290, 290));
btnClearLog->setRelativePosition(mainGame->Resize(160, 300, 260, 325));
btnLeaveGame->setRelativePosition(Resize(205, 5, 295, 80));
wReplayControl->setRelativePosition(Resize(205, 143, 295, 273));
btnReplayStart->setRelativePosition(Resize(5, 5, 85, 25));
btnReplayPause->setRelativePosition(Resize(5, 5, 85, 25));
btnReplayStep->setRelativePosition(Resize(5, 55, 85, 75));
btnReplayUndo->setRelativePosition(Resize(5, 80, 85, 100));
btnReplaySwap->setRelativePosition(Resize(5, 30, 85, 50));
btnReplayExit->setRelativePosition(Resize(5, 105, 85, 125));
wPhase->setRelativePosition(Resize(480, 310, 855, 330));
btnDP->setRelativePosition(Resize(0, 0, 50, 20));
btnSP->setRelativePosition(Resize(65, 0, 115, 20));
btnM1->setRelativePosition(Resize(130, 0, 180, 20));
btnBP->setRelativePosition(Resize(195, 0, 245, 20));
btnM2->setRelativePosition(Resize(260, 0, 310, 20));
btnEP->setRelativePosition(Resize(325, 0, 375, 20));
btnShuffle->setRelativePosition(Resize(0, 0, 50, 20));
btnChainAlways->setRelativePosition(Resize(205, 140, 295, 175));
btnChainIgnore->setRelativePosition(Resize(205, 100, 295, 135));
btnChainWhenAvail->setRelativePosition(Resize(205, 180, 295, 215));
btnCancelOrFinish->setRelativePosition(Resize(205, 230, 295, 265));
}
recti Game::Resize(s32 x, s32 y, s32 x2, s32 y2)
{
x = x * window_size.Width / 1024;
y = y * window_size.Height / 640;
x2 = x2 * window_size.Width / 1024;
y2 = y2 * window_size.Height / 640;
return recti(x, y, x2, y2);
}
recti Game::Resize(s32 x, s32 y, s32 x2, s32 y2, s32 dx, s32 dy, s32 dx2, s32 dy2)
{
x = x * window_size.Width / 1024 + dx;
y = y * window_size.Height / 640 + dy;
x2 = x2 * window_size.Width / 1024 + dx2;
y2 = y2 * window_size.Height / 640 + dy2;
return recti(x, y, x2, y2);
}
position2di Game::Resize(s32 x, s32 y, bool reverse)
{
if (reverse)
{
x = x * 1024 / window_size.Width;
y = y * 640 / window_size.Height;
}
else
{
x = x * window_size.Width / 1024;
y = y * window_size.Height / 640;
}
return position2di(x, y);
}
recti Game::ResizeWin(s32 x, s32 y, s32 x2, s32 y2, bool chat)
{
s32 sx = x2 - x;
s32 sy = y2 - y;
if (chat)
{
y = window_size.Height - sy;
x2 = window_size.Width;
y2 = y + sy;
return recti(x, y, x2, y2);
}
x = (x + sx / 2) * window_size.Width / 1024 - sx / 2;
y = (y + sy / 2) * window_size.Height / 640 - sy / 2;
x2 = sx + x;
y2 = sy + y;
return recti(x, y, x2, y2);
}
recti Game::ResizeElem(s32 x, s32 y, s32 x2, s32 y2)
{
s32 sx = x2 - x;
s32 sy = y2 - y;
x = (x + sx / 2 - 100) * window_size.Width / 1024 - sx / 2 + 100;
y = y * window_size.Height / 640;
x2 = sx + x;
y2 = sy + y;
return recti(x, y, x2, y2);
}
} }
...@@ -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