Commit 1be54d6f authored by fallenstardust's avatar fallenstardust

change side chat drawing

parent d6da1e2f
......@@ -527,29 +527,28 @@ void CGUITTFont::draw(const core::stringw& text, const core::rect<s32>& position
core::ustring::const_iterator iter(utext);
while (!iter.atEnd()) {
uchar32_t currentChar = *iter;
n = getGlyphIndexByChar(currentChar);
bool visible = (Invisible.findFirst(currentChar) == -1);
if (n > 0 && visible) {
bool lineBreak = false;
if (currentChar == L'\r') { // Mac or Windows breaks
lineBreak = true;
if (*(iter + 1) == (uchar32_t)'\n') // Windows line breaks.
if (*(iter + 1) == L'\n') // Windows line breaks.
currentChar = *(++iter);
} else if (currentChar == (uchar32_t)'\n') { // Unix breaks
} else if (currentChar == L'\n') { // Unix breaks
lineBreak = true;
}
if (lineBreak) {
previousChar = 0;
offset.Y += supposed_line_height; //font_metrics.ascender / 64;
offset.X = position.UpperLeftCorner.X;
if (hcenter)
offset.X += (position.getWidth() - textDimension.Width) >> 1;
++iter;
continue;
}
n = getGlyphIndexByChar(currentChar);
bool visible = (Invisible.findFirst(currentChar) == -1);
if (n > 0 && visible) {
// Calculate the glyph offset.
s32 offx = Glyphs[n - 1].offset.X;
s32 offy = (font_metrics.ascender / 64) - Glyphs[n - 1].offset.Y;
......
......@@ -114,6 +114,7 @@ void DeckBuilder::Terminate() {
mainGame->btnShuffleDeck->setVisible(false);
mainGame->btnSortDeck->setVisible(false);
mainGame->btnClearDeck->setVisible(false);
mainGame->ResizeChatInputWindow();
mainGame->imgChat->setVisible(true);
mainGame->imgQuickAnimation->setVisible(true);
mainGame->wSettings->setVisible(false);
......
This diff is collapsed.
......@@ -215,6 +215,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame->dInfo.isInDuel = false;
mainGame->dInfo.isFinished = false;
mainGame->is_building = false;
mainGame->ResizeChatInputWindow();
mainGame->device->setEventReceiver(&mainGame->menuHandler);
if(bot_mode)
mainGame->ShowElement(mainGame->wSinglePlay);
......@@ -381,6 +382,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
mainGame->is_building = true;
mainGame->is_siding = true;
mainGame->CloseGameWindow();
mainGame->ResizeChatInputWindow();
mainGame->wChat->setVisible(false);
mainGame->imgChat->setVisible(false);
mainGame->wDeckEdit->setVisible(false);
......@@ -500,6 +502,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
mainGame->HideElement(mainGame->wLanWindow);
mainGame->HideElement(mainGame->wSinglePlay);
mainGame->ShowElement(mainGame->wHostPrepare);
mainGame->ResizeChatInputWindow();
mainGame->deckBuilder.prev_category = mainGame->cbCategorySelect->getSelected();
mainGame->deckBuilder.prev_deck = mainGame->cbDeckSelect->getSelected();
wchar_t cate[256];
......@@ -624,6 +627,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
mainGame->btnM2->setVisible(false);
mainGame->btnEP->setVisible(false);
mainGame->btnShuffle->setVisible(false);
mainGame->ResizeChatInputWindow();
if(!mainGame->chkIgnore1->isChecked())
mainGame->wChat->setVisible(true);
if(mainGame->chkDefaultShowChain->isChecked()) {
......@@ -696,6 +700,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
mainGame->btnStartBot->setEnabled(true);
mainGame->btnBotCancel->setEnabled(true);
mainGame->stTip->setVisible(false);
mainGame->ResizeChatInputWindow();
mainGame->device->setEventReceiver(&mainGame->menuHandler);
if(bot_mode)
mainGame->ShowElement(mainGame->wSinglePlay);
......
......@@ -2011,7 +2011,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
mainGame->imgChat->setImage(imageManager.tShut);
}
mainGame->chkIgnore1->setChecked(mainGame->gameConf.chkIgnore1);
bool show = (!mainGame->dInfo.isStarted || mainGame->is_building) ? false : !mainGame->chkIgnore1->isChecked();
bool show = (mainGame->is_building && !mainGame->is_siding) ? false : !mainGame->chkIgnore1->isChecked();
mainGame->wChat->setVisible(show);
if(!show)
mainGame->ClearChatMsg();
......
......@@ -964,7 +964,7 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
btnShuffleDeck->setVisible(false);
btnSortDeck->setVisible(false);
btnClearDeck->setVisible(false);
btnSideOK = env->addButton(rect<s32>(510 * xScale, 40 * yScale, 820 * xScale, 80 * yScale), 0, BUTTON_SIDE_OK, dataManager.GetSysString(1334));
btnSideOK = env->addButton(rect<s32>(400 * xScale, 40 * yScale, 710 * xScale, 80 * yScale), 0, BUTTON_SIDE_OK, dataManager.GetSysString(1334));
ChangeToIGUIImageButton(btnSideOK, imageManager.tButton_L, imageManager.tButton_L_pressed);
btnSideOK->setVisible(false);
btnSideShuffle = env->addButton(rect<s32>(310 * xScale, 100 * yScale, 370 * xScale, 130 * yScale), 0, BUTTON_SHUFFLE_DECK, dataManager.GetSysString(1307));
......@@ -1582,7 +1582,7 @@ std::wstring Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth,
strBuffer[pbuffer++] = c;
}
strBuffer[pbuffer] = 0;
pControl->setText(strBuffer);
if(pControl) pControl->setText(strBuffer);
ret.assign(strBuffer);
return ret;
}
......@@ -1777,10 +1777,10 @@ void Game::LoadConfig() {
gameConf.gamename[0] = 0;
BufferIO::DecodeUTF8(android::getLastCategory(appMain).c_str(), wstr);;
BufferIO::CopyWStr(wstr, gameConf.lastcategory, 64);
//irr:os::Printer::log("getLastCategory", android::getLastCategory(appMain).c_str());
BufferIO::DecodeUTF8(android::getLastDeck(appMain).c_str(), wstr);
BufferIO::CopyWStr(wstr, gameConf.lastdeck, 64);
//os::Printer::log(android::getFontPath(appMain).c_str());
BufferIO::DecodeUTF8(android::getFontPath(appMain).c_str(), wstr);
BufferIO::CopyWStr(wstr, gameConf.numfont, 256);
BufferIO::CopyWStr(wstr, gameConf.textfont, 256);
......@@ -2128,6 +2128,7 @@ void Game::CloseDuelWindow() {
lstHostList->clear();
DuelClient::hosts.clear();
ClearTextures();
ResizeChatInputWindow();
closeDoneSignal.Set();
}
int Game::LocalPlayer(int player) const {
......@@ -2171,6 +2172,14 @@ int Game::ChatLocalPlayer(int player) {
const wchar_t* Game::LocalName(int local_player) {
return local_player == 0 ? dInfo.hostname : dInfo.clientname;
}
void Game::ResizeChatInputWindow() {
s32 x = 305 * xScale;
if(is_building) x = 802 * xScale;
//305 * xScale, 610 * yScale, 1020 * xScale, 640 * yScale
wChat->setRelativePosition(recti(x, (GAME_HEIGHT - 30) * xScale, GAME_WIDTH * xScale, GAME_HEIGHT * yScale));
//3 * xScale, 2 * yScale, 710 * xScale, 28 * yScale
ebChatInput->setRelativePosition(recti(3 * xScale, 2 * yScale, (GAME_WIDTH - 6) * xScale - wChat->getRelativePosition().UpperLeftCorner.X, 28 * xScale));
}
void Game::ChangeToIGUIImageWindow(irr::gui::IGUIWindow* window, irr::gui::IGUIImage** pWindowBackground, irr::video::ITexture* image) {
window->setDrawBackground(false);
recti pos = window->getRelativePosition();
......
......@@ -210,7 +210,7 @@ public:
editbox->setText(text.c_str());
}
void ResizeChatInputWindow();
template<typename T>
static std::vector<T> TokenizeString(T input, const T& token);
......@@ -262,6 +262,8 @@ public:
bool is_building;
bool is_siding;
irr::core::dimension2d<irr::u32> window_size;
ClientField dField;
DeckBuilder deckBuilder;
MenuHandler menuHandler;
......
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