mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-07 02:40:30 -05:00
Fixed windows build
This commit is contained in:
parent
108cd8efc8
commit
6d2e1a603f
@ -13,7 +13,7 @@ void Ship::GameOverlay::LoadFont(const std::string& name, const std::string& pat
|
|||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
std::shared_ptr<Archive> base = GlobalCtx2::GetInstance()->GetResourceManager()->GetArchive();
|
std::shared_ptr<Archive> base = GlobalCtx2::GetInstance()->GetResourceManager()->GetArchive();
|
||||||
std::shared_ptr<File> font = std::make_shared<File>();
|
std::shared_ptr<File> font = std::make_shared<File>();
|
||||||
base->LoadFile(normalize(path), false, font);
|
base->LoadFile(path, false, font);
|
||||||
if (font->bIsLoaded) {
|
if (font->bIsLoaded) {
|
||||||
char* font_data = new char[font->dwBufferSize];
|
char* font_data = new char[font->dwBufferSize];
|
||||||
memcpy(font_data, font->buffer.get(), font->dwBufferSize);
|
memcpy(font_data, font->buffer.get(), font->dwBufferSize);
|
||||||
@ -65,7 +65,7 @@ ImVec2 Ship::GameOverlay::CalculateTextSize(const char* text, const char* text_e
|
|||||||
text_display_end = text_end;
|
text_display_end = text_end;
|
||||||
|
|
||||||
GameOverlay* overlay = SohImGui::overlay;
|
GameOverlay* overlay = SohImGui::overlay;
|
||||||
|
|
||||||
ImFont* font = overlay->CurrentFont == "Default" ? g.Font : overlay->Fonts[overlay->CurrentFont];
|
ImFont* font = overlay->CurrentFont == "Default" ? g.Font : overlay->Fonts[overlay->CurrentFont];
|
||||||
const float font_size = font->FontSize;
|
const float font_size = font->FontSize;
|
||||||
if (text == text_display_end)
|
if (text == text_display_end)
|
||||||
|
@ -1027,7 +1027,7 @@ struct GfxRenderingAPI gfx_direct3d11_api = {
|
|||||||
gfx_d3d11_get_framebuffer_texture_id,
|
gfx_d3d11_get_framebuffer_texture_id,
|
||||||
gfx_d3d11_select_texture_fb,
|
gfx_d3d11_select_texture_fb,
|
||||||
gfx_d3d11_delete_texture,
|
gfx_d3d11_delete_texture,
|
||||||
gfx_d3d11_set_texture_filter,
|
gfx_d3d11_set_texture_filter,
|
||||||
gfx_d3d11_get_texture_filter
|
gfx_d3d11_get_texture_filter
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#define PATH_HACK
|
#define PATH_HACK
|
||||||
#include <Utils/StringHelper.h>
|
#include <Utils/StringHelper.h>
|
||||||
#include <Utils/File.h>
|
#include <Utils/File.h>
|
||||||
|
|
||||||
|
#include "Lib/ImGui/imgui_internal.h"
|
||||||
#undef PATH_HACK
|
#undef PATH_HACK
|
||||||
#undef Path
|
#undef Path
|
||||||
|
|
||||||
@ -421,14 +423,6 @@ template <typename Numeric> bool is_number(const std::string& s) {
|
|||||||
return ((std::istringstream(s) >> n >> std::ws).eof());
|
return ((std::istringstream(s) >> n >> std::ws).eof());
|
||||||
}
|
}
|
||||||
|
|
||||||
char* Strdup(const char* src) {
|
|
||||||
const unsigned len = strlen(src) + 1;
|
|
||||||
char* newstr = static_cast<char*>(malloc(len));
|
|
||||||
if (newstr)
|
|
||||||
memcpy(newstr, src, len);
|
|
||||||
return newstr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugConsole_LoadCVars()
|
void DebugConsole_LoadCVars()
|
||||||
{
|
{
|
||||||
if (File::Exists("cvars.cfg")) {
|
if (File::Exists("cvars.cfg")) {
|
||||||
@ -441,7 +435,7 @@ void DebugConsole_LoadCVars()
|
|||||||
if (cfg[1].find("\"") != std::string::npos) {
|
if (cfg[1].find("\"") != std::string::npos) {
|
||||||
std::string value(cfg[1]);
|
std::string value(cfg[1]);
|
||||||
value.erase(std::ranges::remove(value, '\"').begin(), value.end());
|
value.erase(std::ranges::remove(value, '\"').begin(), value.end());
|
||||||
CVar_SetString(cfg[0].c_str(), Strdup(value.c_str()));
|
CVar_SetString(cfg[0].c_str(), ImStrdup(value.c_str()));
|
||||||
}
|
}
|
||||||
if (is_number<float>(cfg[1])) {
|
if (is_number<float>(cfg[1])) {
|
||||||
CVar_SetFloat(cfg[0].c_str(), std::stof(cfg[1]));
|
CVar_SetFloat(cfg[0].c_str(), std::stof(cfg[1]));
|
||||||
|
Loading…
Reference in New Issue
Block a user