65 lines
1.1 KiB
C++
65 lines
1.1 KiB
C++
/*
|
|
* Application.hpp
|
|
*
|
|
* Created on: Aug 14, 2012
|
|
* Author: Tibi
|
|
*/
|
|
|
|
#ifndef APPLICATION_HPP_
|
|
#define APPLICATION_HPP_
|
|
|
|
#include <SFML/System.hpp>
|
|
#include <SFML/Window.hpp>
|
|
#include <SFML/Graphics.hpp>
|
|
#include "Logic/TetrisGame.h"
|
|
#include <vector>
|
|
|
|
class Application {
|
|
|
|
private:
|
|
|
|
sf::RenderWindow mainWindow;
|
|
TetrisGame game;
|
|
sf::Time elapsed;
|
|
|
|
sf::Texture background_texture;
|
|
sf::Font font;
|
|
|
|
bool paused;
|
|
|
|
protected:
|
|
|
|
volatile bool stop_flag;
|
|
|
|
// Main application parts
|
|
virtual bool initialize();
|
|
virtual void onMainWindowEvent(sf::Event&);
|
|
virtual void onStart();
|
|
virtual void onLogicUpdate(sf::Time&);
|
|
virtual void onRender(sf::Time&);
|
|
virtual void dispose();
|
|
|
|
// Events
|
|
virtual void onKeyDown(sf::Event&);
|
|
virtual void onResized(sf::Event&);
|
|
|
|
private:
|
|
// Draw
|
|
void drawBackground();
|
|
void drawTetrisGridBackground();
|
|
void drawTetrisGrid();
|
|
void drawNextPieceBackground();
|
|
void drawNextPiece();
|
|
void drawText();
|
|
|
|
public:
|
|
Application();
|
|
|
|
virtual int run();
|
|
virtual void stop();
|
|
|
|
virtual ~Application() { }
|
|
};
|
|
|
|
#endif /* APPLICATION_HPP_ */
|