55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
#pragma once
|
|
#include <SFML/System/Thread.hpp>
|
|
#include <SFML/Window/Event.hpp>
|
|
#include <SFML/Graphics.hpp>
|
|
#include <SFML/System/Sleep.hpp>
|
|
#include <SFML/System/Time.hpp>
|
|
#include "Utils.hpp"
|
|
|
|
class Board {
|
|
|
|
private:
|
|
|
|
// Wskaźnik na okno.
|
|
sf::RenderWindow* window;
|
|
sf::VideoMode videoMode;
|
|
|
|
sf::Texture boardTexture;
|
|
sf::Sprite boardSprite;
|
|
|
|
// void _thread_wait_for_str_cin(bool &done, std::string &text);
|
|
// void _thread_wait_for_str_getline(bool& done, std::string& text);
|
|
|
|
public:
|
|
|
|
// Aby przekazać je do Engine
|
|
sf::Event ev;
|
|
sf::View view;
|
|
|
|
// Konstruktor, destruktor
|
|
void closeWindow();
|
|
|
|
// Akcesor
|
|
bool running() const;
|
|
|
|
// Metody klasy
|
|
void pollEvents();
|
|
void update();
|
|
void render();
|
|
void updateAndRender();
|
|
void run();
|
|
bool manualUpdate();
|
|
sf::Event lastEvent;
|
|
|
|
// Sterowanie oknem
|
|
void initVariables();
|
|
void initWindow();
|
|
void initBoard();
|
|
void initView();
|
|
void smartSleep(int millis);
|
|
void handleResize(unsigned int newWidth, unsigned int newHeight);
|
|
std::string asyncStrCin();
|
|
std::string asyncStrGetline();
|
|
void selectAField(short &pickStatus, short &field);
|
|
|
|
}; |