Commit 22f30f8e authored by nanahira's avatar nanahira

Merge branch 'resize' of github.com:mercury233/ygopro

parents bfe72aa5 9ad0000c
...@@ -1129,7 +1129,7 @@ void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, i ...@@ -1129,7 +1129,7 @@ void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, i
if(drag) { if(drag) {
dragloc = recti(pos.X, pos.Y, pos.X + CARD_THUMB_WIDTH * mainGame->xScale, pos.Y + CARD_THUMB_HEIGHT * mainGame->yScale); dragloc = recti(pos.X, pos.Y, pos.X + CARD_THUMB_WIDTH * mainGame->xScale, pos.Y + CARD_THUMB_HEIGHT * mainGame->yScale);
limitloc = recti(pos.X, pos.Y, pos.X + 20 * mainGame->xScale, pos.Y + 20 * mainGame->yScale); limitloc = recti(pos.X, pos.Y, pos.X + 20 * mainGame->xScale, pos.Y + 20 * mainGame->yScale);
otloc = recti(pos.X + 7, pos.Y + 50, pos.X + 37 * mainGame->xScale, pos.Y + 65 * mainGame->yScale); otloc = recti(pos.X + 7, pos.Y + 50 * mainGame->yScale, pos.X + 37 * mainGame->xScale, pos.Y + 65 * mainGame->yScale);
} }
driver->draw2DImage(img, dragloc, rect<s32>(0, 0, size.Width, size.Height)); driver->draw2DImage(img, dragloc, rect<s32>(0, 0, size.Width, size.Height));
if(lflist->count(lcode)) { if(lflist->count(lcode)) {
......
...@@ -1923,7 +1923,8 @@ void Game::OnResize() { ...@@ -1923,7 +1923,8 @@ void Game::OnResize() {
wANAttribute->setRelativePosition(ResizeWin(500, 200, 830, 285)); wANAttribute->setRelativePosition(ResizeWin(500, 200, 830, 285));
wANRace->setRelativePosition(ResizeWin(480, 200, 850, 410)); wANRace->setRelativePosition(ResizeWin(480, 200, 850, 410));
wReplaySave->setRelativePosition(ResizeWin(510, 200, 820, 320)); wReplaySave->setRelativePosition(ResizeWin(510, 200, 820, 320));
stHintMsg->setRelativePosition(ResizeWin(500, 60, 820, 90));
stHintMsg->setRelativePosition(ResizeWin(660 - 160 * xScale, 60, 660 + 160 * xScale, 90));
//sound / music volume bar //sound / music volume bar
scrSoundVolume->setRelativePosition(recti(scrSoundVolume->getRelativePosition().UpperLeftCorner.X, scrSoundVolume->getRelativePosition().UpperLeftCorner.Y, 20 + (300 * xScale) - 70, scrSoundVolume->getRelativePosition().LowerRightCorner.Y)); scrSoundVolume->setRelativePosition(recti(scrSoundVolume->getRelativePosition().UpperLeftCorner.X, scrSoundVolume->getRelativePosition().UpperLeftCorner.Y, 20 + (300 * xScale) - 70, scrSoundVolume->getRelativePosition().LowerRightCorner.Y));
...@@ -1970,8 +1971,8 @@ void Game::OnResize() { ...@@ -1970,8 +1971,8 @@ void Game::OnResize() {
btnReset->setRelativePosition(recti(1, 1, width, height)); btnReset->setRelativePosition(recti(1, 1, width, height));
} }
wCardImg->setRelativePosition(ResizeCard(1, 1, 20, 18)); wCardImg->setRelativePosition(ResizeCardImgWin(1, 1, 20, 18));
imgCard->setRelativePosition(ResizeCard(10, 9, 0, 0)); imgCard->setRelativePosition(ResizeCardImgWin(10, 9, 0, 0));
wInfos->setRelativePosition(Resize(1, 275, 301, 639)); wInfos->setRelativePosition(Resize(1, 275, 301, 639));
stName->setRelativePosition(recti(10, 10, 300 * xScale - 13, 10 + 22)); stName->setRelativePosition(recti(10, 10, 300 * xScale - 13, 10 + 22));
lstLog->setRelativePosition(Resize(10, 10, 290, 290)); lstLog->setRelativePosition(Resize(10, 10, 290, 290));
...@@ -1985,7 +1986,7 @@ void Game::OnResize() { ...@@ -1985,7 +1986,7 @@ void Game::OnResize() {
btnM2->setRelativePosition(Resize(160, 0, 210, 20)); btnM2->setRelativePosition(Resize(160, 0, 210, 20));
btnEP->setRelativePosition(Resize(320, 0, 370, 20)); btnEP->setRelativePosition(Resize(320, 0, 370, 20));
wChat->setRelativePosition(ResizeWin(wInfos->getRelativePosition().LowerRightCorner.X + 6, 615, 1020, 640, true)); wChat->setRelativePosition(recti(wInfos->getRelativePosition().LowerRightCorner.X + 6, window_size.Height - 25, window_size.Width, window_size.Height));
ebChatInput->setRelativePosition(recti(3, 2, window_size.Width - wChat->getRelativePosition().UpperLeftCorner.X - 6, 22)); ebChatInput->setRelativePosition(recti(3, 2, window_size.Width - wChat->getRelativePosition().UpperLeftCorner.X - 6, 22));
btnLeaveGame->setRelativePosition(Resize(205, 5, 295, 80)); btnLeaveGame->setRelativePosition(Resize(205, 5, 295, 80));
...@@ -2028,19 +2029,13 @@ position2di Game::ResizeReverse(s32 x, s32 y) { ...@@ -2028,19 +2029,13 @@ position2di Game::ResizeReverse(s32 x, s32 y) {
y = y / yScale; y = y / yScale;
return position2di(x, y); return position2di(x, y);
} }
recti Game::ResizeWin(s32 x, s32 y, s32 x2, s32 y2, bool chat) { recti Game::ResizeWin(s32 x, s32 y, s32 x2, s32 y2) {
s32 sx = x2 - x; s32 w = x2 - x;
s32 sy = y2 - y; s32 h = y2 - y;
if(chat) { x = (x + w / 2) * xScale - w / 2;
y = window_size.Height - sy; y = (y + h / 2) * yScale - h / 2;
x2 = window_size.Width; x2 = w + x;
y2 = y + sy; y2 = h + y;
return recti(x, y, x2, y2);
}
x = (x + sx / 2) * xScale - sx / 2;
y = (y + sy / 2) * yScale - sy / 2;
x2 = sx + x;
y2 = sy + y;
return recti(x, y, x2, y2); return recti(x, y, x2, y2);
} }
recti Game::ResizePhaseHint(s32 x, s32 y, s32 x2, s32 y2, s32 width) { recti Game::ResizePhaseHint(s32 x, s32 y, s32 x2, s32 y2, s32 width) {
...@@ -2050,17 +2045,15 @@ recti Game::ResizePhaseHint(s32 x, s32 y, s32 x2, s32 y2, s32 width) { ...@@ -2050,17 +2045,15 @@ recti Game::ResizePhaseHint(s32 x, s32 y, s32 x2, s32 y2, s32 width) {
y2 = y2 * yScale; y2 = y2 * yScale;
return recti(x, y, x2, y2); return recti(x, y, x2, y2);
} }
recti Game::ResizeCard(s32 x, s32 y, s32 x2, s32 y2) { recti Game::ResizeCardImgWin(s32 x, s32 y, s32 mx, s32 my) {
float mul = xScale; float mul = xScale;
if(xScale > yScale) if(xScale > yScale)
mul = yScale; mul = yScale;
s32 sx = CARD_IMG_WIDTH * mul + x2 * xScale; s32 w = CARD_IMG_WIDTH * mul + mx * xScale;
s32 sy = CARD_IMG_HEIGHT * mul + y2 * yScale; s32 h = CARD_IMG_HEIGHT * mul + my * yScale;
x = x * xScale; x = x * xScale;
y = y * yScale; y = y * yScale;
x2 = sx + x; return recti(x, y, x + w, y + h);
y2 = sy + y;
return recti(x, y, x2, y2);
} }
recti Game::ResizeCardHint(s32 x, s32 y, s32 x2, s32 y2) { recti Game::ResizeCardHint(s32 x, s32 y, s32 x2, s32 y2) {
return ResizeCardMid(x, y, x2, y2, (x + x2) * 0.5, (y + y2) * 0.5); return ResizeCardMid(x, y, x2, y2, (x + x2) * 0.5, (y + y2) * 0.5);
......
...@@ -185,8 +185,8 @@ public: ...@@ -185,8 +185,8 @@ public:
position2di Resize(s32 x, s32 y); position2di Resize(s32 x, s32 y);
position2di ResizeReverse(s32 x, s32 y); position2di ResizeReverse(s32 x, s32 y);
recti ResizePhaseHint(s32 x, s32 y, s32 x2, s32 y2, s32 width); recti ResizePhaseHint(s32 x, s32 y, s32 x2, s32 y2, s32 width);
recti ResizeWin(s32 x, s32 y, s32 x2, s32 y2, bool chat = false); recti ResizeWin(s32 x, s32 y, s32 x2, s32 y2);
recti ResizeCard(s32 x, s32 y, s32 x2, s32 y2); recti ResizeCardImgWin(s32 x, s32 y, s32 mx, s32 my);
recti ResizeCardHint(s32 x, s32 y, s32 x2, s32 y2); recti ResizeCardHint(s32 x, s32 y, s32 x2, s32 y2);
position2di ResizeCardHint(s32 x, s32 y); position2di ResizeCardHint(s32 x, s32 y);
recti ResizeCardMid(s32 x, s32 y, s32 x2, s32 y2, s32 midx, s32 midy); recti ResizeCardMid(s32 x, s32 y, s32 x2, s32 y2, s32 midx, s32 midy);
......
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