Commit 818c847b authored by mercury233's avatar mercury233

Merge branch 'resize' into test

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