Newer
Older
Import / applications / HighwayDash / ports / Game / GameState.h
#ifndef GAME_STATE_H
#define GAME_STATE_H


#include "BaseGameState.h"
#include "GameSim.h"


class GameState : public BaseGameState
{
public:
  void Enter(GameGraphics& graphics) override;
  void Exit(GameGraphics& /*graphics*/) override;
  void Draw(GameGraphics& graphics) override;
  float GetTime() override;
  // temp
  void GetPlayerPos(float pos[3]) override;
  void GetCameras(float cameraParams[8], float lightParams[8], float debugCameraParams[8], float a_elapsed) override;
  bool Update(GameUi::DrawItems &items, float a_elapsed) override;
  bool TouchesChanged(int a_x, int a_y, TouchState ts) override;

private:
  void notifyPlayerGameOver();

  // Mouse/Touch state
  bool           m_touchMoving;
  float          m_touchX, m_touchY;

  // Game logic
  Game::GameSim  m_sim;

  // Game state
  uint32_t       m_frame = 0;
  uint32_t       m_score = 0;
  uint32_t       m_nominalScore;
  uint32_t       m_highScore = 0;
  uint32_t       m_restartCountDown = 0;
  float          m_time = 0.0;
  bool           m_isRunning = false;
  bool           m_needReset = false;
};


#endif // GAME_STATE_H