removed extra "." from TextScroller text as reported in forums

following up on wrenczes cleanup,
   changing ints to floats
   fixing calculations such as ( 16.0 / <some float>) to ( 16.0f / <some float>) to remove compiler warnings.
This commit is contained in:
techdragon.nguyen@gmail.com
2010-11-04 09:18:12 +00:00
parent ab49a0c6e1
commit 2d9c2b3341
7 changed files with 29 additions and 29 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -228,7 +228,7 @@ void DeckMenu::updateScroller()
for (vector<Task*>::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);

View File

@@ -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);

View File

@@ -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<SimpleMenuItem*>(mObjects[i]))->GetWidth();
float width = (static_cast<SimpleMenuItem*>(mObjects[i]))->GetWidth();
if (mWidth < width) mWidth = width;
}
if ((!title.empty()) && (mWidth < titleFont->GetStringWidth(title.c_str()))) mWidth = titleFont->GetStringWidth(title.c_str());

View File

@@ -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);