Skip to content

Commit

Permalink
Apply original colorscheme
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaldaien committed Sep 30, 2023
1 parent 15447cd commit 790cdfd
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 87 deletions.
4 changes: 2 additions & 2 deletions include/SpecialK/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,9 @@ void SK_ImGui_WarningWithTitle (const wchar_t* wszMessage,
L"First-Chance Assertion Failure" ) \
); } } }

#define SK_ReleaseAssert(expr) { SK_ReleaseAssertEx ( (expr),L#expr, \
#define SK_ReleaseAssert(expr) do { SK_ReleaseAssertEx ( (expr),L#expr, \
__FILEW__,__LINE__, \
__FUNCSIG__ ) }
__FUNCSIG__ ) } while (0);


struct SK_ThreadSuspension_Ctx {
Expand Down
37 changes: 25 additions & 12 deletions include/imgui/imconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@

#pragma once

#include <SpecialK/config.h>

//---- Define assertion handler. Defaults to calling assert().
// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
#define IM_ASSERT(_EXPR) SK_ReleaseAssert(_EXPR)
#define IM_ASSERT(_EXPR) if (config.system.log_level > 0) SK_ReleaseAssert(_EXPR)
//#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts

//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows
Expand Down Expand Up @@ -119,13 +121,31 @@
//---- Debug Tools: Enable slower asserts
//#define IMGUI_DEBUG_PARANOID

//#define IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
//---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices.
// Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices).
// Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer.
// Read about ImGuiBackendFlags_RendererHasVtxOffset for details.
#define ImDrawIdx unsigned int

//---- Override ImDrawCallback signature (will need to modify renderer backends accordingly)
//struct ImDrawList;
//struct ImDrawCmd;
//typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data);
//#define ImDrawCallback MyImDrawCallback

//---- Debug Tools: Macro to break in Debugger (we provide a default implementation of this in the codebase)
// (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.)
//#define IM_DEBUG_BREAK IM_ASSERT(0)
//#define IM_DEBUG_BREAK __debugbreak()

//---- Debug Tools: Enable slower asserts
//#define IMGUI_DEBUG_PARANOID

#define IMGUI_INCLUDE_IMGUI_USER_INL

#define IM_MSVC_RUNTIME_CHECKS_OFF __pragma(runtime_checks("",off)) __pragma(check_stack(off)) __pragma(strict_gs_check(push,off))
#define IM_MSVC_RUNTIME_CHECKS_RESTORE __pragma(runtime_checks("",restore)) __pragma(check_stack()) __pragma(strict_gs_check(pop))

#include <SpecialK/utility.h>

// ImVec2: 2D vector used to store positions, sizes etc. [Compile-time configurable type]
// This is a frequently used type in the API. Consider using IM_VEC2_CLASS_EXTRA to create implicit cast from/to our preferred type.
IM_MSVC_RUNTIME_CHECKS_OFF
Expand All @@ -151,11 +171,4 @@ struct ImVec4
IM_VEC4_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec4.
#endif
};
IM_MSVC_RUNTIME_CHECKS_RESTORE

////////struct ImDrawVert
////////{
//////// ImVec2 pos;
//////// ImVec2 uv;
//////// ImVec4 col;
////////};
IM_MSVC_RUNTIME_CHECKS_RESTORE
8 changes: 7 additions & 1 deletion include/imgui/imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,18 @@ Index of this file:
// IMGUI_API is used for core imgui functions, IMGUI_IMPL_API is used for the default backends files (imgui_impl_xxx.h)
// Using dear imgui via a shared library is not recommended: we don't guarantee backward nor forward ABI compatibility + this is a call-heavy library and function call overhead adds up.
#ifndef IMGUI_API
#define IMGUI_API
#ifdef SK_EXPORTS
# define IMGUI_API __declspec (dllexport)
#else
# define IMGUI_API __declspec (dllimport)
#endif
#endif
#ifndef IMGUI_IMPL_API
#define IMGUI_IMPL_API IMGUI_API
#endif

#include <SpecialK/log.h>

// Helper Macros
#ifndef IM_ASSERT
#include <assert.h>
Expand Down
1 change: 0 additions & 1 deletion src/control_panel/cfg_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <SpecialK/control_panel/input.h>

#include <imgui/font_awesome.h>
#include <imgui/imgui_user.inl>

bool cursor_vis = false;

Expand Down
73 changes: 51 additions & 22 deletions src/imgui/backends/imgui_d3d11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,10 @@ ImGui_ImplDX11_RenderDrawData (ImDrawData* draw_data)

