More type conversion warning fixes, with some minor refactoring thrown in.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
#ifndef _MTGDEFINITION_H_
|
||||
#define _MTGDEFINITION_H_
|
||||
|
||||
#define DEFAULT_MENU_FONT_SCALE 1.0
|
||||
#define DEFAULT_MAIN_FONT_SCALE 1.0
|
||||
#define DEFAULT_TEXT_FONT_SCALE 1.0
|
||||
const float DEFAULT_MENU_FONT_SCALE = 1.0f;
|
||||
const float DEFAULT_MAIN_FONT_SCALE = 1.0f;
|
||||
const float DEFAULT_TEXT_FONT_SCALE = 1.0f;
|
||||
|
||||
class Constants
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ class PlayGuiObject: public JGuiObject, public JGuiListener, public Pos{
|
||||
PlayGuiObject(float desiredHeight, float x, float y, bool hasFocus);
|
||||
PlayGuiObject(float desiredHeight, const Pos& ref, bool hasFocus);
|
||||
virtual void ButtonPressed(int controllerId, int controlId){};
|
||||
virtual bool getTopLeft(int& top, int& left) {top = actY; left = actX; return true;};
|
||||
virtual bool getTopLeft(int& top, int& left) {top = static_cast<int>(actY); left = static_cast<int>(actX); return true;};
|
||||
virtual ~PlayGuiObject(){};
|
||||
vector<Effect*> effects;
|
||||
};
|
||||
|
||||
@@ -25,13 +25,11 @@ CardDisplay::CardDisplay(int id, GameObserver* game, int _x, int _y, JGuiListene
|
||||
zone = NULL;
|
||||
}
|
||||
|
||||
|
||||
void CardDisplay::AddCard(MTGCardInstance * _card){
|
||||
CardGui * card = NEW CardView(CardSelector::nullZone, _card, x + 20 + (mCount - start_item) * 30, y + 25);
|
||||
CardGui * card = NEW CardView(CardSelector::nullZone, _card, static_cast<float>(x + 20 + (mCount - start_item) * 30), static_cast<float>(y + 25));
|
||||
Add(card);
|
||||
}
|
||||
|
||||
|
||||
void CardDisplay::init(MTGGameZone * zone){
|
||||
resetObjects();
|
||||
if (!zone) return;
|
||||
@@ -60,8 +58,6 @@ void CardDisplay::rotateRight(){
|
||||
start_item ++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CardDisplay::Update(float dt){
|
||||
bool update = false;
|
||||
|
||||
@@ -195,22 +191,21 @@ bool CardDisplay::CheckUserInput(JButton key){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void CardDisplay::Render(){
|
||||
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
r->DrawRect(x,y,nb_displayed_items * 30 + 20, 50, ARGB(255,255,255,255));
|
||||
r->DrawRect(static_cast<float>(x), static_cast<float>(y), static_cast<float>(nb_displayed_items * 30 + 20), 50, ARGB(255,255,255,255));
|
||||
if (!mCount) return;
|
||||
for (int i = start_item; i< start_item + nb_displayed_items && i < mCount; i++){
|
||||
if (mObjects[i]){
|
||||
mObjects[i]->Render();
|
||||
if (tc){
|
||||
CardGui * cardg = (CardGui *)mObjects[i];
|
||||
if( tc->alreadyHasTarget(cardg->card)){
|
||||
r->DrawCircle(cardg->x + 5, cardg->y+5,5, ARGB(255,255,0,0));
|
||||
}else if (!tc->canTarget(cardg->card)){
|
||||
r->FillRect(cardg->x,cardg->y,30,40,ARGB(200,0,0,0));
|
||||
}
|
||||
CardGui * cardg = (CardGui *)mObjects[i];
|
||||
if( tc->alreadyHasTarget(cardg->card)){
|
||||
r->DrawCircle(cardg->x + 5, cardg->y+5,5, ARGB(255,255,0,0));
|
||||
}else if (!tc->canTarget(cardg->card)){
|
||||
r->FillRect(cardg->x,cardg->y,30,40,ARGB(200,0,0,0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,21 @@ const float CardGui::Height = 40.0;
|
||||
const float CardGui::BigWidth = 200.0;
|
||||
const float CardGui::BigHeight = 285.0;
|
||||
|
||||
const float kWidthScaleFactor = 0.8f;
|
||||
|
||||
namespace
|
||||
{
|
||||
inline float SineHelperFunction(const float& value)
|
||||
{
|
||||
return sinf(2*M_PI*(value)/256.0f);
|
||||
}
|
||||
|
||||
inline float CosineHelperFunction(const float& value)
|
||||
{
|
||||
return cosf(2*M_PI*(value-35)/256.0f);
|
||||
}
|
||||
}
|
||||
|
||||
CardGui::CardGui(MTGCardInstance* card, float x, float y) : PlayGuiObject(Height, x, y, false), card(card) {}
|
||||
CardGui::CardGui(MTGCardInstance* card, const Pos& ref) : PlayGuiObject(Height, ref, false), card(card) {}
|
||||
|
||||
@@ -83,7 +98,7 @@ void CardGui::Render()
|
||||
|
||||
if (alternate) {
|
||||
mFont->SetColor(ARGB(static_cast<unsigned char>(actA), 0, 0, 0));
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE * 0.5 * actZ);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE * 0.5f * actZ);
|
||||
mFont->DrawString(_(card->getName()), actX - actZ * Width / 2 + 1, actY - actZ * Height / 2 + 1);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
|
||||
@@ -165,7 +180,7 @@ JQuad * CardGui::alternateThumbQuad(MTGCard * card){
|
||||
}
|
||||
}
|
||||
if(q && q->mTex)
|
||||
q->SetHotSpot(q->mTex->mWidth/2,q->mTex->mHeight/2);
|
||||
q->SetHotSpot(static_cast<float>(q->mTex->mWidth/2),static_cast<float>(q->mTex->mHeight/2));
|
||||
return q;
|
||||
}
|
||||
|
||||
@@ -192,7 +207,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
||||
}
|
||||
}
|
||||
if(q && q->mTex){
|
||||
q->SetHotSpot(q->mTex->mWidth/2,q->mTex->mHeight/2);
|
||||
q->SetHotSpot(static_cast<float>(q->mTex->mWidth/2),static_cast<float>(q->mTex->mHeight/2));
|
||||
|
||||
float scale = pos.actZ * 250 / q->mHeight;
|
||||
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||
@@ -202,12 +217,12 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
||||
WFont * font = resources.GetWFont("magic");
|
||||
float backup_scale = font->GetScale();
|
||||
font->SetColor(ARGB((int)pos.actA, 0, 0, 0));
|
||||
font->SetScale(0.8 * pos.actZ);
|
||||
font->SetScale(kWidthScaleFactor * pos.actZ);
|
||||
|
||||
{
|
||||
char name[4096];
|
||||
sprintf(name, "%s", _(card->data->getName()).c_str());
|
||||
float w = font->GetStringWidth(name) * 0.8 * pos.actZ;
|
||||
float w = font->GetStringWidth(name) * kWidthScaleFactor * pos.actZ;
|
||||
if (w > BigWidth - 30)
|
||||
font->SetScale((BigWidth - 30) / w);
|
||||
font->DrawString(name, x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (25 - BigHeight / 2)*pos.actZ);
|
||||
@@ -215,7 +230,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
||||
|
||||
// Write the description
|
||||
{
|
||||
font->SetScale(0.8 * pos.actZ);
|
||||
font->SetScale(kWidthScaleFactor * pos.actZ);
|
||||
const std::vector<string> txt = card->data->formattedText();
|
||||
unsigned i = 0;
|
||||
unsigned h = neofont ? 14 : 11;
|
||||
@@ -228,7 +243,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
||||
{
|
||||
char buffer[32];
|
||||
sprintf(buffer, "%i/%i", card->data->power, card->data->toughness);
|
||||
float w = font->GetStringWidth(buffer) * 0.8;
|
||||
float w = font->GetStringWidth(buffer) * kWidthScaleFactor;
|
||||
font->DrawString(buffer, x + (65 - w / 2)*pos.actZ, pos.actY + (106)*pos.actZ);
|
||||
}
|
||||
|
||||
@@ -242,25 +257,25 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
||||
float yOffset = -112;
|
||||
while ((h = manacost->getHybridCost(j)))
|
||||
{
|
||||
float scale = pos.actZ * 0.05 * cosf(2*M_PI*((float)t)/256.0);
|
||||
float scale = pos.actZ * 0.05f * cosf(2*M_PI*((float)t)/256.0f);
|
||||
|
||||
if (scale < 0)
|
||||
{
|
||||
renderer->RenderQuad(manaIcons[h->color1], x + (-12 * j + 75 + 3 * sinf(2*M_PI*((float)t)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(t-35))/256.0))*pos.actZ, 0, 0.4 + scale, 0.4 + scale);
|
||||
renderer->RenderQuad(manaIcons[h->color2], x + (-12 * j + 75 + 3 * sinf(2*M_PI*((float)v)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(v-35))/256.0))*pos.actZ, 0, 0.4 - scale, 0.4 - scale);
|
||||
}
|
||||
{
|
||||
renderer->RenderQuad(manaIcons[h->color1], x + (-12 * j + 75 + 3 * SineHelperFunction((float)t))*pos.actZ, pos.actY + (yOffset + 3 * CosineHelperFunction((float)t))*pos.actZ, 0, 0.4f + scale, 0.4f + scale);
|
||||
renderer->RenderQuad(manaIcons[h->color2], x + (-12 * j + 75 + 3 * SineHelperFunction((float)v))*pos.actZ, pos.actY + (yOffset + 3 * CosineHelperFunction((float)v))*pos.actZ, 0, 0.4f - scale, 0.4f - scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer->RenderQuad(manaIcons[h->color2], x + (- 12 * j + 75 + 3 * sinf(2*M_PI*((float)v)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(v-35))/256.0))*pos.actZ, 0, 0.4 - scale, 0.4 - scale);
|
||||
renderer->RenderQuad(manaIcons[h->color1], x + (- 12 * j + 75 + 3 * sinf(2*M_PI*((float)t)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(t-35))/256.0))*pos.actZ, 0, 0.4 + scale, 0.4 + scale);
|
||||
}
|
||||
{
|
||||
renderer->RenderQuad(manaIcons[h->color2], x + (- 12 * j + 75 + 3 * SineHelperFunction((float)v))*pos.actZ, pos.actY + (yOffset + 3 * CosineHelperFunction((float)v))*pos.actZ, 0, 0.4f - scale, 0.4f - scale);
|
||||
renderer->RenderQuad(manaIcons[h->color1], x + (- 12 * j + 75 + 3 * SineHelperFunction((float)t))*pos.actZ, pos.actY + (yOffset + 3 * CosineHelperFunction((float)t))*pos.actZ, 0, 0.4f + scale, 0.4f + scale);
|
||||
}
|
||||
++j;
|
||||
}
|
||||
for (int i = Constants::MTG_NB_COLORS - 2; i >= 1; --i)
|
||||
{
|
||||
for (int cost = manacost->getCost(i); cost > 0; --cost)
|
||||
{
|
||||
renderer->RenderQuad(manaIcons[i], x + (-12*j + 75)*pos.actZ, pos.actY + (yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
||||
renderer->RenderQuad(manaIcons[i], x + (-12*j + 75)*pos.actZ, pos.actY + (yOffset)*pos.actZ, 0, 0.4f * pos.actZ, 0.4f * pos.actZ);
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -269,7 +284,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
||||
{
|
||||
char buffer[10];
|
||||
sprintf(buffer, "%d", cost);
|
||||
renderer->RenderQuad(manaIcons[0], x + (- 12*j + 75)*pos.actZ, pos.actY +(yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
||||
renderer->RenderQuad(manaIcons[0], x + (- 12*j + 75)*pos.actZ, pos.actY +(yOffset)*pos.actZ, 0, 0.4f * pos.actZ, 0.4f * pos.actZ);
|
||||
float w = font->GetStringWidth(buffer);
|
||||
font->DrawString(buffer, x +(- 12*j + 76 - w/2)*pos.actZ, pos.actY + (yOffset - 5)*pos.actZ);
|
||||
++j;
|
||||
@@ -279,7 +294,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
||||
{
|
||||
char buffer[10];
|
||||
sprintf(buffer, "X");
|
||||
renderer->RenderQuad(manaIcons[0], x + (- 12*j + 75)*pos.actZ, pos.actY +(yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
||||
renderer->RenderQuad(manaIcons[0], x + (- 12*j + 75)*pos.actZ, pos.actY +(yOffset)*pos.actZ, 0, 0.4f * pos.actZ, 0.4f * pos.actZ);
|
||||
float w = font->GetStringWidth(buffer);
|
||||
font->DrawString(buffer, x +(- 12*j + 76 - w/2)*pos.actZ, pos.actY + (yOffset - 5)*pos.actZ);
|
||||
}
|
||||
@@ -381,7 +396,7 @@ void CardGui::tinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad) {
|
||||
}
|
||||
}
|
||||
if(q && q->mTex){
|
||||
q->SetHotSpot(q->mTex->mWidth/2,q->mTex->mHeight/2);
|
||||
q->SetHotSpot(static_cast<float>(q->mTex->mWidth/2), static_cast<float>(q->mTex->mHeight/2));
|
||||
|
||||
float scale = pos.actZ * displayScale * BigHeight / q->mHeight;
|
||||
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||
@@ -405,12 +420,12 @@ void CardGui::tinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad) {
|
||||
WFont * font = resources.GetWFont("magic");
|
||||
float backup_scale = font->GetScale();
|
||||
font->SetColor(ARGB((int)pos.actA, 0, 0, 0));
|
||||
font->SetScale(0.8 * pos.actZ);
|
||||
font->SetScale(kWidthScaleFactor * pos.actZ);
|
||||
|
||||
{
|
||||
char name[4096];
|
||||
sprintf(name, "%s", _(card->data->getName()).c_str());
|
||||
float w = font->GetStringWidth(name) * 0.8 * pos.actZ;
|
||||
float w = font->GetStringWidth(name) * kWidthScaleFactor * pos.actZ;
|
||||
if (w > BigWidth - 30)
|
||||
font->SetScale((BigWidth - 30) / w);
|
||||
font->DrawString(name, x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (25 - BigHeight / 2)*pos.actZ);
|
||||
@@ -418,7 +433,7 @@ void CardGui::tinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad) {
|
||||
|
||||
// Write the description
|
||||
{
|
||||
font->SetScale(0.8 * pos.actZ);
|
||||
font->SetScale(kWidthScaleFactor * pos.actZ);
|
||||
float imgBottom = imgY + (imgScale * quad->mHeight/2);
|
||||
unsigned i = 0;
|
||||
unsigned h = neofont ? 14 : 11;
|
||||
@@ -428,11 +443,11 @@ void CardGui::tinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad) {
|
||||
|
||||
// Write the strength
|
||||
if (card->data->isCreature())
|
||||
{
|
||||
char buffer[32];
|
||||
sprintf(buffer, "%i/%i", card->data->power, card->data->toughness);
|
||||
float w = font->GetStringWidth(buffer) * 0.8;
|
||||
font->DrawString(buffer, x + (65 - w / 2)*pos.actZ, pos.actY + (106)*pos.actZ);
|
||||
{
|
||||
char buffer[32];
|
||||
sprintf(buffer, "%i/%i", card->data->power, card->data->toughness);
|
||||
float w = font->GetStringWidth(buffer) * kWidthScaleFactor;
|
||||
font->DrawString(buffer, x + (65 - w / 2)*pos.actZ, pos.actY + (106)*pos.actZ);
|
||||
}
|
||||
|
||||
// Mana
|
||||
@@ -444,35 +459,35 @@ void CardGui::tinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad) {
|
||||
unsigned char v = t + 127;
|
||||
float yOffset = -112;
|
||||
while ((h = manacost->getHybridCost(j)))
|
||||
{
|
||||
float scale = pos.actZ * 0.05 * cosf(2*M_PI*((float)t)/256.0);
|
||||
{
|
||||
float scale = pos.actZ * 0.05f * cosf(2*M_PI*((float)t)/256.0f);
|
||||
|
||||
if (scale < 0)
|
||||
{
|
||||
renderer->RenderQuad(manaIcons[h->color1], x + (-12 * j + 75 + 3 * sinf(2*M_PI*((float)t)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(t-35))/256.0))*pos.actZ, 0, 0.4 + scale, 0.4 + scale);
|
||||
renderer->RenderQuad(manaIcons[h->color2], x + (-12 * j + 75 + 3 * sinf(2*M_PI*((float)v)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(v-35))/256.0))*pos.actZ, 0, 0.4 - scale, 0.4 - scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer->RenderQuad(manaIcons[h->color2], x + (- 12 * j + 75 + 3 * sinf(2*M_PI*((float)v)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(v-35))/256.0))*pos.actZ, 0, 0.4 - scale, 0.4 - scale);
|
||||
renderer->RenderQuad(manaIcons[h->color1], x + (- 12 * j + 75 + 3 * sinf(2*M_PI*((float)t)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(t-35))/256.0))*pos.actZ, 0, 0.4 + scale, 0.4 + scale);
|
||||
}
|
||||
if (scale < 0)
|
||||
{
|
||||
renderer->RenderQuad(manaIcons[h->color1], x + (-12 * j + 75 + 3 * SineHelperFunction((float)t))*pos.actZ, pos.actY + (yOffset + 3 * CosineHelperFunction((float)t))*pos.actZ, 0, 0.4f + scale, 0.4f + scale);
|
||||
renderer->RenderQuad(manaIcons[h->color2], x + (-12 * j + 75 + 3 * SineHelperFunction((float)v))*pos.actZ, pos.actY + (yOffset + 3 * CosineHelperFunction((float)v))*pos.actZ, 0, 0.4f - scale, 0.4f - scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer->RenderQuad(manaIcons[h->color2], x + (- 12 * j + 75 + 3 * SineHelperFunction((float)v))*pos.actZ, pos.actY + (yOffset + 3 * CosineHelperFunction((float)v))*pos.actZ, 0, 0.4f - scale, 0.4f - scale);
|
||||
renderer->RenderQuad(manaIcons[h->color1], x + (- 12 * j + 75 + 3 * SineHelperFunction((float)t))*pos.actZ, pos.actY + (yOffset + 3 * CosineHelperFunction((float)t))*pos.actZ, 0, 0.4f + scale, 0.4f + scale);
|
||||
}
|
||||
++j;
|
||||
}
|
||||
for (int i = Constants::MTG_NB_COLORS - 2; i >= 1; --i)
|
||||
{
|
||||
for (int cost = manacost->getCost(i); cost > 0; --cost)
|
||||
{
|
||||
renderer->RenderQuad(manaIcons[i], x + (-12*j + 75)*pos.actZ, pos.actY + (yOffset)*pos.actZ, 0, 0.4f * pos.actZ, 0.4f * pos.actZ);
|
||||
++j;
|
||||
}
|
||||
for (int i = Constants::MTG_NB_COLORS - 2; i >= 1; --i)
|
||||
{
|
||||
for (int cost = manacost->getCost(i); cost > 0; --cost)
|
||||
{
|
||||
renderer->RenderQuad(manaIcons[i], x + (-12*j + 75)*pos.actZ, pos.actY + (yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
||||
++j;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Colorless mana
|
||||
if (int cost = manacost->getCost(0))
|
||||
{
|
||||
char buffer[10];
|
||||
sprintf(buffer, "%d", cost);
|
||||
renderer->RenderQuad(manaIcons[0], x + (- 12*j + 75)*pos.actZ, pos.actY +(yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
||||
renderer->RenderQuad(manaIcons[0], x + (- 12*j + 75)*pos.actZ, pos.actY +(yOffset)*pos.actZ, 0, 0.4f * pos.actZ, 0.4f * pos.actZ);
|
||||
float w = font->GetStringWidth(buffer);
|
||||
font->DrawString(buffer, x +(- 12*j + 76 - w/2)*pos.actZ, pos.actY + (yOffset - 5)*pos.actZ);
|
||||
++j;
|
||||
@@ -482,7 +497,7 @@ void CardGui::tinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad) {
|
||||
{
|
||||
char buffer[10];
|
||||
sprintf(buffer, "X");
|
||||
renderer->RenderQuad(manaIcons[0], x + (- 12*j + 75)*pos.actZ, pos.actY +(yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
||||
renderer->RenderQuad(manaIcons[0], x + (- 12*j + 75)*pos.actZ, pos.actY +(yOffset)*pos.actZ, 0, 0.4f * pos.actZ, 0.4f * pos.actZ);
|
||||
float w = font->GetStringWidth(buffer);
|
||||
font->DrawString(buffer, x +(- 12*j + 76 - w/2)*pos.actZ, pos.actY + (yOffset - 5)*pos.actZ);
|
||||
}
|
||||
@@ -598,7 +613,7 @@ void CardGui::renderCountersBig(const Pos& pos){
|
||||
if (card->counters) {
|
||||
WFont * font = resources.GetWFont("magic");
|
||||
font->SetColor(ARGB((int)pos.actA, 0, 0, 0));
|
||||
font->SetScale(0.8 * pos.actZ);
|
||||
font->SetScale(kWidthScaleFactor * pos.actZ);
|
||||
std::vector<string> txt = card->formattedText();
|
||||
unsigned i = txt.size() + 1;
|
||||
Counter * c = NULL;
|
||||
|
||||
@@ -282,7 +282,7 @@ void WGuiList::Render(){
|
||||
}
|
||||
//Find out how large our list is, with all items and margin.
|
||||
for (int pos=0;pos < nbitems; pos++){
|
||||
listHeight+=items[pos]->getHeight()+1; //What does the +1 do exactly ?
|
||||
listHeight+=static_cast<int>(items[pos]->getHeight()+1); //What does the +1 do exactly ?
|
||||
if(items[pos]->Selectable()){
|
||||
listSelectable++;
|
||||
if(pos < currentItem) adjustedCurrent++;
|
||||
@@ -296,7 +296,7 @@ void WGuiList::Render(){
|
||||
if(!items[start]->Visible())
|
||||
continue;
|
||||
|
||||
vHeight += items[start]->getHeight()+5;
|
||||
vHeight += static_cast<int>(items[start]->getHeight()+5);
|
||||
if(vHeight >= (SCREEN_HEIGHT-60)/2)
|
||||
break;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ void WGuiList::Render(){
|
||||
for (nowPos=nbitems;nowPos > 1; nowPos--){
|
||||
if(!items[start]->Visible())
|
||||
continue;
|
||||
vHeight += items[nowPos-1]->getHeight()+5;
|
||||
vHeight += static_cast<int>(items[nowPos-1]->getHeight()+5);
|
||||
}
|
||||
|
||||
if(vHeight <= SCREEN_HEIGHT-40 && nowPos < start)
|
||||
@@ -327,7 +327,7 @@ void WGuiList::Render(){
|
||||
continue;
|
||||
|
||||
if(pos < start){
|
||||
vHeight += items[pos]->getHeight() + 5;
|
||||
vHeight += static_cast<int>(items[pos]->getHeight() + 5);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ void WGuiList::Render(){
|
||||
items[pos]->setWidth(width-10);
|
||||
else
|
||||
items[pos]->setWidth(width);
|
||||
nowPos += items[pos]->getHeight() + 5;
|
||||
nowPos += static_cast<int>(items[pos]->getHeight() + 5);
|
||||
renderBack(items[pos]);
|
||||
items[pos]->Render();
|
||||
if(nowPos > SCREEN_HEIGHT) //Stop displaying things once we reach the bottom of the screen.
|
||||
@@ -346,8 +346,8 @@ void WGuiList::Render(){
|
||||
|
||||
//Draw scrollbar
|
||||
if(listHeight > SCREEN_HEIGHT && listSelectable > 1){
|
||||
int barPosition = y-5+((float)adjustedCurrent/listSelectable)*(SCREEN_HEIGHT-y);
|
||||
int barLength = (SCREEN_HEIGHT-y) / listSelectable;
|
||||
float barPosition = static_cast<float>(y-5+((float)adjustedCurrent/listSelectable)*(SCREEN_HEIGHT-y));
|
||||
float barLength = static_cast<float>((SCREEN_HEIGHT-y) / listSelectable);
|
||||
if(barLength < 4) barLength = 4;
|
||||
renderer->FillRect(x+width-2,y-1,2,SCREEN_HEIGHT-y,
|
||||
getColor(WGuiColor::SCROLLBAR));
|
||||
@@ -802,7 +802,7 @@ bool WGuiMenu::CheckUserInput(JButton key){
|
||||
return true;
|
||||
}
|
||||
else if(held == buttonPrev && duration > 1){
|
||||
duration = .92;
|
||||
duration = .92f;
|
||||
if(prevItem())
|
||||
return true;
|
||||
}
|
||||
@@ -813,7 +813,7 @@ bool WGuiMenu::CheckUserInput(JButton key){
|
||||
return true;
|
||||
}
|
||||
else if(held == buttonNext && duration > 1){
|
||||
duration = .92;
|
||||
duration = .92f;
|
||||
if(nextItem())
|
||||
return true;
|
||||
}
|
||||
@@ -974,10 +974,10 @@ void WGuiTabMenu::Render(){
|
||||
if (!items.size())
|
||||
return;
|
||||
|
||||
int offset = x;
|
||||
mFont->SetScale(0.8);
|
||||
float offset = x;
|
||||
mFont->SetScale(0.8f);
|
||||
for(vector<WGuiBase*>::iterator it = items.begin();it!=items.end();it++){
|
||||
int w = mFont->GetStringWidth(_((*it)->getDisplay()).c_str());
|
||||
float w = mFont->GetStringWidth(_((*it)->getDisplay()).c_str());
|
||||
mFont->SetColor((*it)->getColor(WGuiColor::TEXT_TAB));
|
||||
renderer->FillRoundRect(offset+5,5,w + 5,25,2,(*it)->getColor(WGuiColor::BACK_TAB));
|
||||
mFont->DrawString(_((*it)->getDisplay()).c_str(),offset+10,10);
|
||||
@@ -1001,7 +1001,7 @@ void WGuiTabMenu::save(){
|
||||
void WGuiAward::Overlay(){
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetScale(.8);
|
||||
mFont->SetScale(0.8f);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
|
||||
string s = details;
|
||||
@@ -1338,7 +1338,7 @@ void WGuiListRow::Render(){
|
||||
tallestRow = temp;
|
||||
if(temp > cTallest)
|
||||
cTallest = temp;
|
||||
nowPos += items[pos]->getWidth() + 5;
|
||||
nowPos += static_cast<int>(items[pos]->getWidth() + 5);
|
||||
renderBack(items[pos]);
|
||||
if(x+nowPos+items[pos]->getWidth()+10 > SCREEN_WIDTH){
|
||||
nowPos = 0 + 20; //Indent newlines.
|
||||
@@ -1941,7 +1941,7 @@ void WGuiKeyBinder::Render() {
|
||||
renderer->FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(230, 255, 240, 240));
|
||||
|
||||
size_t pos = 0;
|
||||
u32 y = 20;
|
||||
float y = 20;
|
||||
do {
|
||||
size_t t = confirmationString.find_first_of("\n", pos);
|
||||
string s = confirmationString.substr(pos, t - pos);
|
||||
|
||||
Reference in New Issue
Block a user