Commit 886055ac authored by fallenstardust's avatar fallenstardust

use resize 封装*xScale *yScale

移除baselineProfiles
parent 15b89369
...@@ -909,12 +909,8 @@ void Game::DrawSpec() { ...@@ -909,12 +909,8 @@ void Game::DrawSpec() {
} }
case 100: { case 100: {
if(showcardp < 60) { if(showcardp < 60) {
driver->draw2DImage(imageManager.tHand[(showcardcode >> 16) & 0x3], driver->draw2DImage(imageManager.tHand[(showcardcode >> 16) & 0x3], recti(615 * mainGame->xScale, showcarddif * mainGame->yScale, (615 + 89) * mainGame->xScale, (128 + showcarddif) * mainGame->yScale), recti(0, 0, 89, 128), 0, 0, true);
recti(615 * mainGame->xScale, showcarddif * mainGame->yScale, (615 + 89) * mainGame->xScale, (128 + showcarddif) * mainGame->yScale), driver->draw2DImage(imageManager.tHand[showcardcode & 0x3], recti(615 * mainGame->xScale, (540 - showcarddif) * mainGame->yScale, (615 + 89) * mainGame->xScale, (128 + 540 - showcarddif) * mainGame->yScale), recti(0, 0, 89, 128), 0, 0, true);
recti(0, 0, 89, 128), 0, 0, true);
driver->draw2DImage(imageManager.tHand[showcardcode & 0x3],
recti(615 * mainGame->xScale, (540 - showcarddif) * mainGame->yScale, (615 + 89) * mainGame->xScale, (128 + 540 - showcarddif) * mainGame->yScale),
recti(0, 0, 89, 128), 0, 0, true);
float dy = -0.333333f * showcardp + 10; float dy = -0.333333f * showcardp + 10;
showcardp++; showcardp++;
if(showcardp < 30) if(showcardp < 30)
...@@ -972,16 +968,19 @@ void Game::DrawSpec() { ...@@ -972,16 +968,19 @@ 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;
DrawShadowText(lpcFont, lstr, recti(550 * mainGame->xScale - pos.Width / 2 - (9 - showcardp) * 40 * mainGame->xScale, 270 * mainGame->yScale, 850 * mainGame->xScale, 350 * mainGame->yScale), recti(0, 1 * mainGame->yScale, 2 * mainGame->xScale, 0), alpha); DrawShadowText(lpcFont, lstr, ResizePhaseHint(660 - (9 - showcardp) * 40, 290, 960, 370, pos.Width), Resize(-1, -1, 0, 0), alpha | 0xffffff, alpha);
} else if(showcardp < showcarddif) { } else if(showcardp < showcarddif) {
DrawShadowText(lpcFont, lstr, recti(550 * mainGame->xScale - pos.Width / 2, 270 * mainGame->yScale, 850 * mainGame->xScale, 350 * mainGame->yScale), recti(0, 1 * mainGame->yScale, 2 * mainGame->xScale, 0), 0xffffffff); DrawShadowText(lpcFont, lstr, ResizePhaseHint(660, 290, 960, 370, pos.Width), Resize(-1, -1, 0, 0), 0xffffffff);
if(dInfo.vic_string.size() && (showcardcode == 1 || showcardcode == 2)) { if(dInfo.vic_string.size() && (showcardcode == 1 || showcardcode == 2)) {
driver->draw2DRectangle(0xa0000000, recti(500 * mainGame->xScale, 320 * mainGame->yScale, 840 * mainGame->xScale, 340 * mainGame->yScale)); int w = guiFont->getDimension(dInfo.vic_string).Width;
DrawShadowText(guiFont, dInfo.vic_string, recti(500 * mainGame->xScale, 320 * mainGame->yScale, 840 * mainGame->xScale, 340 * mainGame->yScale), recti(0, 1 * mainGame->yScale, 2 * mainGame->xScale, 0), 0xffffffff, 0xff000000, true, true, 0); if(w < 200)
w = 200;
driver->draw2DRectangle(0xa0000000, ResizeWin(640 - w / 2, 320, 690 + w / 2, 340));
DrawShadowText(guiFont, dInfo.vic_string, ResizeWin(640 - w / 2, 320, 690 + w / 2, 340), Resize(-2, -1, 0, 0), 0xffffffff, 0xff000000, true, true, 0);
} }
} else if(showcardp < showcarddif + 10) { } else if(showcardp < showcarddif + 10) {
int alpha = ((showcarddif + 10 - showcardp) * 25) << 24; int alpha = ((showcarddif + 10 - showcardp) * 25) << 24;
DrawShadowText(lpcFont, lstr, recti(550 * mainGame->xScale - pos.Width / 2 + (showcardp - showcarddif) * 40 * mainGame->xScale, 270 * mainGame->yScale, 850 * mainGame->xScale, 350 * mainGame->yScale), recti(0, 1 * mainGame->yScale, 2 * mainGame->xScale, 0), alpha | 0xffffff, 0xff000000, true, false); DrawShadowText(lpcFont, lstr, ResizePhaseHint(660 + (showcardp - showcarddif) * 40, 290, 960, 370, pos.Width), Resize(-1, -1, 0, 0), alpha | 0xffffff, alpha);
} }
showcardp++; showcardp++;
break; break;
......
...@@ -2186,6 +2186,46 @@ void Game::ResizeChatInputWindow() { ...@@ -2186,6 +2186,46 @@ void Game::ResizeChatInputWindow() {
wChat->setRelativePosition(recti(x, (GAME_HEIGHT - 35) * yScale, (GAME_WIDTH - 4) * xScale, GAME_HEIGHT * yScale)); wChat->setRelativePosition(recti(x, (GAME_HEIGHT - 35) * yScale, (GAME_WIDTH - 4) * xScale, GAME_HEIGHT * yScale));
ebChatInput->setRelativePosition(recti(3 * xScale, 2 * yScale, (GAME_WIDTH - 6) * xScale - wChat->getRelativePosition().UpperLeftCorner.X, 28 * xScale)); ebChatInput->setRelativePosition(recti(3 * xScale, 2 * yScale, (GAME_WIDTH - 6) * xScale - wChat->getRelativePosition().UpperLeftCorner.X, 28 * xScale));
} }
recti Game::Resize(s32 x, s32 y, s32 x2, s32 y2) {
x = x * xScale;
y = y * yScale;
x2 = x2 * xScale;
y2 = y2 * yScale;
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 * xScale + dx;
y = y * yScale + dy;
x2 = x2 * xScale + dx2;
y2 = y2 * yScale + dy2;
return recti(x, y, x2, y2);
}
position2di Game::Resize(s32 x, s32 y) {
x = x * xScale;
y = y * yScale;
return position2di(x, y);
}
position2di Game::ResizeReverse(s32 x, s32 y) {
x = x / xScale;
y = y / yScale;
return position2di(x, y);
}
recti Game::ResizeWin(s32 x, s32 y, s32 x2, s32 y2) {
s32 w = x2 - x;
s32 h = y2 - y;
x = (x + w / 2) * xScale - w / 2;
y = (y + h / 2) * yScale - h / 2;
x2 = w + x;
y2 = h + y;
return recti(x, y, x2, y2);
}
recti Game::ResizePhaseHint(s32 x, s32 y, s32 x2, s32 y2, s32 width) {
x = x * xScale - width / 2;
y = y * yScale;
x2 = x2 * xScale;
y2 = y2 * yScale;
return recti(x, y, x2, y2);
}
void Game::ChangeToIGUIImageWindow(irr::gui::IGUIWindow* window, irr::gui::IGUIImage** pWindowBackground, irr::video::ITexture* image) { void Game::ChangeToIGUIImageWindow(irr::gui::IGUIWindow* window, irr::gui::IGUIImage** pWindowBackground, irr::video::ITexture* image) {
window->setDrawBackground(false); window->setDrawBackground(false);
recti pos = window->getRelativePosition(); recti pos = window->getRelativePosition();
......
...@@ -226,8 +226,14 @@ public: ...@@ -226,8 +226,14 @@ public:
} }
void ResizeChatInputWindow(); void ResizeChatInputWindow();
template<typename T> recti Resize(s32 x, s32 y, s32 x2, s32 y2);
static std::vector<T> TokenizeString(T input, const T& token); recti Resize(s32 x, s32 y, s32 x2, s32 y2, s32 dx, s32 dy, s32 dx2, s32 dy2);
position2di Resize(s32 x, s32 y);
position2di ResizeReverse(s32 x, s32 y);
recti ResizePhaseHint(s32 x, s32 y, s32 x2, s32 y2, s32 width);
recti ResizeWin(s32 x, s32 y, s32 x2, s32 y2);
template<typename T>
static std::vector<T> TokenizeString(T input, const T& token);
template<typename T> template<typename T>
static void DrawShadowText(irr::gui::CGUITTFont* font, const T& text, const core::rect<s32>& position, const core::rect<s32>& padding, static void DrawShadowText(irr::gui::CGUITTFont* font, const T& text, const core::rect<s32>& position, const core::rect<s32>& padding,
video::SColor color = 0xffffffff, video::SColor shadowcolor = 0xff000000, bool hcenter = false, bool vcenter = false, const core::rect<s32>* clip = nullptr); video::SColor color = 0xffffffff, video::SColor shadowcolor = 0xff000000, bool hcenter = false, bool vcenter = false, const core::rect<s32>* clip = nullptr);
......
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