2020-12-13 13:45:52 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <SFML/Window/Keyboard.hpp>
|
|
|
|
#include "board.h"
|
|
|
|
|
|
|
|
class Application
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit Application();
|
|
|
|
|
2020-12-16 17:13:49 -05:00
|
|
|
// Init game
|
2020-12-18 15:12:28 -05:00
|
|
|
bool init(const std::string& path, int splitting);
|
2020-12-16 17:13:49 -05:00
|
|
|
|
2020-12-14 14:22:52 -05:00
|
|
|
// Launch game
|
2020-12-13 13:45:52 -05:00
|
|
|
void run();
|
2020-12-14 14:22:52 -05:00
|
|
|
|
|
|
|
// Refresh render_window to actual state
|
2020-12-13 13:45:52 -05:00
|
|
|
void draw();
|
2020-12-14 14:22:52 -05:00
|
|
|
|
|
|
|
// Handle keyboard commands
|
|
|
|
void processInput();
|
2020-12-13 13:45:52 -05:00
|
|
|
|
|
|
|
private:
|
2020-12-14 14:22:52 -05:00
|
|
|
// Convert keyboard keys into moving direction
|
2020-12-13 13:45:52 -05:00
|
|
|
DIRECTION getDirection(sf::Keyboard::Key &key) const;
|
|
|
|
|
|
|
|
Board board;
|
|
|
|
sf::RenderWindow render_window;
|
|
|
|
};
|