sliding-puzzle/application.h

30 lines
585 B
C
Raw Normal View History

2020-12-13 13:45:52 -05:00
#pragma once
#include <SFML/Window/Keyboard.hpp>
#include "board.h"
class Application
{
public:
2020-12-20 08:49:24 -05:00
explicit Application(unsigned int window_width, unsigned int window_height);
2020-12-13 13:45:52 -05:00
// Init game
2020-12-18 15:12:28 -05:00
bool init(const std::string& path, int splitting);
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;
};