59 lines
1.3 KiB
C++
59 lines
1.3 KiB
C++
#pragma once
|
|
#include <memory>
|
|
|
|
#include "KTexture.h"
|
|
#include <vector>
|
|
#include <SDL_render.h>
|
|
|
|
#include "KFont.h"
|
|
#include "KInput.h"
|
|
#include "Utils.h"
|
|
|
|
|
|
namespace KapitanGame {
|
|
class KExit;
|
|
class KObject;
|
|
|
|
class KGame
|
|
{
|
|
public:
|
|
KGame();
|
|
~KGame();
|
|
void Win(KPlayer player);
|
|
KGame(const KGame& other) = delete;
|
|
KGame(KGame&& other) noexcept = delete;
|
|
KGame& operator=(const KGame& other) = delete;
|
|
KGame& operator=(KGame&& other) noexcept = delete;
|
|
int Run(int argc, char* args[]);
|
|
private:
|
|
SDL_Window* Window = nullptr;
|
|
|
|
SDL_Renderer* Renderer = nullptr;
|
|
|
|
std::unordered_map<std::pair<int, int>, std::shared_ptr<KObject>, Utils::PairHash> Objects;
|
|
std::vector<std::shared_ptr<KPawn>> Pawns;
|
|
std::vector<std::shared_ptr<KPlayerController>> PlayerControllers;
|
|
std::unordered_map<std::string, KTexture> Textures;
|
|
std::unordered_map<std::string, KFont> Fonts;
|
|
std::vector<KVector2D> FreePositions;
|
|
KInput Input;
|
|
uint32_t Time;
|
|
uint32_t PreviousTime;
|
|
SDL_FRect Map;
|
|
bool CollisionEnabled = true;
|
|
bool ShowWinner = false;
|
|
std::weak_ptr<KObject> Exit;
|
|
|
|
bool LoadLevel();
|
|
void LoadPlayerPawnsAndExit();
|
|
bool LoadMedia();
|
|
|
|
int LvlCounter = 1;
|
|
bool Playing = true;
|
|
uint32_t RestartTick = -1;
|
|
short Scores[static_cast<int>(KPlayer::Player2) + 1] = { 0,0 };
|
|
};
|
|
}
|
|
|
|
|