Newer
Older
Import / applications / HighwayDash / ports / Game / States / GameState.h
//  BlockyFroggy
//  Copyright © 2017 John Ryland.
//  All rights reserved.
#pragma once
#ifndef GAME_STATE_H
#define GAME_STATE_H


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


class GameState : public BaseGameState
{
public:
  const char* getName() const override { return "GameState"; }
  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 elapsed) override;
  bool update(GameUi::UpdateState& state, float elapsed) override;
  bool touchesChanged(int x, int y, TouchState ts) override;

private:
  void notifyPlayerGameOver();

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

  // Game logic
  GameSim::GameLogic  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