Commit 818c847b authored by mercury233's avatar mercury233

Merge branch 'resize' into test

parents 466b7970 b7a06066
......@@ -102,6 +102,7 @@ void DeckBuilder::Terminate() {
mainGame->device->setEventReceiver(&mainGame->menuHandler);
mainGame->wACMessage->setVisible(false);
mainGame->ClearTextures();
mainGame->showingcode = 0;
mainGame->scrFilter->setVisible(false);
int sel = mainGame->cbDBDecks->getSelected();
if(sel >= 0)
......@@ -235,6 +236,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break;
}
mainGame->imgCard->setImage(imageManager.tCover[0]);
mainGame->showingcode = 0;
char deckbuf[1024];
char* pdeck = deckbuf;
BufferIO::WriteInt32(pdeck, deckManager.current_deck.main.size() + deckManager.current_deck.extra.size());
......
......@@ -967,6 +967,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->ShowCardInfo(mcard->code);
} else {
mainGame->imgCard->setImage(imageManager.tCover[0]);
mainGame->showingcode = 0;
mainGame->stName->setText(L"");
mainGame->stInfo->setText(L"");
mainGame->stDataInfo->setText(L"");
......@@ -982,6 +983,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->ShowCardInfo(mcard->code);
} else {
mainGame->imgCard->setImage(imageManager.tCover[0]);
mainGame->showingcode = 0;
mainGame->stName->setText(L"");
mainGame->stInfo->setText(L"");
mainGame->stDataInfo->setText(L"");
......@@ -1548,6 +1550,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} else {
should_show_tip = false;
mainGame->imgCard->setImage(imageManager.tCover[0]);
mainGame->showingcode = 0;
mainGame->stName->setText(L"");
mainGame->stInfo->setText(L"");
mainGame->stDataInfo->setText(L"");
......
......@@ -229,6 +229,8 @@ bool Game::Initialize() {
wCardImg->setVisible(false);
imgCard = env->addImage(rect<s32>(10, 9, 10 + CARD_IMG_WIDTH, 9 + CARD_IMG_HEIGHT), wCardImg);
imgCard->setImage(imageManager.tCover[0]);
showingcode = 0;
imgCard->setScaleImage(true);
imgCard->setUseAlphaChannel(true);
//phase
wPhase = env->addStaticText(L"", rect<s32>(480, 310, 855, 330));
......@@ -1245,7 +1247,9 @@ void Game::SaveConfig() {
fprintf(fp, "music_mode = %d\n", (chkMusicMode->isChecked() ? 1 : 0));
fclose(fp);
}
void Game::ShowCardInfo(int code) {
void Game::ShowCardInfo(int code, bool resize) {
if(showingcode == code && !resize)
return;
CardData cd;
wchar_t formatBuffer[256];
if(!dataManager.GetData(code, &cd))
......@@ -1317,6 +1321,7 @@ void Game::ShowCardInfo(int code) {
stText->setRelativePosition(rect<s32>(15, 60 + offset, 287 * xScale, 324 * yScale));
scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, 60 + offset, 287 * xScale, 324 * yScale));
}
showingcode = code;
showingtext = dataManager.GetText(code);
const auto& tsize = stText->getRelativePosition();
InitStaticText(stText, tsize.getWidth(), tsize.getHeight(), textFont, showingtext);
......@@ -1389,6 +1394,8 @@ void Game::AddDebugMsg(char* msg)
void Game::ClearTextures() {
matManager.mCard.setTexture(0, 0);
imgCard->setImage(imageManager.tCover[0]);
scrCardText->setVisible(false);
imgCard->setScaleImage(true);
btnPSAU->setImage();
btnPSDU->setImage();
for(int i=0; i<=4; ++i) {
......@@ -1563,8 +1570,8 @@ void Game::OnResize() {
stName->setRelativePosition(recti(10, 10, 287 * xScale, 32));
lstLog->setRelativePosition(Resize(10, 10, 290, 290));
//const auto& tsize = stText->getRelativePosition();
//if(showingcard)
// ShowCardInfo(showingcard, true);
if(showingcode)
ShowCardInfo(showingcode, true);
btnClearLog->setRelativePosition(Resize(160, 300, 260, 325));
wPhase->setRelativePosition(Resize(480, 310, 855, 330));
......
......@@ -133,7 +133,7 @@ public:
void DrawDeckBd();
void LoadConfig();
void SaveConfig();
void ShowCardInfo(int code);
void ShowCardInfo(int code, bool resize = false);
void AddChatMsg(wchar_t* msg, int player);
void AddDebugMsg(char* msgbuf);
void ClearTextures();
......@@ -183,6 +183,7 @@ public:
int waitFrame;
int signalFrame;
int actionParam;
int showingcode;
const wchar_t* showingtext;
int showcard;
int showcardcode;
......
......@@ -231,6 +231,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break;
}
mainGame->imgCard->setImage(imageManager.tCover[0]);
mainGame->showingcode = 0;
mainGame->wCardImg->setVisible(true);
mainGame->wInfos->setVisible(true);
mainGame->wReplay->setVisible(true);
......
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