GameStateEnd.hpp
上传用户:zhj2929
上传日期:2022-07-23
资源大小:28772k
文件大小:2k
- #ifndef _GAME_STATES_HELP_H_
- #define _GAME_STATES_HELP_H_
- #include "GameState.h"
- class GameStateEnd:public GameState
- {
- private:
- JTexture* bgTexture;//背景图片
- JQuad* mBg;
- int i;
- public:
- GameStateEnd(GameApp* app): GameState(app)
- {
- bgTexture = NULL;
- mBg = NULL;
- }
- virtual ~GameStateEnd()
- {
- }
- virtual void Create()
- {
- mEngine->LoadMP3("music/ending.mp3");
- if(i==1)
- {
- bgTexture = mEngine->LoadTexture("backgroud/end1.png", true);
- }
- else if(i==2)
- {
- bgTexture = mEngine->LoadTexture("backgroud/end2.png", true);
- }
- else if(i==3)
- {
- bgTexture = mEngine->LoadTexture("backgroud/end3.png", true);
- }
- else if(i==4)
- {
- bgTexture = mEngine->LoadTexture("backgroud/end4.png", true);
- }
- mBg = new JQuad(bgTexture, 0.0f, 0.0f, GAMESCREEN_WIDTH,GAMESCREEN_HEIGHT);
- }
-
- virtual void Destroy()
- {
- if (bgTexture)
- mEngine->FreeTexture(bgTexture);
- if (mBg) delete mBg;
- }
-
- virtual void Start()
- {
- mEngine->PlayMP3();
- i=1;
- }
- virtual void End()
- {
- mEngine->EnableVSync(false);
- mEngine->StopMP3();
- mEngine->FreeMP3();
- }
- virtual void Update()
- {
- if (mEngine->GetButtonClick(PSP_CTRL_START))
- {
- mApp->SetNextState(GAME_STATE_SPLASH);
- return;
- }
- }
- virtual void Render()
- {
- mEngine->ClearScreen(ARGB(255,255,255,255));
-
- //背景的渲染
- mEngine->RenderQuad(mBg, 0.0f, 0.0f);
- }
- virtual void setI(int j)
- {
- i=j;
- }
- };
- #endif