Added new files to the VS2010 sln; Fixed a bunch of int to float warnings.
Minor note to others: if you're writing drawing code, the coordinate system in JGE uses floats, so don't bother with ints for x/y coords & the like. You're forcing the processor to do float to long conversions for nothing.
This commit is contained in:
@@ -13,11 +13,11 @@
|
||||
class DeckMenu:public JGuiController{
|
||||
protected:
|
||||
|
||||
int mHeight, mWidth, mX, mY;
|
||||
int titleX, titleY, titleWidth;
|
||||
int descX, descY, descHeight, descWidth;
|
||||
int statsX, statsY, statsHeight, statsWidth;
|
||||
int avatarX, avatarY;
|
||||
float mHeight, mWidth, mX, mY;
|
||||
float titleX, titleY, titleWidth;
|
||||
float descX, descY, descHeight, descWidth;
|
||||
float statsX, statsY, statsHeight, statsWidth;
|
||||
float avatarX, avatarY;
|
||||
string backgroundName;
|
||||
|
||||
int fontId;
|
||||
|
||||
@@ -27,13 +27,13 @@ class DeckMenuItem: public JGuiObject
|
||||
string desc;
|
||||
DeckMetaData *meta;
|
||||
|
||||
DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, int x, int y, bool hasFocus = false, bool autoTranslate = false, DeckMetaData *meta = NULL);
|
||||
DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus = false, bool autoTranslate = false, DeckMetaData *meta = NULL);
|
||||
~DeckMenuItem();
|
||||
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);
|
||||
@@ -44,7 +44,7 @@ class DeckMenuItem: public JGuiObject
|
||||
virtual bool Leaving(JButton key);
|
||||
virtual bool ButtonPressed();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual bool getTopLeft(int& top, int& left) {top = mY; left = mX; return true;};
|
||||
virtual bool getTopLeft(float& top, float& left) {top = mY; left = mX; return true;};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
#include <iomanip>
|
||||
namespace
|
||||
{
|
||||
const unsigned int kVerticalMargin = 16;
|
||||
const unsigned int kHorizontalMargin = 30;
|
||||
const signed int kLineHeight = 20;
|
||||
const signed int kDescriptionVerticalBoxPadding = 5;
|
||||
const signed int kDescriptionHorizontalBoxPadding = 5;
|
||||
const float kVerticalMargin = 16;
|
||||
const float kHorizontalMargin = 30;
|
||||
const float kLineHeight = 20;
|
||||
const float kDescriptionVerticalBoxPadding = 5;
|
||||
const float kDescriptionHorizontalBoxPadding = 5;
|
||||
}
|
||||
|
||||
hgeParticleSystem* DeckMenu::stars = NULL;
|
||||
@@ -60,7 +60,7 @@ fontId(fontId) {
|
||||
avatarX = 230;
|
||||
avatarY = 8;
|
||||
|
||||
int scrollerWidth = 80;
|
||||
float scrollerWidth = 80;
|
||||
|
||||
scroller = NEW TextScroller(Fonts::MAIN_FONT, 40 , 230, scrollerWidth, 100, 1, 1);
|
||||
|
||||
@@ -103,7 +103,7 @@ void DeckMenu::initMenuItems()
|
||||
float sY = mY + kVerticalMargin;
|
||||
for (int i = startId; i < startId + mCount; ++i) {
|
||||
DeckMenuItem *menuItem = static_cast<DeckMenuItem *> (mObjects[i]);
|
||||
int width = menuItem->GetWidth();
|
||||
float width = menuItem->GetWidth();
|
||||
if (mWidth < width) mWidth = width;
|
||||
}
|
||||
titleWidth = titleFont->GetStringWidth(title.c_str());
|
||||
@@ -150,8 +150,8 @@ void DeckMenu::Render()
|
||||
// display the avatar image
|
||||
if ( currentMenuItem->imageFilename.size() > 0 )
|
||||
{
|
||||
JQuad * quad = resources.RetrieveTempQuad( currentMenuItem->imageFilename, TEXTURE_SUB_AVATAR );
|
||||
if (quad)
|
||||
JQuad * quad = resources.RetrieveTempQuad( currentMenuItem->imageFilename, TEXTURE_SUB_AVATAR );
|
||||
if (quad)
|
||||
renderer->RenderQuad(quad, avatarX, avatarY);
|
||||
}
|
||||
// fill in the description part of the screen
|
||||
@@ -194,7 +194,7 @@ void DeckMenu::Update(float dt){
|
||||
stars->Update(dt);
|
||||
selectionT += 3*dt;
|
||||
selectionY += (selectionTargetY - selectionY) * 8 * dt;
|
||||
stars->MoveTo( 40 + ((mWidth-2*kHorizontalMargin)*(1+cos(selectionT))/2), selectionY + 5 * cos(selectionT*2.35) + kLineHeight / 2 - kLineHeight * startId);
|
||||
stars->MoveTo( 40 + ((mWidth-2*kHorizontalMargin)*(1+cos(selectionT))/2), selectionY + 5 * cos(selectionT*2.35f) + kLineHeight / 2 - kLineHeight * startId);
|
||||
if (timeOpen < 0) {
|
||||
timeOpen += dt * 10;
|
||||
if (timeOpen >= 0) { timeOpen = 0; closed = true; stars->FireAt(mX, mY); }
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "Translate.h"
|
||||
#include "WResourceManager.h"
|
||||
|
||||
DeckMenuItem::DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, int x, int y, bool hasFocus, bool autoTranslate, DeckMetaData *deckMetaData): JGuiObject(id), parent(_parent), fontId(fontId), mX(x), mY(y)
|
||||
DeckMenuItem::DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus, bool autoTranslate, DeckMetaData *deckMetaData): JGuiObject(id), parent(_parent), fontId(fontId), mX(x), mY(y)
|
||||
{
|
||||
if (autoTranslate)
|
||||
mText = _(text);
|
||||
@@ -74,13 +74,13 @@ bool DeckMenuItem::ButtonPressed()
|
||||
return true;
|
||||
}
|
||||
|
||||
void DeckMenuItem::Relocate(int x, int y)
|
||||
void DeckMenuItem::Relocate(float x, float y)
|
||||
{
|
||||
mX = x;
|
||||
mY = y;
|
||||
}
|
||||
|
||||
int DeckMenuItem::GetWidth()
|
||||
float DeckMenuItem::GetWidth()
|
||||
{
|
||||
WFont * mFont = resources.GetWFont(fontId);
|
||||
mFont->SetScale(1.0);
|
||||
|
||||
@@ -317,6 +317,7 @@
|
||||
<ClCompile Include="src\Damage.cpp" />
|
||||
<ClCompile Include="src\DamagerDamaged.cpp" />
|
||||
<ClCompile Include="src\DeckDataWrapper.cpp" />
|
||||
<ClCompile Include="src\DeckEditorMenu.cpp" />
|
||||
<ClCompile Include="src\DeckManager.cpp" />
|
||||
<ClCompile Include="src\DeckMenu.cpp" />
|
||||
<ClCompile Include="src\DeckMenuItem.cpp" />
|
||||
@@ -448,7 +449,9 @@
|
||||
<ClInclude Include="include\DamagerDamaged.h" />
|
||||
<ClInclude Include="include\DebugRoutines.h" />
|
||||
<ClInclude Include="include\DeckDataWrapper.h" />
|
||||
<ClInclude Include="include\DeckEditorMenu.h" />
|
||||
<ClInclude Include="include\DeckManager.h" />
|
||||
<ClInclude Include="include\DeckMenuItem.h" />
|
||||
<ClInclude Include="include\DeckMetaData.h" />
|
||||
<ClInclude Include="include\DeckStats.h" />
|
||||
<ClInclude Include="include\DuelLayers.h" />
|
||||
|
||||
Reference in New Issue
Block a user