removed obsolete class
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
#include "wiResourceManager.h"
|
||||
#include "wiCVars.h"
|
||||
#include "wiColor.h"
|
||||
#include "wiFadeManager.h"
|
||||
#include "wiWindowRegistration.h"
|
||||
@@ -32,7 +31,6 @@ public:
|
||||
void activateComponent(RenderableComponent* component, int fadeFrames = 0, const wiColor& fadeColor = wiColor(0,0,0,255));
|
||||
RenderableComponent* getActiveComponent(){ return activeComponent; }
|
||||
|
||||
wiCVars Props;
|
||||
wiResourceManager Content;
|
||||
|
||||
void setFrameSkip(bool value){ frameskip = value; }
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "wiRenderTarget.h"
|
||||
#include "wiDepthTarget.h"
|
||||
#include "wiResourceManager.h"
|
||||
#include "wiCVars.h"
|
||||
|
||||
class RenderableComponent
|
||||
{
|
||||
@@ -13,7 +12,6 @@ protected:
|
||||
// create resolution dependant resources
|
||||
virtual void ResizeBuffers() {}
|
||||
public:
|
||||
wiCVars Params;
|
||||
wiResourceManager Content;
|
||||
|
||||
std::function<void()> onStart;
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "wiTimer.h"
|
||||
#include "wiHelper.h"
|
||||
#include "wiInputManager.h"
|
||||
#include "wiCVars.h"
|
||||
#include "wiTextureHelper.h"
|
||||
#include "wiRandom.h"
|
||||
#include "wiColor.h"
|
||||
|
||||
@@ -314,7 +314,6 @@
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)wiColor.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)wiCpuInfo.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)wiCube.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)wiCVars.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)wiDepthTarget.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)wiDirectInput.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)wiEmittedParticle.h" />
|
||||
@@ -664,7 +663,6 @@
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)wiColor.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)wiCpuInfo.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)wiCube.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)wiCVars.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)wiDepthTarget.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)wiDirectInput.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)wiEmittedParticle.cpp" />
|
||||
|
||||
@@ -963,9 +963,6 @@
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)wiBULLET.h">
|
||||
<Filter>ENGINE\Physics</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)wiCVars.h">
|
||||
<Filter>ENGINE\Helpers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)wiCube.h">
|
||||
<Filter>ENGINE\Graphics</Filter>
|
||||
</ClInclude>
|
||||
@@ -1838,9 +1835,6 @@
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)wiBULLET.cpp">
|
||||
<Filter>ENGINE\Physics</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)wiCVars.cpp">
|
||||
<Filter>ENGINE\Helpers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)wiCube.cpp">
|
||||
<Filter>ENGINE\Graphics</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
#include "wiCVars.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
wiCVars* wiCVars::globalVars = nullptr;
|
||||
|
||||
wiCVars::wiCVars()
|
||||
{
|
||||
wiThreadSafeManager();
|
||||
}
|
||||
wiCVars::~wiCVars()
|
||||
{
|
||||
CleanUp();
|
||||
}
|
||||
wiCVars* wiCVars::GetGlobal()
|
||||
{
|
||||
if (globalVars == nullptr)
|
||||
{
|
||||
LOCK_STATIC();
|
||||
if (globalVars == nullptr)
|
||||
globalVars = new wiCVars();
|
||||
UNLOCK_STATIC();
|
||||
}
|
||||
return globalVars;
|
||||
}
|
||||
|
||||
|
||||
const wiCVars::Variable wiCVars::get(const std::string& name)
|
||||
{
|
||||
container::iterator it = variables.find(name);
|
||||
if(it!=variables.end())
|
||||
return it->second;
|
||||
else return Variable::Invalid();
|
||||
}
|
||||
bool wiCVars::set(const std::string& name, const std::string& value)
|
||||
{
|
||||
if (!get(name).isValid())
|
||||
return false;
|
||||
|
||||
LOCK();
|
||||
container::iterator it = variables.find(name);
|
||||
if (it != variables.end())
|
||||
variables[name].data = value;
|
||||
UNLOCK();
|
||||
|
||||
return true;
|
||||
}
|
||||
bool wiCVars::add(const std::string& name, const std::string& value, Data_Type newType)
|
||||
{
|
||||
if(get(name).isValid())
|
||||
return false;
|
||||
LOCK();
|
||||
variables.insert< pair<string,Variable> >( pair<string,Variable>(name,Variable(value,newType)) );
|
||||
UNLOCK();
|
||||
return true;
|
||||
}
|
||||
bool wiCVars::del(const std::string& name)
|
||||
{
|
||||
if (!get(name).isValid())
|
||||
return false;
|
||||
LOCK();
|
||||
variables.erase(name);
|
||||
UNLOCK();
|
||||
return true;
|
||||
}
|
||||
bool wiCVars::CleanUp()
|
||||
{
|
||||
LOCK();
|
||||
variables.clear();
|
||||
UNLOCK();
|
||||
return true;
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
#pragma once
|
||||
#include "CommonInclude.h"
|
||||
#include "wiHelper.h"
|
||||
#include "wiThreadSafeManager.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
class wiCVars : public wiThreadSafeManager
|
||||
{
|
||||
public:
|
||||
enum Data_Type{
|
||||
EMPTY,
|
||||
TEXT,
|
||||
INTEGER,
|
||||
FLOAT,
|
||||
BOOLEAN,
|
||||
CVAR_DATATYPE_COUNT
|
||||
};
|
||||
private:
|
||||
struct Variable{
|
||||
std::string data;
|
||||
Data_Type type;
|
||||
Variable(const std::string& d = "", Data_Type t = TEXT):data(d),type(t){}
|
||||
|
||||
bool isValid() const
|
||||
{
|
||||
return type != EMPTY && !data.empty();
|
||||
}
|
||||
std::string get() const
|
||||
{
|
||||
return data;
|
||||
}
|
||||
int getInt() const
|
||||
{
|
||||
return atoi(data.c_str());
|
||||
}
|
||||
double getFloat() const
|
||||
{
|
||||
return (double)atof(data.c_str());
|
||||
}
|
||||
bool getBool() const
|
||||
{
|
||||
if (atoi(data.c_str()) != 0)
|
||||
return true;
|
||||
if (!wiHelper::toUpper(data).compare("TRUE"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
bool equals(const Variable& other)
|
||||
{
|
||||
if (type != other.type)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case wiCVars::TEXT:
|
||||
return !data.compare(other.data);
|
||||
break;
|
||||
case wiCVars::INTEGER:
|
||||
return getInt() == other.getInt();
|
||||
break;
|
||||
case wiCVars::FLOAT:
|
||||
return abs(getFloat() - other.getFloat()) < DBL_EPSILON;
|
||||
break;
|
||||
case wiCVars::BOOLEAN:
|
||||
return getBool() == other.getBool();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
static Variable Invalid()
|
||||
{
|
||||
return Variable("", EMPTY);
|
||||
}
|
||||
};
|
||||
typedef std::map<std::string,Variable> container;
|
||||
container variables;
|
||||
|
||||
static wiCVars* globalVars;
|
||||
public:
|
||||
wiCVars();
|
||||
~wiCVars();
|
||||
static wiCVars* GetGlobal();
|
||||
|
||||
const Variable get(const std::string& name);
|
||||
bool set(const std::string& name, const std::string& value);
|
||||
bool add(const std::string& name, const std::string& value, Data_Type newType = Data_Type::TEXT);
|
||||
bool del(const std::string& name);
|
||||
bool CleanUp();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user