2012-09-09 20:50:15 +00:00
|
|
|
/*
|
|
|
|
* Game.h
|
|
|
|
*
|
|
|
|
* Created on: 05.07.2012
|
|
|
|
* Author: Felix
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DG_GAME_H_
|
|
|
|
#define DG_GAME_H_
|
|
|
|
|
2013-06-25 15:44:40 +00:00
|
|
|
#include <TGUI/TGUI.hpp>
|
|
|
|
|
2013-04-29 14:49:16 +00:00
|
|
|
#include "generator/Generator.h"
|
2013-04-28 16:11:39 +00:00
|
|
|
#include "Pathfinder.h"
|
2012-12-22 13:56:17 +00:00
|
|
|
#include "World.h"
|
2012-09-09 20:50:15 +00:00
|
|
|
|
2012-09-14 18:39:56 +00:00
|
|
|
class Player;
|
|
|
|
|
2012-09-09 20:50:15 +00:00
|
|
|
/*
|
2013-04-04 21:54:17 +00:00
|
|
|
* High level game managing, including game loop, input, high
|
|
|
|
* level rendering, and general class handling
|
2012-09-09 20:50:15 +00:00
|
|
|
*/
|
2012-12-22 00:14:30 +00:00
|
|
|
class Game : private sf::NonCopyable {
|
2012-09-09 20:50:15 +00:00
|
|
|
public:
|
2013-06-25 15:44:40 +00:00
|
|
|
explicit Game(tgui::Window& window);
|
2012-09-09 20:50:15 +00:00
|
|
|
~Game();
|
|
|
|
|
|
|
|
void loop();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void input();
|
|
|
|
void render();
|
|
|
|
|
|
|
|
void keyDown(const sf::Event& event);
|
|
|
|
void keyUp(const sf::Event& event);
|
2012-12-24 00:14:22 +00:00
|
|
|
void mouseDown(const sf::Event& event);
|
2012-09-09 20:50:15 +00:00
|
|
|
void mouseUp(const sf::Event& event);
|
|
|
|
|
2013-08-07 15:39:43 +00:00
|
|
|
Vector2<float> convertCoordinates(int x, int y);
|
2013-07-06 11:38:15 +00:00
|
|
|
void updateGui();
|
2013-08-18 11:27:32 +00:00
|
|
|
void initPlayer();
|
2012-09-09 20:50:15 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static const int FPS_GOAL;
|
|
|
|
|
2013-06-25 15:44:40 +00:00
|
|
|
tgui::Window& mWindow;
|
2012-09-09 20:50:15 +00:00
|
|
|
sf::Clock mClock;
|
2013-06-25 15:44:40 +00:00
|
|
|
sf::View mWorldView;
|
2013-07-06 12:37:16 +00:00
|
|
|
tgui::Label* mHealth;
|
2013-06-25 15:44:40 +00:00
|
|
|
tgui::Label* mAmmo;
|
2013-07-06 11:38:15 +00:00
|
|
|
tgui::Label* mCurrentWeapon;
|
2013-07-10 21:41:24 +00:00
|
|
|
tgui::Label* mLeftGadget;
|
|
|
|
tgui::Label* mRightGadget;
|
2013-08-18 12:02:43 +00:00
|
|
|
tgui::Label* mPickupInstruction;
|
2013-08-18 15:19:34 +00:00
|
|
|
std::shared_ptr<sf::Texture> mCrosshairTexture;
|
|
|
|
sf::Sprite mCrosshair;
|
2012-09-09 20:50:15 +00:00
|
|
|
|
2012-12-22 13:56:17 +00:00
|
|
|
World mWorld;
|
2013-04-28 16:11:39 +00:00
|
|
|
Pathfinder mPathfinder;
|
2013-04-29 14:49:16 +00:00
|
|
|
Generator mGenerator;
|
2012-12-22 13:56:17 +00:00
|
|
|
std::shared_ptr<Player> mPlayer;
|
2012-09-09 20:50:15 +00:00
|
|
|
|
|
|
|
bool mQuit;
|
|
|
|
bool mPaused;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* DG_GAME_H_ */
|