Added a config file and implemented code for it
This commit is contained in:
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
[Debug]
|
||||||
|
SkipStory=0
|
||||||
Executable
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#ifndef ConfigFile_h__
|
||||||
|
#define ConfigFile_h__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <boost/property_tree/ptree.hpp>
|
||||||
|
#include <boost/property_tree/ini_parser.hpp>
|
||||||
|
|
||||||
|
#include "ResourceManager.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
class ConfigFile : public Resource
|
||||||
|
{
|
||||||
|
friend class ResourceManager;
|
||||||
|
|
||||||
|
private:
|
||||||
|
ConfigFile(std::string path);
|
||||||
|
|
||||||
|
public:
|
||||||
|
template <typename T>
|
||||||
|
T GetValue(std::string key)
|
||||||
|
{
|
||||||
|
std::cout << m_ptree.get<T>(key) << std::endl;
|
||||||
|
return m_ptree.get<T>(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
boost::property_tree::ptree m_ptree;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif // ConfigFile_h__
|
||||||
+10
-1
@@ -32,6 +32,7 @@
|
|||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "CTransform.h"
|
#include "CTransform.h"
|
||||||
#include "CTemplate.h"
|
#include "CTemplate.h"
|
||||||
|
#include "Core/ConfigFile.h"
|
||||||
#include "Core/EventBroker.h"
|
#include "Core/EventBroker.h"
|
||||||
#include "Rendering/CModel.h"
|
#include "Rendering/CModel.h"
|
||||||
#include "Rendering/CSprite.h"
|
#include "Rendering/CSprite.h"
|
||||||
@@ -94,7 +95,15 @@ public:
|
|||||||
m_FrameStack = new GUI::Frame(m_EventBroker.get());
|
m_FrameStack = new GUI::Frame(m_EventBroker.get());
|
||||||
m_FrameStack->Width = 675;
|
m_FrameStack->Width = 675;
|
||||||
m_FrameStack->Height = 1080;
|
m_FrameStack->Height = 1080;
|
||||||
auto menu = new GUI::MainMenu(m_FrameStack, "MainMenu");
|
|
||||||
|
if (ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<int>("Story.Skip") == 1) {
|
||||||
|
Events::GameStart e;
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
|
auto hud = new GUI::HUD(m_FrameStack, "HUD");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
auto menu = new GUI::MainMenu(m_FrameStack, "MainMenu");
|
||||||
|
}
|
||||||
|
|
||||||
m_InputManager = std::make_shared<InputManager>(m_Renderer->Window(), m_EventBroker);
|
m_InputManager = std::make_shared<InputManager>(m_Renderer->Window(), m_EventBroker);
|
||||||
|
|
||||||
|
|||||||
Executable
+7
@@ -0,0 +1,7 @@
|
|||||||
|
#include "PrecompiledHeader.h"
|
||||||
|
#include "Core/ConfigFile.h"
|
||||||
|
|
||||||
|
dd::ConfigFile::ConfigFile(std::string path)
|
||||||
|
{
|
||||||
|
boost::property_tree::ini_parser::read_ini(path, m_ptree);
|
||||||
|
}
|
||||||
@@ -322,7 +322,7 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ballComponent->Combo = 56;
|
ballComponent->Combo = 0;
|
||||||
if (!ballComponent->Waiting) {
|
if (!ballComponent->Waiting) {
|
||||||
if (m_InkBlaster) {
|
if (m_InkBlaster) {
|
||||||
if (!m_InkAttached) {
|
if (!m_InkAttached) {
|
||||||
|
|||||||
Reference in New Issue
Block a user