LUS Cleanup: CVars functions are now consistent

This commit is contained in:
Kenix3 2022-08-02 22:25:27 -04:00
parent 6d3d5e7da5
commit 8c9d067657
2 changed files with 3 additions and 9 deletions

View File

@ -4,8 +4,6 @@
#include <functional>
#include <memory>
#include <utility>
#include <PR/ultra64/gbi.h>
#include "imgui_internal.h"
std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars;
@ -96,7 +94,7 @@ extern "C" void CVar_SetS32(const char* name, int32_t value) {
cvar->value.valueS32 = value;
}
void CVar_SetFloat(const char* name, float value) {
extern "C" void CVar_SetFloat(const char* name, float value) {
auto& cvar = cvars[name];
if (!cvar) {
cvar = std::make_unique<CVar>();
@ -111,7 +109,7 @@ extern "C" void CVar_SetString(const char* name, const char* value) {
cvar = std::make_unique<CVar>();
}
cvar->type = CVarType::String;
cvar->value.valueStr = ImStrdup(value);
cvar->value.valueStr = _strdup(value);
}
extern "C" void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue) {

View File

@ -32,14 +32,13 @@ extern "C" CVar * CVar_Get(const char* name);
extern "C"
{
#endif
//#include <ultra64.h>
int32_t CVar_GetS32(const char* name, int32_t defaultValue);
float CVar_GetFloat(const char* name, float defaultValue);
void CVar_SetFloat(const char* name, float value);
const char* CVar_GetString(const char* name, const char* defaultValue);
void CVar_SetS32(const char* name, int32_t value);
void CVar_SetString(const char* name, const char* value);
Color_RGB8 CVar_GetRGB(const char* name, Color_RGB8 defaultValue);
Color_RGBA8 CVar_GetRGBA(const char* name, Color_RGBA8 defaultValue);
void CVar_SetRGBA(const char* name, Color_RGBA8 value);
@ -56,11 +55,8 @@ void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue);
#ifdef __cplusplus
#include <map>
#include <string>
#include <functional>
#include <memory>
//extern "C" CVar * CVar_Get(const char* name);
extern std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars;
void CVar_SetFloat(const char* name, float value);
#endif
#endif