modified font size of text in menus.

Adjusted the spacing between menu items on all menus. They were a little too far apart once I modified the font size.
fixed Hollowhenge Spirit
This commit is contained in:
techdragon.nguyen@gmail.com
2012-03-20 08:35:38 +00:00
parent 37856c7742
commit 57627849a0
10 changed files with 74 additions and 43 deletions

View File

@@ -636,7 +636,7 @@ static NSString *_MY_AD_WHIRL_APPLICATION_KEY_IPAD = @"2e70e3f3da40408588b9a3170
newFrame.size = adSize;
// ads are 320 x 50
newFrame.origin.x = ( (isLandscape ? screenSize.height : screenSize.width) - adSize.width)/ 2;
newFrame.origin.y = 0;
newFrame.origin.y = ( (isLandscape ? screenSize.width : screenSize.height) - 50);
[adWhirlView setFrame: newFrame];
@@ -700,10 +700,14 @@ static NSString *_MY_AD_WHIRL_APPLICATION_KEY_IPAD = @"2e70e3f3da40408588b9a3170
//(in landscape mode):
//Same explanation as the one in the method "adjustAdSize" for the Ad's width
int screenWidth = [viewController.parentViewController.view bounds].size.width;
float yOffset = [viewController.parentViewController.view bounds].size.height - 50;
if ( isLandscape )
{
yOffset = screenWidth - 50;
screenWidth = [viewController.parentViewController.view bounds].size.height;
self.adView.frame = CGRectMake((screenWidth - adSize.width) / 2, 0, adSize.width, adSize.height);
}
self.adView.frame = CGRectMake((screenWidth - adSize.width) / 2, yOffset, adSize.width, adSize.height);
//Trying to keep everything inside the Ad bounds
self.adView.clipsToBounds = YES;

View File

@@ -35216,7 +35216,7 @@ toughness=5
[card]
name=Hollowhenge Spirit
abilities=flash,flying
auto=target(creature[attacking]) removefromcombat
auto=target(creature[attacking,blocking]) removefromcombat
text=Flash -- Flying -- When Hollowhenge Spirit enters the battlefield, remove target attacking or blocking creature from combat.
mana={3}{W}
type=Creature

View File

@@ -4,6 +4,7 @@
const float DEFAULT_MENU_FONT_SCALE = 1.0f;
const float DEFAULT_MAIN_FONT_SCALE = 1.0f;
const float DEFAULT_TEXT_FONT_SCALE = 1.0f;
const float ACTIVE_MENU_FONT_SCALE = 1.2f;
#include <string>
using std::string;

View File

