From 2d9c2b33411905c7f4a6efb659d2f657a093b863 Mon Sep 17 00:00:00 2001 From: "techdragon.nguyen@gmail.com" Date: Thu, 4 Nov 2010 09:18:12 +0000 Subject: [PATCH] removed extra "." from TextScroller text as reported in forums following up on wrenczes cleanup, changing ints to floats fixing calculations such as ( 16.0 / ) to ( 16.0f / ) to remove compiler warnings. --- projects/mtg/include/SimpleMenu.h | 8 ++++---- projects/mtg/include/SimpleMenuItem.h | 10 +++++----- projects/mtg/src/DeckEditorMenu.cpp | 2 +- projects/mtg/src/DeckMenu.cpp | 2 +- projects/mtg/src/OptionItem.cpp | 14 +++++++------- projects/mtg/src/SimpleMenu.cpp | 16 ++++++++-------- projects/mtg/src/SimpleMenuItem.cpp | 6 +++--- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/projects/mtg/include/SimpleMenu.h b/projects/mtg/include/SimpleMenu.h index 20d70f200..bb312200b 100644 --- a/projects/mtg/include/SimpleMenu.h +++ b/projects/mtg/include/SimpleMenu.h @@ -11,7 +11,7 @@ class SimpleMenu:public JGuiController{ private: - int mHeight, mWidth, mX, mY; + float mHeight, mWidth, mX, mY; int fontId; std::string title; int displaytitle; @@ -28,12 +28,12 @@ class SimpleMenu:public JGuiController{ static PIXEL_TYPE jewelGraphics[9]; inline void MogrifyJewel(); - void drawHorzPole(int x, int y, int width); - void drawVertPole(int x, int y, int height); + void drawHorzPole(float x, float y, float width); + void drawVertPole(float x, float y, float height); public: bool autoTranslate; - SimpleMenu(int id, JGuiListener* listener, int fontId, int x, int y, const char * _title = "", int _maxItems = 7); + SimpleMenu(int id, JGuiListener* listener, int fontId, float x, float y, const char * _title = "", int _maxItems = 7); void Render(); void Update(float dt); void Add(int id, const char * Text,string desc = "", bool forceFocus = false); diff --git a/projects/mtg/include/SimpleMenuItem.h b/projects/mtg/include/SimpleMenuItem.h index 6a5ff2cc2..cced5fa58 100644 --- a/projects/mtg/include/SimpleMenuItem.h +++ b/projects/mtg/include/SimpleMenuItem.h @@ -24,13 +24,13 @@ class SimpleMenuItem: public JGuiObject public: string desc; - SimpleMenuItem(SimpleMenu* _parent, int id, int fontId, string text, int x, int y, bool hasFocus = false, bool autoTranslate = false); + SimpleMenuItem(SimpleMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus = false, bool autoTranslate = false); - int mX; - int mY; + float mX; + float mY; - void Relocate(int x, int y); - int GetWidth(); + void Relocate(float x, float y); + float GetWidth(); bool hasFocus(); void RenderWithOffset(float yOffset); diff --git a/projects/mtg/src/DeckEditorMenu.cpp b/projects/mtg/src/DeckEditorMenu.cpp index c7eee7bfd..a0758880b 100644 --- a/projects/mtg/src/DeckEditorMenu.cpp +++ b/projects/mtg/src/DeckEditorMenu.cpp @@ -27,7 +27,7 @@ DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const avatarX = 222; avatarY = 8; - int scrollerWidth = 80; + float scrollerWidth = 80; SAFE_DELETE(scroller); // need to delete the scroller init in the base class scroller = NEW TextScroller(Fonts::MAIN_FONT, 40 , 230, scrollerWidth, 100, 1, 1); diff --git a/projects/mtg/src/DeckMenu.cpp b/projects/mtg/src/DeckMenu.cpp index b63a80060..bbcfb969d 100644 --- a/projects/mtg/src/DeckMenu.cpp +++ b/projects/mtg/src/DeckMenu.cpp @@ -228,7 +228,7 @@ void DeckMenu::updateScroller() for (vector::iterator it = taskList->tasks.begin(); it!=taskList->tasks.end(); it++) { ostringstream taskDescription; - taskDescription << "[ " << setw(4) << (*it)->getReward() << " / " << (*it)->getExpiration() << " ] " << (*it)->getDesc() << ". " << endl; + taskDescription << "[ " << setw(4) << (*it)->getReward() << " / " << (*it)->getExpiration() << " ] " << (*it)->getDesc() << endl; scroller->Add( taskDescription.str() ); } SAFE_DELETE(taskList); diff --git a/projects/mtg/src/OptionItem.cpp b/projects/mtg/src/OptionItem.cpp index 8cc67a31a..c2de5266b 100644 --- a/projects/mtg/src/OptionItem.cpp +++ b/projects/mtg/src/OptionItem.cpp @@ -167,7 +167,7 @@ void OptionProfile::Render(){ mFont->SetScale(1); int spacing = 2+(int)mFont->GetHeight(); - int pX, pY; + float pX, pY; pX = x; pY = y; char buf[512]; @@ -185,10 +185,10 @@ void OptionProfile::Render(){ mFont->SetColor(getColor(WGuiColor::TEXT_HEADER)); mFont->DrawString(selections[value].c_str(), pX, pY + 2, JGETEXT_LEFT); - mFont->SetScale(.8); + mFont->SetScale(0.8f); mFont->SetColor(getColor(WGuiColor::TEXT_BODY)); mFont->DrawString(preview.c_str(), pX, pY + spacing + 2, JGETEXT_LEFT); - mFont->SetScale(1); + mFont->SetScale(1.0f); } void OptionProfile::Entering(JButton key){ @@ -429,7 +429,7 @@ void OptionTheme::Render(){ mFont->DrawString(buf, x + 2, y + 2); if(bChecked && author.size()){ mFont->SetColor(getColor(WGuiColor::TEXT_BODY)); - mFont->SetScale(.8); + mFont->SetScale(0.8f); float hi = mFont->GetHeight(); sprintf(buf,_("Artist: %s").c_str(),author.c_str()); mFont->DrawString(buf, x + 2, y + getHeight() - hi); @@ -475,13 +475,13 @@ void OptionKey::Render() { { const KeyRep& rep = translateKey(from); if (rep.second) - renderer->RenderQuad(rep.second, x + 4, y + 3, 0, 16.0 / rep.second->mHeight, 16.0 / rep.second->mHeight); + renderer->RenderQuad(rep.second, x + 4, y + 3, 0, 16.0f / rep.second->mHeight, 16.0f / rep.second->mHeight); else mFont->DrawString(rep.first, x + 4, y + 3, JGETEXT_LEFT); const KeyRep& rep2 = translateKey(to); if (rep2.second) { - float ratio = 16.0 / rep2.second->mHeight; + float ratio = 16.0f / rep2.second->mHeight; renderer->RenderQuad(rep2.second, x + width - (ratio * rep2.second->mWidth) - 2, y + 3, 0, ratio, ratio); } else @@ -525,7 +525,7 @@ void OptionKey::Overlay() WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT); mFont->SetColor(ARGB(255, 0, 0, 0)); if (grabbed) { - static const int x = 30, y = 45; + static const float x = 30, y = 45; renderer->FillRoundRect(x, y, SCREEN_WIDTH - 2*x, 50, 2, ARGB(200, 200, 200, 255)); string msg = _("Press a key to associate."); mFont->DrawString(msg, (SCREEN_WIDTH - mFont->GetStringWidth(msg.c_str())) / 2, y + 20); diff --git a/projects/mtg/src/SimpleMenu.cpp b/projects/mtg/src/SimpleMenu.cpp index 5a7247562..6acbdadd3 100644 --- a/projects/mtg/src/SimpleMenu.cpp +++ b/projects/mtg/src/SimpleMenu.cpp @@ -8,10 +8,10 @@ namespace { - const unsigned int kPoleWidth = 7; - const unsigned int kVerticalMargin = 16; - const unsigned int kHorizontalMargin = 30; - const signed int kLineHeight = 20; + const float kPoleWidth = 7; + const float kVerticalMargin = 16; + const float kHorizontalMargin = 30; + const float kLineHeight = 20; } JQuad* SimpleMenu::spadeR = NULL; @@ -31,7 +31,7 @@ PIXEL_TYPE SimpleMenu::jewelGraphics[9] = {0x3FFFFFFF,0x63645AEA,0x610D0D98, 0x610D0D98,0xFF110F67,0xFD030330}; -SimpleMenu::SimpleMenu(int id, JGuiListener* listener, int fontId, int x, int y, const char * _title, int _maxItems): JGuiController(id, listener), fontId(fontId){ +SimpleMenu::SimpleMenu(int id, JGuiListener* listener, int fontId, float x, float y, const char * _title, int _maxItems): JGuiController(id, listener), fontId(fontId){ autoTranslate = true; mHeight = 2 * kVerticalMargin; mWidth = 0; @@ -63,7 +63,7 @@ SimpleMenu::SimpleMenu(int id, JGuiListener* listener, int fontId, int x, int y, stars->FireAt(mX, mY); } -void SimpleMenu::drawHorzPole(int x, int y, int width) +void SimpleMenu::drawHorzPole(float x, float y, float width) { JRenderer* renderer = JRenderer::GetInstance(); @@ -78,7 +78,7 @@ void SimpleMenu::drawHorzPole(int x, int y, int width) renderer->RenderQuad(jewel, x + width - 1, y - 1); } -void SimpleMenu::drawVertPole(int x, int y, int height) +void SimpleMenu::drawVertPole(float x, float y, float height) { JRenderer* renderer = JRenderer::GetInstance(); @@ -99,7 +99,7 @@ void SimpleMenu::Render() { if (0 == mWidth) { float sY = mY + kVerticalMargin; for (int i = startId; i < startId + mCount; ++i) { - int width = (static_cast(mObjects[i]))->GetWidth(); + float width = (static_cast(mObjects[i]))->GetWidth(); if (mWidth < width) mWidth = width; } if ((!title.empty()) && (mWidth < titleFont->GetStringWidth(title.c_str()))) mWidth = titleFont->GetStringWidth(title.c_str()); diff --git a/projects/mtg/src/SimpleMenuItem.cpp b/projects/mtg/src/SimpleMenuItem.cpp index d673b5775..9e30ea08b 100644 --- a/projects/mtg/src/SimpleMenuItem.cpp +++ b/projects/mtg/src/SimpleMenuItem.cpp @@ -4,7 +4,7 @@ #include "Translate.h" #include "WResourceManager.h" -SimpleMenuItem::SimpleMenuItem(SimpleMenu* _parent, int id, int fontId, string text, int x, int y, bool hasFocus, bool autoTranslate): JGuiObject(id), parent(_parent), fontId(fontId), mX(x), mY(y) +SimpleMenuItem::SimpleMenuItem(SimpleMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus, bool autoTranslate): JGuiObject(id), parent(_parent), fontId(fontId), mX(x), mY(y) { if (autoTranslate) mText = _(text); else mText = text; @@ -65,13 +65,13 @@ bool SimpleMenuItem::ButtonPressed() return true; } -void SimpleMenuItem::Relocate(int x, int y) +void SimpleMenuItem::Relocate(float x, float y) { mX = x; mY = y; } -int SimpleMenuItem::GetWidth() +float SimpleMenuItem::GetWidth() { WFont * mFont = resources.GetWFont(fontId); mFont->SetScale(1.0);