Skip to content

Instantly share code, notes, and snippets.

View PoetaKodu's full-sized avatar

Paweł Syska PoetaKodu

View GitHub Profile
class IPawn
: public IActor
{
public:
/* Konstruktor pionka.
*/
explicit IPawn(IPawnController *controller);
/* Destruktor pionka. Dba o to, by kontroler został prawidłowo usunięty.
*/
class IPawnController
{
public:
/* Konstruktor klasy kontrolera pionka */
IPawnController();
/* Destruktor klasy kontrolera pionka */
virtual ~IPawnController();
/* Funkcja będzie uaktualniała wszystko
co związane z ruchem pionka. Prezentacje pionka
class Resources
{
public:
Resources()
: m_window(new sf::RenderWindow(sf::VideoMode(800, 600, 32), "Okienko"))
{
}
~Resources()
{
if(m_window)
void draw_all(sf::RenderWindow &window, std::vector<sf::Sprite*> &sprites)
{
for(auto *sprite : sprites)
window.draw(*sprite);
}
int main()
{
sf::RenderWindow window;
std::vector <sf::Sprite*> gameSprites;
// troche kodu
sf::RenderWindow window;
float gameSpeed = 1.0f;
int main()
{
// kod.
}
class IActor
{
public:
/* Konstruktor aktora.
*/
inline IActor()
: m_rotation(0)
{
}
//////////////////////////////////////////////////////////////////////
CTextureManager::CTextureManager()
{
}
//////////////////////////////////////////////////////////////////////
CTextureManager::~CTextureManager()
{
/* Usuwamy każdą teksturę. */
for (auto textureData : m_textures)
/* Statyczna metoda, ktora laduje teksture do pamieci i ustawia ją pod kluczem
podanym w [textureName]. Jeśli textura o tej nazwie już istniała, to zamieniamy ją.
Robimy to w taki sposób, by nie "psuć" spritów, które już korzystają z tamtej tekstury.
*/
static sf::Texture* Load(const std::string &textureName, const std::string &texturePath);
/* Usuwa teksture o podanej nazwie [textureName] z pamięci.
*/
static bool Unload(const std::string &textureName);
#include <unordered_map>
/* Klasa do zarządzania teksturami
*/
class CTextureManager final
{
public:
/* Typedef dla umilenia życia. */
typedef std::unordered_map<std::string, sf::Texture *> TTexturesUM;
#include "Include/Game.hpp"
int main()
{
auto &game = CGame::Instance();
game.Run();
return 0;
}