Files
2dkg/2dgk_7/2dgk_7/KGame.h
2021-12-13 22:56:37 +01:00

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 };
};
}