WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
Game.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <string>
5#include "GameFolder.h"
6
7namespace core { class GameDatabase; }
8
9#define GAMEDIRECTORY core::Game::instance().folder()
10#define GAMEDATABASE core::Game::instance().database()
11
12namespace core
13{
18 class Game
19 {
20 public:
22 static Game& instance()
23 {
24 static Game s_instance;
25 return s_instance;
26 }
27
29 void init(std::unique_ptr<core::GameFolder> folder, std::unique_ptr<core::GameDatabase> db);
30
32 bool initDone() { return (m_db != nullptr) && (m_folder != nullptr); }
33
35 void addCustomFiles(const std::string& path, bool bypassOriginalFiles);
36
39
40 void setConfigFolder(const std::string& folder) { m_configFolder = folder; }
41 std::string configFolder() { return m_configFolder; }
42
43 Game(const Game&) = delete;
44 Game& operator=(const Game&) = delete;
45
46 private:
49
50 std::unique_ptr<core::GameFolder> m_folder;
51 std::unique_ptr<core::GameDatabase> m_db;
52
53 std::string m_configFolder;
54 };
55}
Abstract base for game data folder backends (CASC, loose files, etc.).
Definition GameFolder.h:28
Singleton entry point for the game data layer.
Definition Game.h:19
std::unique_ptr< core::GameFolder > m_folder
Definition Game.h:50
std::string m_configFolder
Definition Game.h:53
static Game & instance()
Access the singleton instance (Meyers singleton).
Definition Game.h:22
Game(const Game &)=delete
std::unique_ptr< core::GameDatabase > m_db
Definition Game.h:51
Game & operator=(const Game &)=delete
core::GameFolder & folder()
Definition Game.h:37
bool initDone()
True once both the folder and database have been set.
Definition Game.h:32
void init(std::unique_ptr< core::GameFolder > folder, std::unique_ptr< core::GameDatabase > db)
Initialise with the given folder and database backends.
Definition Game.cpp:7
core::GameDatabase & database()
Definition Game.h:38
void setConfigFolder(const std::string &folder)
Definition Game.h:40
std::string configFolder()
Definition Game.h:41
void addCustomFiles(const std::string &path, bool bypassOriginalFiles)
Overlay custom loose files on top of the game archive.
Definition Game.cpp:15
Common string utility functions (split, case-insensitive search, etc.).
Definition GameLoader.h:11