summaryrefslogtreecommitdiff
path: root/application.h
blob: 8f1bb350890e46b7482644f781b2482167980f89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef APPLICATION_H
#define APPLICATION_H

#include <string>

#include <SFML/Window.hpp>
#include "input.h"

class Application {
	private:
		sf::Window* window;
		bool please_quit;
		bool fullscreen;
		
		std::string window_title;
		
	protected:
		void create_window(unsigned int w, unsigned int h, bool fs, const std::string& title);
		void init_window(unsigned int w, unsigned int h, bool fs, const std::string& title);
		
		virtual void event(const sf::Event& e);
		virtual void event_keypress(Key::Code key);
		virtual void event_reshape(int width, int height);
		
		virtual void init() = 0;
		virtual void update() = 0;
		void swap();
	
	public:
		Application();
		virtual ~Application();
		
		void run();
		void quit();
};

#endif