ui: Use borderless window on Windows

This commit is contained in:
WerWolv
2021-08-18 22:36:46 +02:00
parent 48f27c2174
commit b66304fc91
15 changed files with 360 additions and 86 deletions

View File

@@ -6,6 +6,26 @@
namespace ImGui {
struct Texture {
ImTextureID textureId;
int width, height;
[[nodiscard]]
constexpr bool valid() const noexcept {
return this->textureId != nullptr;
}
[[nodiscard]]
constexpr operator ImTextureID() {
return this->textureId;
}
[[nodiscard]]
auto size() const noexcept {
return ImVec2(this->width, this->height);
}
};
bool IconHyperlink(const char *icon, const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0);
bool Hyperlink(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0);
bool BulletHyperlink(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0);
@@ -22,9 +42,9 @@ namespace ImGui {
return static_cast<ImU32>(ImGui::GetTime() * 100) % 100 <= static_cast<ImU32>(ImGui::GetIO().DeltaTime * 100);
}
std::tuple<ImTextureID, int, int> LoadImageFromPath(const char *path);
std::tuple<ImTextureID, int, int> LoadImageFromMemory(ImU8 *buffer, int size);
void UnloadImage(ImTextureID texture);
Texture LoadImageFromPath(const char *path);
Texture LoadImageFromMemory(ImU8 *buffer, int size);
void UnloadImage(Texture &texture);
enum ImGuiCustomCol {
ImGuiCustomCol_DescButton,

View File

@@ -32,4 +32,4 @@ IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame();
IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c);
IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c);

View File

@@ -235,7 +235,7 @@ namespace ImGui {
colors[ImGuiCustomCol_DescButtonActive] = ImColor(80, 80, 120);
}
std::tuple<ImTextureID, int, int> LoadImageFromPath(const char *path) {
Texture LoadImageFromPath(const char *path) {
int imageWidth = 0;
int imageHeight = 0;
@@ -261,7 +261,7 @@ namespace ImGui {
return { reinterpret_cast<ImTextureID>(static_cast<intptr_t>(texture)), imageWidth, imageHeight };
}
std::tuple<ImTextureID, int, int> LoadImageFromMemory(ImU8 *buffer, int size) {
Texture LoadImageFromMemory(ImU8 *buffer, int size) {
int imageWidth = 0;
int imageHeight = 0;
@@ -288,12 +288,14 @@ namespace ImGui {
return { reinterpret_cast<ImTextureID>(static_cast<intptr_t>(texture)), imageWidth, imageHeight };
}
void UnloadImage(ImTextureID texture) {
if (texture == nullptr)
void UnloadImage(Texture &texture) {
if (texture.textureId == nullptr)
return;
auto glTextureId = static_cast<GLuint>(reinterpret_cast<intptr_t>(texture));
auto glTextureId = static_cast<GLuint>(reinterpret_cast<intptr_t>(texture.textureId));
glDeleteTextures(1, &glTextureId);
texture = { nullptr, 0, 0 };
}
}

2
external/curl vendored