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{
|
class DeckMenu:public JGuiController{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
int mHeight, mWidth, mX, mY;
|
float mHeight, mWidth, mX, mY;
|
||||||
int titleX, titleY, titleWidth;
|
float titleX, titleY, titleWidth;
|
||||||
int descX, descY, descHeight, descWidth;
|
float descX, descY, descHeight, descWidth;
|
||||||
int statsX, statsY, statsHeight, statsWidth;
|
float statsX, statsY, statsHeight, statsWidth;
|
||||||
int avatarX, avatarY;
|
float avatarX, avatarY;
|
||||||
string backgroundName;
|
string backgroundName;
|
||||||
|
|
||||||
int fontId;
|
int fontId;
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ class DeckMenuItem: public JGuiObject
|
|||||||
string desc;
|
string desc;
|
||||||
DeckMetaData *meta;
|
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();
|
~DeckMenuItem();
|
||||||
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);
|
||||||
@@ -44,7 +44,7 @@ class DeckMenuItem: public JGuiObject
|
|||||||
virtual bool Leaving(JButton key);
|
virtual bool Leaving(JButton key);
|
||||||
virtual bool ButtonPressed();
|
virtual bool ButtonPressed();
|
||||||
virtual ostream& toString(ostream& out) const;
|
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
|
#endif
|
||||||
|
|||||||
@@ -11,11 +11,11 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
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;
|
||||||
const signed int kDescriptionVerticalBoxPadding = 5;
|
const float kDescriptionVerticalBoxPadding = 5;
|
||||||
const signed int kDescriptionHorizontalBoxPadding = 5;
|
const float kDescriptionHorizontalBoxPadding = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
hgeParticleSystem* DeckMenu::stars = NULL;
|
hgeParticleSystem* DeckMenu::stars = NULL;
|
||||||
@@ -60,7 +60,7 @@ fontId(fontId) {
|
|||||||
avatarX = 230;
|
avatarX = 230;
|
||||||
avatarY = 8;
|
avatarY = 8;
|
||||||
|
|
||||||
int scrollerWidth = 80;
|
float scrollerWidth = 80;
|
||||||
|
|
||||||
scroller = NEW TextScroller(Fonts::MAIN_FONT, 40 , 230, scrollerWidth, 100, 1, 1);
|
scroller = NEW TextScroller(Fonts::MAIN_FONT, 40 , 230, scrollerWidth, 100, 1, 1);
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ void DeckMenu::initMenuItems()
|
|||||||
float sY = mY + kVerticalMargin;
|
float sY = mY + kVerticalMargin;
|
||||||
for (int i = startId; i < startId + mCount; ++i) {
|
for (int i = startId; i < startId + mCount; ++i) {
|
||||||
DeckMenuItem *menuItem = static_cast<DeckMenuItem *> (mObjects[i]);
|
DeckMenuItem *menuItem = static_cast<DeckMenuItem *> (mObjects[i]);
|
||||||
int width = menuItem->GetWidth();
|
float width = menuItem->GetWidth();
|
||||||
if (mWidth < width) mWidth = width;
|
if (mWidth < width) mWidth = width;
|
||||||
}
|
}
|
||||||
titleWidth = titleFont->GetStringWidth(title.c_str());
|
titleWidth = titleFont->GetStringWidth(title.c_str());
|
||||||
@@ -150,8 +150,8 @@ void DeckMenu::Render()
|
|||||||
// display the avatar image
|
// display the avatar image
|
||||||
if ( currentMenuItem->imageFilename.size() > 0 )
|
if ( currentMenuItem->imageFilename.size() > 0 )
|
||||||
{
|
{
|
||||||
JQuad * quad = resources.RetrieveTempQuad( currentMenuItem->imageFilename, TEXTURE_SUB_AVATAR );
|
JQuad * quad = resources.RetrieveTempQuad( currentMenuItem->imageFilename, TEXTURE_SUB_AVATAR );
|
||||||
if (quad)
|
if (quad)
|
||||||
renderer->RenderQuad(quad, avatarX, avatarY);
|
renderer->RenderQuad(quad, avatarX, avatarY);
|
||||||
}
|
}
|
||||||
// fill in the description part of the screen
|
// fill in the description part of the screen
|
||||||
@@ -194,7 +194,7 @@ void DeckMenu::Update(float dt){
|
|||||||
stars->Update(dt);
|
stars->Update(dt);
|
||||||
selectionT += 3*dt;
|
selectionT += 3*dt;
|
||||||
selectionY += (selectionTargetY - selectionY) * 8 * 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) {
|
if (timeOpen < 0) {
|
||||||
timeOpen += dt * 10;
|
timeOpen += dt * 10;
|
||||||
if (timeOpen >= 0) { timeOpen = 0; closed = true; stars->FireAt(mX, mY); }
|
if (timeOpen >= 0) { timeOpen = 0; closed = true; stars->FireAt(mX, mY); }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "Translate.h"
|
#include "Translate.h"
|
||||||
#include "WResourceManager.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)
|
if (autoTranslate)
|
||||||
mText = _(text);
|
mText = _(text);
|
||||||
@@ -74,13 +74,13 @@ bool DeckMenuItem::ButtonPressed()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckMenuItem::Relocate(int x, int y)
|
void DeckMenuItem::Relocate(float x, float y)
|
||||||
{
|
{
|
||||||
mX = x;
|
mX = x;
|
||||||
mY = y;
|
mY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DeckMenuItem::GetWidth()
|
float DeckMenuItem::GetWidth()
|
||||||
{
|
{
|
||||||
WFont * mFont = resources.GetWFont(fontId);
|
WFont * mFont = resources.GetWFont(fontId);
|
||||||
mFont->SetScale(1.0);
|
mFont->SetScale(1.0);
|
||||||
|
|||||||
@@ -317,6 +317,7 @@
|
|||||||
<ClCompile Include="src\Damage.cpp" />
|
<ClCompile Include="src\Damage.cpp" />
|
||||||
<ClCompile Include="src\DamagerDamaged.cpp" />
|
<ClCompile Include="src\DamagerDamaged.cpp" />
|
||||||
<ClCompile Include="src\DeckDataWrapper.cpp" />
|
<ClCompile Include="src\DeckDataWrapper.cpp" />
|
||||||
|
<ClCompile Include="src\DeckEditorMenu.cpp" />
|
||||||
<ClCompile Include="src\DeckManager.cpp" />
|
<ClCompile Include="src\DeckManager.cpp" />
|
||||||
<ClCompile Include="src\DeckMenu.cpp" />
|
<ClCompile Include="src\DeckMenu.cpp" />
|
||||||
<ClCompile Include="src\DeckMenuItem.cpp" />
|
<ClCompile Include="src\DeckMenuItem.cpp" />
|
||||||
@@ -448,7 +449,9 @@
|
|||||||
<ClInclude Include="include\DamagerDamaged.h" />
|
<ClInclude Include="include\DamagerDamaged.h" />
|
||||||
<ClInclude Include="include\DebugRoutines.h" />
|
<ClInclude Include="include\DebugRoutines.h" />
|
||||||
<ClInclude Include="include\DeckDataWrapper.h" />
|
<ClInclude Include="include\DeckDataWrapper.h" />
|
||||||
|
<ClInclude Include="include\DeckEditorMenu.h" />
|
||||||
<ClInclude Include="include\DeckManager.h" />
|
<ClInclude Include="include\DeckManager.h" />
|
||||||
|
<ClInclude Include="include\DeckMenuItem.h" />
|
||||||
<ClInclude Include="include\DeckMetaData.h" />
|
<ClInclude Include="include\DeckMetaData.h" />
|
||||||
<ClInclude Include="include\DeckStats.h" />
|
<ClInclude Include="include\DeckStats.h" />
|
||||||
<ClInclude Include="include\DuelLayers.h" />
|
<ClInclude Include="include\DuelLayers.h" />
|
||||||
|
|||||||
Reference in New Issue
Block a user