GameStateHelp.hpp
上传用户:zhj2929
上传日期:2022-07-23
资源大小:28772k
文件大小:1k
源码类别:

游戏引擎

开发平台:

Visual C++

  1. #ifndef _GAME_STATES_HELP_H_
  2. #define _GAME_STATES_HELP_H_
  3. #include "GameState.h"
  4. class GameStateHelp:public GameState
  5. {
  6. private:
  7. JTexture* bgTexture;//背景图片
  8.     JQuad* mBg;
  9. public:
  10. GameStateHelp(GameApp* app): GameState(app) 
  11. {
  12. bgTexture = NULL;
  13. mBg = NULL;
  14. }
  15. virtual ~GameStateHelp() 
  16. {
  17. }
  18. virtual void Create() 
  19. {
  20. mEngine->LoadMP3("music/helpBg.mp3");
  21. bgTexture = mEngine->LoadTexture("backgroud/noteBook.png", true);
  22. mBg = new JQuad(bgTexture, 0.0f, 0.0f, GAMESCREEN_WIDTH,GAMESCREEN_HEIGHT);
  23. }
  24. virtual void Destroy() 
  25. {
  26. if (bgTexture)
  27. mEngine->FreeTexture(bgTexture);
  28. if (mBg) delete mBg;
  29. }
  30. virtual void Start()
  31. {
  32.  mEngine->PlayMP3();
  33. }
  34. virtual void End()
  35. {
  36. mEngine->EnableVSync(false);
  37. mEngine->StopMP3();
  38. mEngine->FreeMP3();
  39. }
  40. virtual void Update()
  41. {
  42. if (mEngine->GetButtonClick(PSP_CTRL_START))
  43. {
  44.            
  45. mApp->LoadGameStateSplash();
  46. mApp->SetNextState(GAME_STATE_SPLASH);
  47. return;
  48. }
  49. }
  50. virtual void Render() 
  51. {
  52. mEngine->ClearScreen(ARGB(255,255,255,255));
  53.    
  54.    //背景的渲染
  55. mEngine->RenderQuad(mBg, 0.0f, 0.0f);
  56. }
  57. };
  58. #endif