* New title with the moving W.
This commit is contained in:
jean.chalard
2008-11-17 16:51:26 +00:00
parent 79288babdd
commit 54c4524e85
+22 -11
View File
@@ -3,6 +3,7 @@
#include <JGui.h> #include <JGui.h>
#include <dirent.h> #include <dirent.h>
#include <math.h>
#include "GameState.h" #include "GameState.h"
#include "MenuItem.h" #include "MenuItem.h"
@@ -32,7 +33,9 @@ class GameStateMenu: public GameState, public JGuiListener
JQuad * mIcons[10]; JQuad * mIcons[10];
JTexture * mIconsTexture; JTexture * mIconsTexture;
JTexture * bgTexture; JTexture * bgTexture;
JTexture * movingWTexture;
JQuad * mBg; JQuad * mBg;
JQuad * mMovingW;
float mCreditsYPos; float mCreditsYPos;
int currentState; int currentState;
JMusic * bgMusic; JMusic * bgMusic;
@@ -45,6 +48,7 @@ class GameStateMenu: public GameState, public JGuiListener
char mCurrentSetFileName[512]; char mCurrentSetFileName[512];
int mReadConf; int mReadConf;
float timeIndex;
public: public:
@@ -54,6 +58,7 @@ class GameStateMenu: public GameState, public JGuiListener
subMenuController = NULL; subMenuController = NULL;
mIconsTexture = NULL; mIconsTexture = NULL;
bgMusic = NULL; bgMusic = NULL;
timeIndex = 0;
} }
virtual ~GameStateMenu() virtual ~GameStateMenu()
@@ -75,8 +80,11 @@ class GameStateMenu: public GameState, public JGuiListener
mIconsTexture = JRenderer::GetInstance()->LoadTexture("graphics/menuicons.png", TEX_TYPE_USE_VRAM); mIconsTexture = JRenderer::GetInstance()->LoadTexture("graphics/menuicons.png", TEX_TYPE_USE_VRAM);
bgTexture = JRenderer::GetInstance()->LoadTexture("graphics/menutitle.png", TEX_TYPE_USE_VRAM); bgTexture = JRenderer::GetInstance()->LoadTexture("graphics/menutitle.png", TEX_TYPE_USE_VRAM);
mBg = NEW JQuad(bgTexture, 10, 0, 220, 80); // Create background quad for rendering. movingWTexture = JRenderer::GetInstance()->LoadTexture("graphics/movingW.png", TEX_TYPE_USE_VRAM);
mBg->SetHotSpot(105,32); mBg = NEW JQuad(bgTexture, 0, 0, 256, 167); // Create background quad for rendering.
mMovingW = NEW JQuad(movingWTexture, 2, 2, 84, 62);
mBg->SetHotSpot(105,50);
mMovingW->SetHotSpot(72,16);
//load all the icon images //load all the icon images
int n = 0; int n = 0;
for (int i=0;i<5;i++) for (int i=0;i<5;i++)
@@ -97,11 +105,11 @@ class GameStateMenu: public GameState, public JGuiListener
//mGuiController->SetShadingBackground(10, 45, 80, 100, ARGB(255,0,0,0)); //mGuiController->SetShadingBackground(10, 45, 80, 100, ARGB(255,0,0,0));
if (mGuiController) if (mGuiController)
{ {
mGuiController->Add(NEW MenuItem(1, mFont, "Play", 80, SCREEN_HEIGHT/2, mIcons[8], mIcons[9],"graphics/particle1.psi",GameApp::CommonRes->GetQuad("particles"), true)); mGuiController->Add(NEW MenuItem(1, mFont, "Play", 80, 50 + SCREEN_HEIGHT/2, mIcons[8], mIcons[9],"graphics/particle1.psi",GameApp::CommonRes->GetQuad("particles"), true));
mGuiController->Add(NEW MenuItem(2, mFont, "Deck Editor", 160, SCREEN_HEIGHT/2, mIcons[2], mIcons[3],"graphics/particle2.psi",GameApp::CommonRes->GetQuad("particles"))); mGuiController->Add(NEW MenuItem(2, mFont, "Deck Editor", 160, 50 + SCREEN_HEIGHT/2, mIcons[2], mIcons[3],"graphics/particle2.psi",GameApp::CommonRes->GetQuad("particles")));
mGuiController->Add(NEW MenuItem(3, mFont, "Shop", 240, SCREEN_HEIGHT/2, mIcons[0], mIcons[1],"graphics/particle3.psi",GameApp::CommonRes->GetQuad("particles"))); mGuiController->Add(NEW MenuItem(3, mFont, "Shop", 240, 50 + SCREEN_HEIGHT/2, mIcons[0], mIcons[1],"graphics/particle3.psi",GameApp::CommonRes->GetQuad("particles")));
mGuiController->Add(NEW MenuItem(4, mFont, "Options", 320, SCREEN_HEIGHT/2, mIcons[6], mIcons[7],"graphics/particle4.psi",GameApp::CommonRes->GetQuad("particles"))); mGuiController->Add(NEW MenuItem(4, mFont, "Options", 320, 50 + SCREEN_HEIGHT/2, mIcons[6], mIcons[7],"graphics/particle4.psi",GameApp::CommonRes->GetQuad("particles")));
mGuiController->Add(NEW MenuItem(5, mFont, "Exit", 400, SCREEN_HEIGHT/2, mIcons[4], mIcons[5],"graphics/particle5.psi",GameApp::CommonRes->GetQuad("particles"))); mGuiController->Add(NEW MenuItem(5, mFont, "Exit", 400, 50 + SCREEN_HEIGHT/2, mIcons[4], mIcons[5],"graphics/particle5.psi",GameApp::CommonRes->GetQuad("particles")));
} }
@@ -130,6 +138,7 @@ class GameStateMenu: public GameState, public JGuiListener
} }
if (mBg) delete mBg; if (mBg) delete mBg;
if (mMovingW) delete mMovingW;
SAFE_DELETE (bgMusic); SAFE_DELETE (bgMusic);
} }
@@ -195,6 +204,7 @@ class GameStateMenu: public GameState, public JGuiListener
JSoundSystem::GetInstance()->SetVolume(mVolume/2); JSoundSystem::GetInstance()->SetVolume(mVolume/2);
} }
timeIndex += dt * 2;
if (currentState == STATE_LOADING_CARDS){ if (currentState == STATE_LOADING_CARDS){
if (mReadConf){ if (mReadConf){
mParent->collection->load(mCurrentSetFileName, mCurrentSetName); mParent->collection->load(mCurrentSetFileName, mCurrentSetName);
@@ -317,16 +327,17 @@ class GameStateMenu: public GameState, public JGuiListener
PIXEL_TYPE colors[] = PIXEL_TYPE colors[] =
{ {
ARGB(255,17,17,17), ARGB(255, 3, 2, 0),
ARGB(255,17,17,17), ARGB(255, 8, 3, 0),
ARGB(255,62,62,62), ARGB(255,21,12, 0),
ARGB(255,62,62,62) ARGB(255,50,34, 0)
}; };
renderer->FillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,colors); renderer->FillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,colors);
renderer->RenderQuad(mBg, SCREEN_WIDTH/2, 50); renderer->RenderQuad(mBg, SCREEN_WIDTH/2, 50);
renderer->RenderQuad(mMovingW, SCREEN_WIDTH/2 - 10, 55, cos(timeIndex)/2.5 - M_PI/3 - 0.1);
if (mGuiController!=NULL) if (mGuiController!=NULL)
mGuiController->Render(); mGuiController->Render();