Skip to content

Commit

Permalink
[thirdparty] updated imgui to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
PanosK92 committed Oct 31, 2024
1 parent d527baa commit 260dc27
Show file tree
Hide file tree
Showing 17 changed files with 2,288 additions and 1,379 deletions.
1 change: 0 additions & 1 deletion editor/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "ImGui/ImGuiExtension.h"
#include "ImGui/Implementation/ImGui_RHI.h"
#include "ImGui/Implementation/imgui_impl_sdl2.h"
#include "ImGui/Implementation/ImGui_Style.h"
#include "Widgets/AssetBrowser.h"
#include "Widgets/Console.h"
#include "Widgets/Style.h"
Expand Down
2 changes: 0 additions & 2 deletions editor/EditorWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,6 @@ namespace
const float col_b = 20.0f;

{


ImGui::NewLine();
ImGui::SameLine(col_b);
ImGui::Text("Shortcut");
Expand Down
24 changes: 12 additions & 12 deletions editor/ImGui/ImGuiExtension.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ namespace ImGuiSp

bool result = ImGui::ImageButton
(
std::to_string(id).c_str(), // str_id
static_cast<ImTextureID>(texture), // user_texture_id
size, // size
ImVec2(0, 0), // uv0
ImVec2(1, 1), // uv1
ImColor(0, 0, 0, 0), // bg_col
tint // tint_col
std::to_string(id).c_str(), // str_id
reinterpret_cast<ImTextureID>(texture), // user_texture_id
size, // size
ImVec2(0, 0), // uv0
ImVec2(1, 1), // uv1
ImColor(0, 0, 0, 0), // bg_col
tint // tint_col
);

if (!border)
Expand All @@ -174,7 +174,7 @@ namespace ImGuiSp
static void image(const Icon& icon, const float size)
{
ImGui::Image(
static_cast<ImTextureID>(icon.GetTexture()),
reinterpret_cast<ImTextureID>(icon.GetTexture()),
ImVec2(size, size),
ImVec2(0, 0),
ImVec2(1, 1),
Expand All @@ -191,7 +191,7 @@ namespace ImGuiSp
}

ImGui::Image(
static_cast<ImTextureID>(texture),
reinterpret_cast<ImTextureID>(texture),
size,
ImVec2(0, 0),
ImVec2(1, 1),
Expand All @@ -208,7 +208,7 @@ namespace ImGuiSp
static void image(Spartan::RHI_Texture* texture, const ImVec2& size, const ImVec4& tint = default_tint, const ImColor& border = ImColor(0, 0, 0, 0))
{
ImGui::Image(
static_cast<ImTextureID>(texture),
reinterpret_cast<ImTextureID>(texture),
size,
ImVec2(0, 0),
ImVec2(1, 1),
Expand All @@ -220,7 +220,7 @@ namespace ImGuiSp
static void image(const IconType icon, const float size)
{
ImGui::Image(
static_cast<void*>(IconLoader::GetTextureByType(icon)),
reinterpret_cast<ImTextureID>(IconLoader::GetTextureByType(icon)),
ImVec2(size, size),
ImVec2(0, 0),
ImVec2(1, 1),
Expand All @@ -232,7 +232,7 @@ namespace ImGuiSp
static void image(const IconType icon, const float size,const ImVec4 tint)
{
ImGui::Image(
static_cast<void*>(IconLoader::GetTextureByType(icon)),
reinterpret_cast<ImTextureID>(IconLoader::GetTextureByType(icon)),
ImVec2(size, size),
ImVec2(0, 0),
ImVec2(1, 1),
Expand Down
12 changes: 7 additions & 5 deletions editor/ImGui/Implementation/ImGui_RHI.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "RHI/RHI_RasterizerState.h"
#include "RHI/RHI_DepthStencilState.h"
#include <Debugging.h>
#include <SDL_video.h>
//======================================

namespace ImGui::RHI
Expand Down Expand Up @@ -167,7 +168,7 @@ namespace ImGui::RHI

// upload texture to graphics system
g_font_atlas = make_shared<RHI_Texture>(RHI_Texture_Type::Type2D, atlas_width, atlas_height, 1, 1, RHI_Format::R8G8B8A8_Unorm, RHI_Texture_Srv, "imgui_font_atlas", texture_data);
io.Fonts->TexID = static_cast<ImTextureID>(g_font_atlas.get());
io.Fonts->TexID = reinterpret_cast<ImTextureID>(g_font_atlas.get());
}

// setup back-end capabilities flags
Expand Down Expand Up @@ -326,7 +327,7 @@ namespace ImGui::RHI
bool is_texture_visualised = false;
bool is_frame_texture = false;

if (RHI_Texture* texture = static_cast<RHI_Texture*>(pcmd->TextureId))
if (RHI_Texture* texture = reinterpret_cast<RHI_Texture*>(pcmd->TextureId))
{
is_frame_texture = Renderer::GetRenderTarget(Renderer_RenderTarget::frame_output)->GetObjectId() == texture->GetObjectId();

Expand Down Expand Up @@ -398,14 +399,15 @@ namespace ImGui::RHI

void window_create(ImGuiViewport* viewport)
{
// note: platformHandle is SDL_Window, PlatformHandleRaw is HWND

SP_ASSERT_MSG(viewport->PlatformHandle != nullptr, "Platform handle is invalid");

// note: platformHandle is SDL_Window, PlatformHandleRaw is HWND
SDL_Window* sdl_window = SDL_GetWindowFromID(static_cast<uint32_t>(reinterpret_cast<uintptr_t>(viewport->PlatformHandle)));

WindowData* window = new WindowData();
window->swapchain = make_shared<RHI_SwapChain>
(
viewport->PlatformHandle,
sdl_window,
static_cast<uint32_t>(viewport->Size.x),
static_cast<uint32_t>(viewport->Size.y),
RHI_Present_Mode::Immediate,
Expand Down
2 changes: 1 addition & 1 deletion editor/ImGui/Implementation/ImGui_Style.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ namespace ImGui::Style
style.Colors[ImGuiCol_SliderGrabActive] = color_accent_1;
style.Colors[ImGuiCol_ResizeGripActive] = color_accent_1;
style.Colors[ImGuiCol_DragDropTarget] = color_accent_1;
style.Colors[ImGuiCol_NavHighlight] = color_accent_1;
style.Colors[ImGuiCol_NavCursor] = color_accent_1;
style.Colors[ImGuiCol_NavWindowingHighlight] = color_accent_1;
style.Colors[ImGuiCol_TabSelectedOverline] = color_accent_1;
style.Colors[ImGuiCol_TabDimmedSelectedOverline] = color_accent_1;
Expand Down
Loading

0 comments on commit 260dc27

Please sign in to comment.