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:
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
class SimpleMenu:public JGuiController{
|
class SimpleMenu:public JGuiController{
|
||||||
private:
|
private:
|
||||||
int mHeight, mWidth, mX, mY;
|
float mHeight, mWidth, mX, mY;
|
||||||
int fontId;
|
int fontId;
|
||||||
std::string title;
|
std::string title;
|
||||||
int displaytitle;
|
int displaytitle;
|
||||||
@@ -28,12 +28,12 @@ class SimpleMenu:public JGuiController{
|
|||||||
static PIXEL_TYPE jewelGraphics[9];
|
static PIXEL_TYPE jewelGraphics[9];
|
||||||
|
|
||||||
inline void MogrifyJewel();
|
inline void MogrifyJewel();
|
||||||
void drawHorzPole(int x, int y, int width);
|
void drawHorzPole(float x, float y, float width);
|
||||||
void drawVertPole(int x, int y, int height);
|
void drawVertPole(float x, float y, float height);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool autoTranslate;
|
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 Render();
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
void Add(int id, const char * Text,string desc = "", bool forceFocus = false);
|
void Add(int id, const char * Text,string desc = "", bool forceFocus = false);
|
||||||
|
|||||||
@@ -24,13 +24,13 @@ class SimpleMenuItem: public JGuiObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
string desc;
|
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;
|
float mX;
|
||||||
int mY;
|
float mY;
|
||||||
|
|
||||||
void Relocate(int x, int y);
|
void Relocate(float x, float y);
|
||||||
int GetWidth();
|
float GetWidth();
|
||||||
bool hasFocus();
|
bool hasFocus();
|
||||||
|
|
||||||
void RenderWithOffset(float yOffset);
|
void RenderWithOffset(float yOffset);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const
|
|||||||
avatarX = 222;
|
avatarX = 222;
|
||||||
avatarY = 8;
|
avatarY = 8;
|
||||||
|
|
||||||
int scrollerWidth = 80;
|
float scrollerWidth = 80;
|
||||||
SAFE_DELETE(scroller); // need to delete the scroller init in the base class
|
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);
|
scroller = NEW TextScroller(Fonts::MAIN_FONT, 40 , 230, scrollerWidth, 100, 1, 1);
|
||||||
|
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ void DeckMenu::updateScroller()
|
|||||||
for (vector<Task*>::iterator it = taskList->tasks.begin(); it!=taskList->tasks.end(); it++)
|
for (vector<Task*>::iterator it = taskList->tasks.begin(); it!=taskList->tasks.end(); it++)
|
||||||
{
|
{
|
||||||
ostringstream taskDescription;
|
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() );
|
scroller->Add( taskDescription.str() );
|
||||||
}
|
}
|
||||||
SAFE_DELETE(taskList);
|
SAFE_DELETE(taskList);
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ void OptionProfile::Render(){
|
|||||||
mFont->SetScale(1);
|
mFont->SetScale(1);
|
||||||
int spacing = 2+(int)mFont->GetHeight();
|
int spacing = 2+(int)mFont->GetHeight();
|
||||||
|
|
||||||
int pX, pY;
|
float pX, pY;
|
||||||
pX = x;
|
pX = x;
|
||||||
pY = y;
|
pY = y;
|
||||||
char buf[512];
|
char buf[512];
|
||||||
@@ -185,10 +185,10 @@ void OptionProfile::Render(){
|
|||||||
|
|
||||||
mFont->SetColor(getColor(WGuiColor::TEXT_HEADER));
|
mFont->SetColor(getColor(WGuiColor::TEXT_HEADER));
|
||||||
mFont->DrawString(selections[value].c_str(), pX, pY + 2, JGETEXT_LEFT);
|
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->SetColor(getColor(WGuiColor::TEXT_BODY));
|
||||||
mFont->DrawString(preview.c_str(), pX, pY + spacing + 2, JGETEXT_LEFT);
|
mFont->DrawString(preview.c_str(), pX, pY + spacing + 2, JGETEXT_LEFT);
|
||||||
mFont->SetScale(1);
|
mFont->SetScale(1.0f);
|
||||||
|
|
||||||
}
|
}
|
||||||
void OptionProfile::Entering(JButton key){
|
void OptionProfile::Entering(JButton key){
|
||||||
@@ -429,7 +429,7 @@ void OptionTheme::Render(){
|
|||||||
mFont->DrawString(buf, x + 2, y + 2);
|
mFont->DrawString(buf, x + 2, y + 2);
|
||||||
if(bChecked && author.size()){
|
if(bChecked && author.size()){
|
||||||
mFont->SetColor(getColor(WGuiColor::TEXT_BODY));
|
mFont->SetColor(getColor(WGuiColor::TEXT_BODY));
|
||||||
mFont->SetScale(.8);
|
mFont->SetScale(0.8f);
|
||||||
float hi = mFont->GetHeight();
|
float hi = mFont->GetHeight();
|
||||||
sprintf(buf,_("Artist: %s").c_str(),author.c_str());
|
sprintf(buf,_("Artist: %s").c_str(),author.c_str());
|
||||||
mFont->DrawString(buf, x + 2, y + getHeight() - hi);
|
mFont->DrawString(buf, x + 2, y + getHeight() - hi);
|
||||||
@@ -475,13 +475,13 @@ void OptionKey::Render() {
|
|||||||
{
|
{
|
||||||
const KeyRep& rep = translateKey(from);
|
const KeyRep& rep = translateKey(from);
|
||||||
if (rep.second)
|
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
|
else
|
||||||
mFont->DrawString(rep.first, x + 4, y + 3, JGETEXT_LEFT);
|
mFont->DrawString(rep.first, x + 4, y + 3, JGETEXT_LEFT);
|
||||||
const KeyRep& rep2 = translateKey(to);
|
const KeyRep& rep2 = translateKey(to);
|
||||||
if (rep2.second)
|
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);
|
renderer->RenderQuad(rep2.second, x + width - (ratio * rep2.second->mWidth) - 2, y + 3, 0, ratio, ratio);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -525,7 +525,7 @@ void OptionKey::Overlay()
|
|||||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||||
mFont->SetColor(ARGB(255, 0, 0, 0));
|
mFont->SetColor(ARGB(255, 0, 0, 0));
|
||||||
if (grabbed) {
|
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));
|
renderer->FillRoundRect(x, y, SCREEN_WIDTH - 2*x, 50, 2, ARGB(200, 200, 200, 255));
|
||||||
string msg = _("Press a key to associate.");
|
string msg = _("Press a key to associate.");
|
||||||
mFont->DrawString(msg, (SCREEN_WIDTH - mFont->GetStringWidth(msg.c_str())) / 2, y + 20);
|
mFont->DrawString(msg, (SCREEN_WIDTH - mFont->GetStringWidth(msg.c_str())) / 2, y + 20);
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
const unsigned int kPoleWidth = 7;
|
const float kPoleWidth = 7;
|
||||||
const unsigned int kVerticalMargin = 16;
|
const float kVerticalMargin = 16;
|
||||||
const unsigned int kHorizontalMargin = 30;
|
const float kHorizontalMargin = 30;
|
||||||
const signed int kLineHeight = 20;
|
const float kLineHeight = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad* SimpleMenu::spadeR = NULL;
|
JQuad* SimpleMenu::spadeR = NULL;
|
||||||
@@ -31,7 +31,7 @@ PIXEL_TYPE SimpleMenu::jewelGraphics[9] = {0x3FFFFFFF,0x63645AEA,0x610D0D98,
|
|||||||
0x610D0D98,0xFF110F67,0xFD030330};
|
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;
|
autoTranslate = true;
|
||||||
mHeight = 2 * kVerticalMargin;
|
mHeight = 2 * kVerticalMargin;
|
||||||
mWidth = 0;
|
mWidth = 0;
|
||||||
@@ -63,7 +63,7 @@ SimpleMenu::SimpleMenu(int id, JGuiListener* listener, int fontId, int x, int y,
|
|||||||
stars->FireAt(mX, mY);
|
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();
|
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);
|
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();
|
JRenderer* renderer = JRenderer::GetInstance();
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ void SimpleMenu::Render() {
|
|||||||
if (0 == mWidth) {
|
if (0 == mWidth) {
|
||||||
float sY = mY + kVerticalMargin;
|
float sY = mY + kVerticalMargin;
|
||||||
for (int i = startId; i < startId + mCount; ++i) {
|
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 (mWidth < width) mWidth = width;
|
||||||
}
|
}
|
||||||
if ((!title.empty()) && (mWidth < titleFont->GetStringWidth(title.c_str()))) mWidth = titleFont->GetStringWidth(title.c_str());
|
if ((!title.empty()) && (mWidth < titleFont->GetStringWidth(title.c_str()))) mWidth = titleFont->GetStringWidth(title.c_str());
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "Translate.h"
|
#include "Translate.h"
|
||||||
#include "WResourceManager.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);
|
if (autoTranslate) mText = _(text);
|
||||||
else mText = text;
|
else mText = text;
|
||||||
@@ -65,13 +65,13 @@ bool SimpleMenuItem::ButtonPressed()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleMenuItem::Relocate(int x, int y)
|
void SimpleMenuItem::Relocate(float x, float y)
|
||||||
{
|
{
|
||||||
mX = x;
|
mX = x;
|
||||||
mY = y;
|
mY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SimpleMenuItem::GetWidth()
|
float SimpleMenuItem::GetWidth()
|
||||||
{
|
{
|
||||||
WFont * mFont = resources.GetWFont(fontId);
|
WFont * mFont = resources.GetWFont(fontId);
|
||||||
mFont->SetScale(1.0);
|
mFont->SetScale(1.0);
|
||||||
|
|||||||
Reference in New Issue
Block a user