mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-18 08:10:31 -05:00
Fixed merge issues.
This commit is contained in:
parent
44bf5af33a
commit
3bb234e6a6
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars;
|
std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars;
|
||||||
|
|
||||||
extern "C" CVar* CVar_Get(const char* name) {
|
CVar* CVar_Get(const char* name) {
|
||||||
auto it = cvars.find(name);
|
auto it = cvars.find(name);
|
||||||
return (it != cvars.end()) ? it->second.get() : nullptr;
|
return (it != cvars.end()) ? it->second.get() : nullptr;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ typedef struct CVar {
|
|||||||
} value;
|
} value;
|
||||||
} CVar;
|
} CVar;
|
||||||
|
|
||||||
CVar* CVar_Get(char* name);
|
extern "C" CVar * CVar_Get(const char* name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -34,7 +34,6 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
//#include <ultra64.h>
|
//#include <ultra64.h>
|
||||||
|
|
||||||
CVar* CVar_Get(const char* name);
|
|
||||||
int32_t CVar_GetS32(const char* name, int32_t defaultValue);
|
int32_t CVar_GetS32(const char* name, int32_t defaultValue);
|
||||||
float CVar_GetFloat(const char* name, float defaultValue);
|
float CVar_GetFloat(const char* name, float defaultValue);
|
||||||
const char* CVar_GetString(const char* name, const char* defaultValue);
|
const char* CVar_GetString(const char* name, const char* defaultValue);
|
||||||
@ -60,7 +59,7 @@ void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue);
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
extern "C" CVar * CVar_Get(const char* name);
|
//extern "C" CVar * CVar_Get(const char* name);
|
||||||
extern std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars;
|
extern std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars;
|
||||||
void CVar_SetFloat(const char* name, float value);
|
void CVar_SetFloat(const char* name, float value);
|
||||||
#endif
|
#endif
|
||||||
|
@ -280,50 +280,6 @@ namespace SohImGui {
|
|||||||
stbi_image_free(img_data);
|
stbi_image_free(img_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadRainbowColor() {
|
|
||||||
u8 arrayLength = sizeof(RainbowColorCvarList) / sizeof(*RainbowColorCvarList);
|
|
||||||
for (u8 s = 0; s < arrayLength; s++) {
|
|
||||||
std::string cvarName = RainbowColorCvarList[s];
|
|
||||||
std::string Cvar_Red = cvarName;
|
|
||||||
Cvar_Red += "R";
|
|
||||||
std::string Cvar_Green = cvarName;
|
|
||||||
Cvar_Green += "G";
|
|
||||||
std::string Cvar_Blue = cvarName;
|
|
||||||
Cvar_Blue += "B";
|
|
||||||
std::string Cvar_RBM = cvarName;
|
|
||||||
Cvar_RBM += "RBM";
|
|
||||||
std::string RBM_HUE = cvarName;
|
|
||||||
RBM_HUE += "Hue";
|
|
||||||
f32 Canon = 10.f * s;
|
|
||||||
ImVec4 NewColor;
|
|
||||||
const f32 deltaTime = 1.0f / ImGui::GetIO().Framerate;
|
|
||||||
f32 hue = CVar_GetFloat(RBM_HUE.c_str(), 0.0f);
|
|
||||||
f32 newHue = hue + CVar_GetS32("gColorRainbowSpeed", 1) * 36.0f * deltaTime;
|
|
||||||
if (newHue >= 360)
|
|
||||||
newHue = 0;
|
|
||||||
CVar_SetFloat(RBM_HUE.c_str(), newHue);
|
|
||||||
f32 current_hue = CVar_GetFloat(RBM_HUE.c_str(), 0);
|
|
||||||
u8 i = current_hue / 60 + 1;
|
|
||||||
u8 a = (-current_hue / 60.0f + i) * 255;
|
|
||||||
u8 b = (current_hue / 60.0f + (1 - i)) * 255;
|
|
||||||
|
|
||||||
switch (i) {
|
|
||||||
case 1: NewColor.x = 255; NewColor.y = b; NewColor.z = 0; break;
|
|
||||||
case 2: NewColor.x = a; NewColor.y = 255; NewColor.z = 0; break;
|
|
||||||
case 3: NewColor.x = 0; NewColor.y = 255; NewColor.z = b; break;
|
|
||||||
case 4: NewColor.x = 0; NewColor.y = a; NewColor.z = 255; break;
|
|
||||||
case 5: NewColor.x = b; NewColor.y = 0; NewColor.z = 255; break;
|
|
||||||
case 6: NewColor.x = 255; NewColor.y = 0; NewColor.z = a; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CVar_GetS32(Cvar_RBM.c_str(), 0) != 0) {
|
|
||||||
CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(NewColor.x, 0, 255));
|
|
||||||
CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(NewColor.y, 0, 255));
|
|
||||||
CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(NewColor.z, 0, 255));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadPickersColors(ImVec4& ColorArray, const char* cvarname, const ImVec4& default_colors, bool has_alpha)
|
void LoadPickersColors(ImVec4& ColorArray, const char* cvarname, const ImVec4& default_colors, bool has_alpha)
|
||||||
{
|
{
|
||||||
Color_RGBA8 defaultColors;
|
Color_RGBA8 defaultColors;
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
#include "endianness.h"
|
#include "endianness.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u8 r, g, b;
|
uint8_t r, g, b;
|
||||||
} Color_RGB8;
|
} Color_RGB8;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u8 r, g, b, a;
|
uint8_t r, g, b, a;
|
||||||
} Color_RGBA8;
|
} Color_RGBA8;
|
||||||
|
|
||||||
// only use when necessary for alignment purposes
|
// only use when necessary for alignment purposes
|
||||||
@ -20,21 +20,21 @@ typedef union {
|
|||||||
u8 a, b, g, r;
|
u8 a, b, g, r;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
u32 rgba;
|
uint32_t rgba;
|
||||||
} Color_RGBA8_u32;
|
} Color_RGBA8_u32;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
f32 r, g, b, a;
|
float r, g, b, a;
|
||||||
} Color_RGBAf;
|
} Color_RGBAf;
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
struct {
|
struct {
|
||||||
u16 r : 5;
|
uint16_t r : 5;
|
||||||
u16 g : 5;
|
uint16_t g : 5;
|
||||||
u16 b : 5;
|
uint16_t b : 5;
|
||||||
u16 a : 1;
|
uint16_t a : 1;
|
||||||
};
|
};
|
||||||
u16 rgba;
|
uint16_t rgba;
|
||||||
} Color_RGBA16;
|
} Color_RGBA16;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -569,7 +569,19 @@ void DebugConsole_LoadCVars() {
|
|||||||
case nlohmann::detail::value_t::array:
|
case nlohmann::detail::value_t::array:
|
||||||
break;
|
break;
|
||||||
case nlohmann::detail::value_t::string:
|
case nlohmann::detail::value_t::string:
|
||||||
CVar_SetString(item.key().c_str(), value.get<std::string>().c_str());
|
if (StringHelper::StartsWith(value.get<std::string>(), "#"))
|
||||||
|
{
|
||||||
|
uint32_t val = std::stoul(&value.get<std::string>().c_str()[1], nullptr, 16);
|
||||||
|
Color_RGBA8 clr;
|
||||||
|
clr.r = val >> 24;
|
||||||
|
clr.g = val >> 16;
|
||||||
|
clr.b = val >> 8;
|
||||||
|
clr.a = val & 0xFF;
|
||||||
|
|
||||||
|
CVar_SetRGBA(item.key().c_str(), clr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
CVar_SetString(item.key().c_str(), value.get<std::string>().c_str());
|
||||||
break;
|
break;
|
||||||
case nlohmann::detail::value_t::boolean:
|
case nlohmann::detail::value_t::boolean:
|
||||||
CVar_SetS32(item.key().c_str(), value.get<bool>());
|
CVar_SetS32(item.key().c_str(), value.get<bool>());
|
||||||
@ -608,8 +620,8 @@ void DebugConsole_SaveCVars()
|
|||||||
{
|
{
|
||||||
Color_RGBA8 clr = cvar.second->value.valueRGBA;
|
Color_RGBA8 clr = cvar.second->value.valueRGBA;
|
||||||
uint32_t val = (clr.r << 24) + (clr.g << 16) + (clr.b << 8) + clr.a;
|
uint32_t val = (clr.r << 24) + (clr.g << 16) + (clr.b << 8) + clr.a;
|
||||||
Conf->setRGBA(clr);
|
std::string str = StringHelper::Sprintf("#%08X", val);
|
||||||
//output += StringHelper::Sprintf("%s = #%08X\n", cvar.first.c_str(), val);
|
pConf->setString(key, str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user