@@ -17,6 +17,7 @@ using std::string;
#define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f
#define SCALE_SHRINK 0.75f
class SimpleButton: public JGuiObject
{

View File

@@ -18,7 +18,7 @@ namespace
const float kVerticalMargin = 16;
const float kHorizontalMargin = 20;
const float kLineHeight = 25;
const float kDescriptionVerticalBoxPadding = 35;
const float kDescriptionVerticalBoxPadding = -5;
const float kDescriptionHorizontalBoxPadding = 5;
const float kDefaultFontScale = 1.0f;
@@ -52,10 +52,10 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
titleY = 15;
titleWidth = 180; // width of inner box of title
descX = 260 + kDescriptionVerticalBoxPadding;
descY = 100 + kDescriptionHorizontalBoxPadding;
descX = 260 + kDescriptionHorizontalBoxPadding;
descY = 100 + kDescriptionVerticalBoxPadding;
descHeight = 145;
descWidth = 200;
descWidth = 195;
detailedInfoBoxX = 400;
detailedInfoBoxY = 235;
@@ -90,9 +90,9 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
mClosed = false;
if (mFont->GetStringWidth(title.c_str()) > titleWidth)
titleFontScale = 0.75f;
titleFontScale = SCALE_SHRINK;
else
titleFontScale = 1.0f;
titleFontScale = SCALE_NORMAL;
mSelectionTargetY = selectionY = kVerticalMargin;
@@ -101,7 +101,9 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
stars->FireAt(mX, mY);
const string detailedInfoString = _("Detailed Info");
float stringWidth = mFont->GetStringWidth(detailedInfoString.c_str());
WFont *descriptionFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
float stringWidth = descriptionFont->GetStringWidth(detailedInfoString.c_str());
float boxStartX = detailedInfoBoxX - stringWidth / 2 + 20;
dismissButton = NEW InteractiveButton( this, kDetailedInfoButtonId, Fonts::MAIN_FONT, detailedInfoString, boxStartX, detailedInfoBoxY, JGE_BTN_CANCEL);
@@ -258,7 +260,7 @@ void DeckMenu::Render()
if (currentMenuItem->hasFocus())
{
mSelectedDeck = metaData;
WFont *mainFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
WFont *descriptionFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
// display the "more info" button if special condition is met
if (showDetailsScreen())
@@ -271,33 +273,27 @@ void DeckMenu::Render()
dismissButton->setIsSelectionValid(false);
}
// display the avatar image
if (currentMenuItem->getImageFilename().size() > 0)
string currentAvatarImageName = currentMenuItem->getImageFilename();
if (currentAvatarImageName.size() > 0)
{
JQuadPtr quad;
if(currentMenuItem->getImageFilename() == "EvilTwinAvatar")
JQuadPtr quad = WResourceManager::Instance()->RetrieveTempQuad(currentAvatarImageName, TEXTURE_SUB_AVATAR);
if(quad.get())
{
quad = WResourceManager::Instance()->RetrieveTempQuad("avatar.jpg", TEXTURE_SUB_AVATAR);
if(quad.get())
if (currentMenuItem->getText() == "Evil Twin")
{
JQuad * evil = quad.get();
evil->SetHFlip(true);
renderer->RenderQuad(quad.get(), avatarX, avatarY);
evil = NULL;
}
}
else
{
quad = WResourceManager::Instance()->RetrieveTempQuad(currentMenuItem->getImageFilename(), TEXTURE_SUB_AVATAR);
if (quad.get())
else
renderer->RenderQuad(quad.get(), avatarX, avatarY);
}
}
// fill in the description part of the screen
string text = wordWrap(_(currentMenuItem->getDescription()), descWidth, mainFont->mFontID );
mainFont->DrawString(text.c_str(), descX, descY);
mFont->SetColor(ARGB(255,255,255,255));
string text = wordWrap(_(currentMenuItem->getDescription()), descWidth, descriptionFont->mFontID );
descriptionFont->DrawString(text.c_str(), descX, descY);
// fill in the statistical portion
if (currentMenuItem->hasMetaData())
@@ -305,13 +301,14 @@ void DeckMenu::Render()
ostringstream oss;
oss << _("Deck: ") << currentMenuItem->getDeckName() << endl;
oss << currentMenuItem->getDeckStatsSummary();
mainFont->DrawString(oss.str(), statsX, statsY);
descriptionFont->DrawString(oss.str(), statsX, statsY);
}
// change the font color of the current menu item
mFont->SetColor(ARGB(255,255,255,255));
}
else
{
else // reset the font color to be slightly muted
mFont->SetColor(ARGB(150,255,255,255));
}
currentMenuItem->RenderWithOffset(-kLineHeight * startId);
}
}
@@ -348,6 +345,9 @@ void DeckMenu::Update(float dt)
float starsX = starsOffsetX + ((mWidth - 2 * kHorizontalMargin) * (1 + cos(selectionT)) / 2);
float starsY = selectionY + 5 * cos(selectionT * 2.35f) + kLineHeight / 2 - kLineHeight * startId;
stars->MoveTo(starsX, starsY);
//
if (timeOpen < 0)
{
timeOpen += dt * 10;

View File

@@ -63,7 +63,7 @@ DeckMenuItem::DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, f
break;
case kEvilTwinMenuID:
{
mImageFilename = "EvilTwinAvatar";
mImageFilename = "avatar.jpg";
break;
}
default:
@@ -99,7 +99,12 @@ void DeckMenuItem::RenderWithOffset(float yOffset)
mScrollerOffset = -1 * ( getWidth() - ITEM_PX_WIDTH )/2;
float offSet = mScrollerOffset;
mFont->DrawString(mText.c_str(), mX, mY + yOffset, JGETEXT_CENTER, offSet, ITEM_PX_WIDTH);
if (mHasFocus)
mFont->SetScale(SCALE_SELECTED);
else
mFont->SetScale(SCALE_NORMAL);
mFont->DrawString(mText.c_str(), mX, mY + yOffset, JGETEXT_CENTER, offSet, ITEM_PX_WIDTH);
mDisplayInitialized = true;
//Render a "new" icon for decks that have never been played yet
if (mMetaData && !mMetaData->getGamesPlayed())

View File

@@ -209,7 +209,7 @@ string GameStateShop::descPurchase(int controlId, bool tiny)
void GameStateShop::beginPurchase(int controlId)
{
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT);
mFont->SetScale(DEFAULT_MENU_FONT_SCALE);
mFont->SetScale(SCALE_NORMAL);
SAFE_DELETE(menu);
if (mInventory[controlId] <= 0)
{

View File

@@ -50,6 +50,11 @@ void SimpleButton::RenderWithOffset(float yOffset)
{
mYOffset = yOffset;
WFont * mFont = WResourceManager::Instance()->GetWFont(mFontId);
if (mHasFocus)
mFont->SetScale(SCALE_SELECTED);
else
mFont->SetScale(SCALE_NORMAL);
mFont->DrawString(mText.c_str(), mX, mY + yOffset, JGETEXT_CENTER);
}

View File

@@ -9,12 +9,12 @@
namespace
{
const float kPoleWidth = 7;
const float kVerticalMargin = 16;
const float kVerticalMargin = 20;
const float kHorizontalMargin = 30;
#ifdef TOUCH_ENABLED
const float kLineHeight = 30;
const float kLineHeight = 25;
#else
const float kLineHeight = 20;
#endif
@@ -150,7 +150,7 @@ void SimpleMenu::Render()
for (int i = 0; i < mCount; ++i)
{
float y = mY + kVerticalMargin + i * kLineHeight + 3;//spacing between first object and title bar
float y = mY + kVerticalMargin + i * kLineHeight;
SimpleMenuItem * smi = static_cast<SimpleMenuItem*> (mObjects[i]);
smi->Relocate(mX + mWidth / 2, y);
if (smi->hasFocus()) sY = y;
@@ -183,26 +183,32 @@ void SimpleMenu::Render()
if (!title.empty())
{
mFont->SetScale(1.5f);
int scaleFactor = titleFont->GetScale();
titleFont->SetScale(SCALE_NORMAL);
titleFont->DrawString(title.c_str(), mX + mWidth / 2, mY - 3, JGETEXT_CENTER);
titleFont->SetScale(scaleFactor);
}
for (int i = startId; i < startId + maxItems; i++)
{
if (i > mCount - 1) break;
if ((static_cast<SimpleMenuItem*> (mObjects[i]))->getY() - kLineHeight * startId < mY + height - kLineHeight + 7)
SimpleMenuItem *currentMenuItem = static_cast<SimpleMenuItem*>(mObjects[i]);
float currentY = currentMenuItem->getY() - kLineHeight * startId;
float menuBottomEdge = mY + height - kLineHeight + 7;
if (currentY < menuBottomEdge)
{
if (static_cast<SimpleMenuItem*> (mObjects[i])->hasFocus())
if (currentMenuItem->hasFocus())
{
WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT)->DrawString(static_cast<SimpleMenuItem*> (mObjects[i])->getDescription().c_str(), mX
WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT)->DrawString(currentMenuItem->getDescription().c_str(), mX
+ mWidth + 10, mY + 15);
mFont->SetColor(ARGB(255,255,255,0));
}
else
{
mFont->SetColor(ARGB(150,255,255,255));
}
(static_cast<SimpleMenuItem*> (mObjects[i]))->RenderWithOffset(-kLineHeight * startId);
}
}
mFont->SetScale(1.0f);
}
void SimpleMenu::Update(float dt)

View File

@@ -197,8 +197,12 @@ PIXEL_TYPE WDecoStyled::getColor(int type)
void WGuiHeader::Render()
{
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
// save the current scaling factor. We don't want the lists to change font size these lists should stay the same no matter what
int currentScale = mFont->GetScale();
mFont->SetScale(SCALE_NORMAL);
mFont->SetColor(getColor(WGuiColor::TEXT));
mFont->DrawString(_(displayValue).c_str(), x + width / 2, y, JGETEXT_CENTER);
mFont->SetScale(currentScale);
}
bool WGuiMenu::Leaving(JButton key)
@@ -300,13 +304,17 @@ void WGuiList::Render()
int adjustedCurrent = 0;
int start = 0, nowPos = 0, vHeight = 0;
int nbitems = (int) items.size();
//List is empty.
if (!items.size() && failMsg != "")
{
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
// save the current scaling factor. We don't want the lists to change font size these lists should stay the same no matter what
int fontScaleFactor = mFont->GetScale();
mFont->SetScale(SCALE_NORMAL);
mFont->SetColor(getColor(WGuiColor::TEXT_FAIL));
mFont->DrawString(_(failMsg).c_str(), x + width / 2, y, JGETEXT_RIGHT);
mFont->SetScale(fontScaleFactor);
return;
}
@@ -1967,7 +1975,8 @@ void WGuiFilterItem::updateValue()
SAFE_DELETE(mParent->subMenu);
mState = STATE_CHOOSE_TYPE;
SAFE_DELETE(mParent->subMenu);
mParent->subMenu = NEW SimpleMenu(JGE::GetInstance(), -1234, this, Fonts::MAIN_FONT, 30, 30, "Filter By...", 6);
mParent->subMenu = NEW SimpleMenu(JGE::GetInstance(), -1234, this, Fonts::MENU_FONT, 20, 20, "Filter By...", 6);
if (mParent->isAvailable(FILTER_SET))
{
mParent->subMenu->Add(FILTER_SET, "Set");