SpelunkyRemake / Game.h
Game.h
Raw
#pragma once
#include "Level.h"
#include "ItemManager.h"
#include "Player.h"
#include "Item.h"
#include "Vector2f.h"
#include "Camera.h"
#include "Hud.h"
#include "SoundEffect.h"
#include "EnemyManager.h"
#include "ParticleManager.h"

class Game
{
public:
	explicit Game( const Window& window );
	Game(const Game& other) = delete;
	Game& operator=(const Game& other) = delete;
	Game(Game&& other) = delete;
	Game& operator=(Game&& other) = delete;
	~Game();

	void Update( float elapsedSec );
	void Draw( ) const;

	// Event handling
	void ProcessKeyDownEvent( const SDL_KeyboardEvent& e );
	void ProcessKeyUpEvent( const SDL_KeyboardEvent& e );
	void ProcessMouseMotionEvent( const SDL_MouseMotionEvent& e );
	void ProcessMouseDownEvent( const SDL_MouseButtonEvent& e );
	void ProcessMouseUpEvent( const SDL_MouseButtonEvent& e );

	static bool DrawDebug;

private:
	// DATA MEMBERS
	const Window m_Window;
	std::vector<SDL_GameController*> m_Controllers;

	Camera m_Camera;
	Hud m_Hud;
	Level m_Level;
	Player m_Player;
	ItemManager m_ItemManager;
	EnemyManager m_EnemyManager;
	ParticleManager m_ParticleManager;

	bool m_EndReached;

	Texture m_CursorTexture;
	Point2f m_MousePos;

	float m_MouseIdleAccu;
	const float m_MouseIdleLimit;

	const float m_CursorSize;
	float m_CursorFadeoutAccu;
	const float m_CursorFadeoutDuration;

	// FUNCTIONS
	void Initialize( );
	void Cleanup( );
	void ClearBackground( ) const;
	void ShowInstructions( ) const;
	void DoCollisionTests( );
	void SetupControllers( );
	void DrawCursor() const;
	void UpdateCursor(float elapsedSec);
};