Skip to content

Commit

Permalink
Merge branch 'mac_crash_fix' of https://github.com/zhykzhykzhyk/ygopro
Browse files Browse the repository at this point in the history
…into mac-test
  • Loading branch information
mercury233 committed Aug 2, 2017
2 parents 3053903 + 07cb023 commit 1f42671
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
7 changes: 3 additions & 4 deletions gframe/CGUITTFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void SGUITTGlyph::preload(u32 char_index, FT_Face face, video::IVideoDriver* dri
}

glyph_page = parent->getLastGlyphPageIndex();
u32 texture_side_length = page->texture->getOriginalSize().Width;
u32 texture_side_length = page->texture_size.Width;
core::vector2di page_position(
(page->used_slots % (texture_side_length / font_size)) * font_size,
(page->used_slots / (texture_side_length / font_size)) * font_size
Expand Down Expand Up @@ -443,9 +443,8 @@ CGUITTGlyphPage* CGUITTFont::createGlyphPage(const u8& pixel_mode) {
if (page_texture_size.Width > max_texture_size.Width || page_texture_size.Height > max_texture_size.Height)
page_texture_size = max_texture_size;

if (!page->createPageTexture(pixel_mode, page_texture_size))
// TODO: add error message?
return 0;
page->texture_size = page_texture_size;
page->pixel_mode = pixel_mode;

if (page) {
// Determine the number of glyph slots on the page and add it to the list of pages.
Expand Down
10 changes: 10 additions & 0 deletions gframe/CGUITTFont.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ class CGUITTGlyphPage {
void updateTexture() {
if (!dirty) return;

if (!texture)
{
if (!createPageTexture(pixel_mode, texture_size))
// TODO: add error message?
return;
}

void* ptr = texture->lock();
video::ECOLOR_FORMAT format = texture->getColorFormat();
core::dimension2du size = texture->getOriginalSize();
Expand Down Expand Up @@ -176,6 +183,9 @@ class CGUITTGlyphPage {
core::array<core::vector2di> render_positions;
core::array<core::recti> render_source_rects;

core::dimension2du texture_size;
u8 pixel_mode;

private:
core::array<const SGUITTGlyph*> glyph_to_be_paged;
video::IVideoDriver* driver;
Expand Down
7 changes: 6 additions & 1 deletion gframe/deck_con.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void DeckBuilder::Terminate() {
mainGame->PopupElement(mainGame->wMainMenu);
mainGame->device->setEventReceiver(&mainGame->menuHandler);
mainGame->wACMessage->setVisible(false);
imageManager.ClearTexture();
mainGame->ClearTextures();
mainGame->scrFilter->setVisible(false);
int sel = mainGame->cbDBDecks->getSelected();
if(sel >= 0)
Expand Down Expand Up @@ -224,6 +224,11 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1410));
break;
}

// clear imgCard
mainGame->imgCard->setImage(imageManager.tCover[0]);

// send result to server
char deckbuf[1024];
char* pdeck = deckbuf;
BufferIO::WriteInt32(pdeck, deckManager.current_deck.main.size() + deckManager.current_deck.extra.size());
Expand Down
3 changes: 2 additions & 1 deletion gframe/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ bool Game::Initialize() {
wCardImg->setBackgroundColor(0xc0c0c0c0);
wCardImg->setVisible(false);
imgCard = env->addImage(rect<s32>(10, 9, 187, 263), wCardImg);
imgCard->setImage(imageManager.tCover[0]);
imgCard->setUseAlphaChannel(true);
//phase
wPhase = env->addStaticText(L"", rect<s32>(480, 310, 855, 330));
Expand Down Expand Up @@ -1185,7 +1186,7 @@ void Game::AddDebugMsg(char* msg)
}
void Game::ClearTextures() {
matManager.mCard.setTexture(0, 0);
mainGame->imgCard->setImage(0);
mainGame->imgCard->setImage(imageManager.tCover[0]);
mainGame->btnPSAU->setImage();
mainGame->btnPSDU->setImage();
for(int i=0; i<=4; ++i) {
Expand Down

0 comments on commit 1f42671

Please sign in to comment.