// Setup orthographic projection matrix into our constant buffer
{
float L = 0.0f;
float R = io.DisplaySize.x;
float B = io.DisplaySize.y;
float T = 0.0f;
float L = draw_data->DisplayPos.x;
float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y;
float T = draw_data->DisplayPos.y;

alignas (__m128d) float mvp [4][4] =
{
Expand Down Expand Up @@ -526,8 +526,8 @@ ImGui_ImplDX11_RenderDrawData (ImDrawData* draw_data)
// Setup viewport
D3D11_VIEWPORT vp = { };

vp.Height = io.DisplaySize.y;
vp.Width = io.DisplaySize.x;
vp.Height = draw_data->DisplaySize.y;
vp.Width = draw_data->DisplaySize.x;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
vp.TopLeftX = vp.TopLeftY = 0.0f;
Expand Down Expand Up @@ -573,45 +573,61 @@ ImGui_ImplDX11_RenderDrawData (ImDrawData* draw_data)
int vtx_offset = 0;
int idx_offset = 0;

ImVec2 clip_off = draw_data->DisplayPos;

for (int n = 0; n < draw_data->CmdListsCount; n++)
{
const ImDrawList* cmd_list =
draw_data->CmdLists [n];

for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
{
const ImDrawCmd* pcmd =
&cmd_list->CmdBuffer [cmd_i];

if (pcmd->UserCallback)
{
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
SK_ReleaseAssert (!L"ImDrawCallback_ResetRenderState = Not Implemented")// ImGui_ImplDX11_SetupRenderState (draw_data, pDevCtx);
else
pcmd->UserCallback (cmd_list, pcmd);

}

else
{
const D3D11_RECT r = {
static_cast <LONG> (pcmd->ClipRect.x), static_cast <LONG> (pcmd->ClipRect.y),
static_cast <LONG> (pcmd->ClipRect.z), static_cast <LONG> (pcmd->ClipRect.w)
};
// Project scissor/clipping rectangles into framebuffer space
ImVec2 clip_min (pcmd->ClipRect.x - clip_off.x, pcmd->ClipRect.y - clip_off.y);
ImVec2 clip_max (pcmd->ClipRect.z - clip_off.x, pcmd->ClipRect.w - clip_off.y);

if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
continue;

// Apply scissor/clipping rectangle
const D3D11_RECT r = {
static_cast <LONG> (clip_min.x), static_cast <LONG> (clip_min.y),
static_cast <LONG> (clip_max.x), static_cast <LONG> (clip_max.y)
};

extern ID3D11ShaderResourceView*
SK_HDR_GetUnderlayResourceView (void);

ID3D11ShaderResourceView* views [2] =
{
*(ID3D11ShaderResourceView **)&pcmd->TextureId,
SK_HDR_GetUnderlayResourceView ()
(ID3D11ShaderResourceView *)pcmd->GetTexID (),
SK_HDR_GetUnderlayResourceView ()
};

pDevCtx->PSSetSamplers (0, 1, &_P->pFontSampler_wrap);
pDevCtx->PSSetShaderResources (0, 2, views);
pDevCtx->RSSetScissorRects (1, &r);

pDevCtx->DrawIndexed (pcmd->ElemCount, idx_offset, vtx_offset);

pDevCtx->DrawIndexed (pcmd->ElemCount, pcmd->IdxOffset + idx_offset,
pcmd->VtxOffset + vtx_offset);
}

idx_offset += pcmd->ElemCount;
}

idx_offset += cmd_list->IdxBuffer.Size;
vtx_offset += cmd_list->VtxBuffer.Size;
}
}
Expand Down Expand Up @@ -1621,7 +1637,12 @@ ImGui_ImplDX11_Init ( IDXGISwapChain* pSwapChain,
g_frameBufferWidth = swap_desc.BufferDesc.Width;
g_frameBufferHeight = swap_desc.BufferDesc.Height;
g_hWnd = swap_desc.OutputWindow;
//io.ImeWindowHandle = g_hWnd;

//// FIXME
////ImGui_ImplDX11_Data* bd = IM_NEW(ImGui_ImplDX11_Data)();
////io.BackendRendererUserData = (void*)bd;
io.BackendRendererName = "imgui_impl_dx11";
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.

static auto& rb =
SK_GetCurrentRenderBackend ();
Expand All @@ -1635,8 +1656,16 @@ ImGui_ImplDX11_Init ( IDXGISwapChain* pSwapChain,
void
ImGui_ImplDX11_Shutdown (void)
{
ImGuiIO& io =
ImGui::GetIO ();

ImGui_ImplDX11_InvalidateDeviceObjects ();
ImGui::Shutdown ();

io.BackendRendererName = nullptr;
io.BackendRendererUserData = nullptr;

io.BackendFlags &= ~ImGuiBackendFlags_RendererHasVtxOffset;
}

#include <SpecialK/window.h>
Expand Down
36 changes: 18 additions & 18 deletions src/imgui/imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1194,31 +1194,31 @@ ImGuiStyle::ImGuiStyle()
Alpha = 1.0f; // Global alpha applies to everything in Dear ImGui.
DisabledAlpha = 0.60f; // Additional alpha multiplier applied by BeginDisabled(). Multiply over current value of Alpha.
WindowPadding = ImVec2(8,8); // Padding within a window
WindowRounding = 0.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows. Large values tend to lead to variety of artifacts and are not recommended.
WindowRounding = 3.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows. Large values tend to lead to variety of artifacts and are not recommended.
WindowBorderSize = 1.0f; // Thickness of border around windows. Generally set to 0.0f or 1.0f. Other values not well tested.
WindowMinSize = ImVec2(32,32); // Minimum window size
WindowTitleAlign = ImVec2(0.0f,0.5f);// Alignment for title bar text
WindowMenuButtonPosition= ImGuiDir_Left; // Position of the collapsing/docking button in the title bar (left/right). Defaults to ImGuiDir_Left.
ChildRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows
ChildRounding = 3.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows
ChildBorderSize = 1.0f; // Thickness of border around child windows. Generally set to 0.0f or 1.0f. Other values not well tested.
PopupRounding = 0.0f; // Radius of popup window corners rounding. Set to 0.0f to have rectangular child windows
PopupRounding = 3.0f; // Radius of popup window corners rounding. Set to 0.0f to have rectangular child windows
PopupBorderSize = 1.0f; // Thickness of border around popup or tooltip windows. Generally set to 0.0f or 1.0f. Other values not well tested.
FramePadding = ImVec2(4,3); // Padding within a framed rectangle (used by most widgets)
FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
FrameBorderSize = 0.0f; // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.
FrameRounding = 3.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
FrameBorderSize = 1.1f; // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.
ItemSpacing = ImVec2(8,4); // Horizontal and vertical spacing between widgets/lines
ItemInnerSpacing = ImVec2(4,4); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
CellPadding = ImVec2(4,2); // Padding within a table cell. CellPadding.y may be altered between different rows.
TouchExtraPadding = ImVec2(0,0); // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
IndentSpacing = 21.0f; // Horizontal spacing when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).
ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
ScrollbarSize = 14.0f; // Width of the vertical scrollbar, Height of the horizontal scrollbar
ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar
ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar
GrabMinSize = 12.0f; // Minimum width/height of a grab box for slider/scrollbar
GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
GrabRounding = 100.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
LogSliderDeadzone = 4.0f; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
TabRounding = 4.0f; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
TabBorderSize = 0.0f; // Thickness of border around tabs.
TabRounding = 3.0f; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
TabBorderSize = 1.0f; // Thickness of border around tabs.
TabMinWidthForCloseButton = 0.0f; // Minimum width for close button to appear on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
TabBarBorderSize = 1.0f; // Thickness of tab-bar separator, which takes on the tab active color to denote focus.
ColorButtonPosition = ImGuiDir_Right; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.
Expand Down Expand Up @@ -1284,13 +1284,13 @@ ImGuiIO::ImGuiIO()
IM_STATIC_ASSERT(IM_ARRAYSIZE(ImGuiIO::MouseDown) == ImGuiMouseButton_COUNT && IM_ARRAYSIZE(ImGuiIO::MouseClicked) == ImGuiMouseButton_COUNT);

// Settings
ConfigFlags = ImGuiConfigFlags_None;
BackendFlags = ImGuiBackendFlags_None;
DisplaySize = ImVec2(-1.0f, -1.0f);
DeltaTime = 1.0f / 60.0f;
IniSavingRate = 5.0f;
IniFilename = "imgui.ini"; // Important: "imgui.ini" is relative to current working dir, most apps will want to lock this to an absolute path (e.g. same path as executables).
LogFilename = "imgui_log.txt";
ConfigFlags = ImGuiConfigFlags_None;
BackendFlags = ImGuiBackendFlags_None;
DisplaySize = ImVec2(-1.0f, -1.0f);
DeltaTime = 0.0f;//1.0f / 60.0f;
IniSavingRate = 0.0f;//5.0f
IniFilename = "imgui.ini"; // Important: "imgui.ini" is relative to current working dir, most apps will want to lock this to an absolute path (e.g. same path as executables).
LogFilename = "imgui_log.txt";
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
for (int i = 0; i < ImGuiKey_COUNT; i++)
KeyMap[i] = -1;
Expand Down Expand Up @@ -15108,7 +15108,7 @@ void ImGui::UpdateDebugToolStackQueries() {}
// Include imgui_user.inl at the end of imgui.cpp to access private data/functions that aren't exposed.
// Prefer just including imgui_internal.h from your code rather than using this define. If a declaration is missing from imgui_internal.h add it or request it on the github.
#ifdef IMGUI_INCLUDE_IMGUI_USER_INL
#include "imgui_user.inl"
#include <imgui/imgui_user.inl>
#endif

//-----------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 790cdfd

Please sign in to comment.