mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 04:53:27 +02:00
rename g_config
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <yaml-cpp/yaml.h>
|
||||
|
||||
Configs g_config;
|
||||
Configs g_configs;
|
||||
|
||||
bool Configs::load(const std::string& fileName)
|
||||
{
|
||||
@@ -99,43 +99,43 @@ void Configs::setValue(const std::string &key, bool value)
|
||||
setValue(key,"false");
|
||||
}
|
||||
|
||||
const std::string &Configs::getString(const std::string &key)
|
||||
const std::string &Configs::getString(const std::string &key) const
|
||||
{
|
||||
auto iter = m_confsMap.find(key);
|
||||
if(iter == m_confsMap.end()) {
|
||||
auto it = m_confsMap.find(key);
|
||||
if(it == m_confsMap.end()) {
|
||||
warning("Config value %s not found", key.c_str());
|
||||
static std::string emptystr;
|
||||
return emptystr;
|
||||
}
|
||||
return iter->second;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
float Configs::getFloat(const std::string &key)
|
||||
float Configs::getFloat(const std::string &key) const
|
||||
{
|
||||
auto iter = m_confsMap.find(key);
|
||||
if(iter == m_confsMap.end()) {
|
||||
auto it = m_confsMap.find(key);
|
||||
if(it == m_confsMap.end()) {
|
||||
warning("Config value %s not found", key.c_str());
|
||||
return 0;
|
||||
}
|
||||
return convertType<float, std::string>(iter->second);
|
||||
return convertType<float, std::string>(it->second);
|
||||
}
|
||||
|
||||
bool Configs::getBoolean(const std::string &key)
|
||||
bool Configs::getBoolean(const std::string &key) const
|
||||
{
|
||||
auto iter = m_confsMap.find(key);
|
||||
if(iter == m_confsMap.end()) {
|
||||
auto it = m_confsMap.find(key);
|
||||
if(it == m_confsMap.end()) {
|
||||
warning("Config value %s not found", key.c_str());
|
||||
return 0;
|
||||
}
|
||||
return (iter->second == "true");
|
||||
return (it->second == "true");
|
||||
}
|
||||
|
||||
int Configs::getInteger(const std::string &key)
|
||||
int Configs::getInteger(const std::string &key) const
|
||||
{
|
||||
auto iter = m_confsMap.find(key);
|
||||
if(iter == m_confsMap.end()) {
|
||||
auto it = m_confsMap.find(key);
|
||||
if(it == m_confsMap.end()) {
|
||||
warning("Config value %s not found", key.c_str());
|
||||
return 0;
|
||||
}
|
||||
return convertType<int, std::string>(iter->second);
|
||||
return convertType<int, std::string>(it->second);
|
||||
}
|
||||
|
@@ -44,16 +44,16 @@ public:
|
||||
void setValue(const std::string &key, bool value);
|
||||
void setValue(const std::string &key, int value);
|
||||
|
||||
const std::string &getString(const std::string &key);
|
||||
float getFloat(const std::string &key);
|
||||
bool getBoolean(const std::string &key);
|
||||
int getInteger(const std::string &key);
|
||||
const std::string &getString(const std::string &key) const;
|
||||
float getFloat(const std::string &key) const;
|
||||
bool getBoolean(const std::string &key) const;
|
||||
int getInteger(const std::string &key) const;
|
||||
|
||||
private:
|
||||
std::string m_fileName;
|
||||
std::map<std::string, std::string> m_confsMap;
|
||||
};
|
||||
|
||||
extern Configs g_config;
|
||||
extern Configs g_configs;
|
||||
|
||||
#endif // CONFIGS_H
|
||||
|
@@ -36,12 +36,10 @@ public:
|
||||
/// Load font from file
|
||||
bool load(const std::string &file);
|
||||
|
||||
std::string& getName() { return m_name; }
|
||||
const std::string& getName() const { return m_name; }
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<Font> FontPtr;
|
||||
|
||||
#endif // FONT_H
|
||||
|
@@ -62,7 +62,7 @@ FrameBuffer::FrameBuffer(int width, int height)
|
||||
oglDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)Platform::getExtensionProcAddress("glDeleteFramebuffers");
|
||||
oglCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)Platform::getExtensionProcAddress("glCheckFramebufferStatus");
|
||||
}
|
||||
|
||||
|
||||
// generate FBO
|
||||
oglGenFramebuffers(1, &m_fbo);
|
||||
oglBindFramebuffer(GL_FRAMEBUFFER_EXT, m_fbo);
|
||||
|
@@ -40,6 +40,7 @@ public:
|
||||
void init();
|
||||
void terminate();
|
||||
|
||||
/// Check if a GL extension is supported
|
||||
bool isExtensionSupported(const char *extension);
|
||||
|
||||
/// Called after every window resize
|
||||
|
Reference in New Issue
Block a user