2dkg/2dkg_zad5/2dgk_zad5/KGame.h
2022-01-20 08:52:14 +01:00

60 lines
1.5 KiB
C++

#pragma once
#include <memory>
#include "KTexture.h"
#include <vector>
#include <SDL_render.h>
#include "Constants.h"
#include "KFont.h"
#include "KInput.h"
#include "KSettings.h"
#include "Utils.h"
namespace KapitanGame {
class KExit;
class KSolid;
class KGame
{
public:
KGame();
~KGame();
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<KDrawable>, Utils::PairHash> BackgroundLayers[Constants::BG_LAYER_COUNT];
std::unordered_map<std::pair<int, int>, std::shared_ptr<KDrawable>, Utils::PairHash> ForegroundLayers[Constants::FG_LAYER_COUNT];
std::unordered_map<std::pair<int, int>, std::shared_ptr<KSolid>, 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;
SDL_Rect TileClips[Constants::TILE_COUNT];
KInput Input;
uint32_t Time;
uint32_t PreviousTime;
SDL_FRect Map;
std::weak_ptr<KSolid> Exit;
KSettings Settings;
bool SettingsTextTextureDirty = true;
bool LoadLevel();
bool LoadMedia();
int LvlCounter = 1;
bool Playing = true;
uint32_t RestartTick = -1;
};
}