mirror of
https://github.com/Bloodysharp/Imguimenu_cringe.git
synced 2025-06-29 02:02:29 +08:00
Добавьте файлы проекта.
This commit is contained in:
3
example_win32_directx9/Elements.h
Normal file
3
example_win32_directx9/Elements.h
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
|
7747
example_win32_directx9/Header.h
Normal file
7747
example_win32_directx9/Header.h
Normal file
File diff suppressed because it is too large
Load Diff
8
example_win32_directx9/build_win32.bat
Normal file
8
example_win32_directx9/build_win32.bat
Normal file
@ -0,0 +1,8 @@
|
||||
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
|
||||
@set OUT_DIR=Debug
|
||||
@set OUT_EXE=example_win32_directx9
|
||||
@set INCLUDES=/I..\.. /I..\..\backends /I "%DXSDK_DIR%/Include"
|
||||
@set SOURCES=main.cpp ..\..\backends\imgui_impl_dx9.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp
|
||||
@set LIBS=/LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d9.lib
|
||||
mkdir %OUT_DIR%
|
||||
cl /nologo /Zi /MD %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
|
177
example_win32_directx9/example_win32_directx9.vcxproj
Normal file
177
example_win32_directx9/example_win32_directx9.vcxproj
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{4165A294-21F2-44CA-9B38-E3F935ABADF5}</ProjectGuid>
|
||||
<RootNamespace>example_win32_directx9</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.22621.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
||||
<IncludePath>I:\Include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>I:\Lib\x86;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
||||
<IncludePath>C:\Users\racco\Desktop\loader ION\freetype\include;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Users\racco\Desktop\loader ION\freetype\win64;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..;..\..\backends;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..;..\..\backends;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..;..\..\backends;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..;..\..\backends;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\imgui.cpp" />
|
||||
<ClCompile Include="..\..\imgui_demo.cpp" />
|
||||
<ClCompile Include="..\..\imgui_draw.cpp" />
|
||||
<ClCompile Include="..\..\imgui_tables.cpp" />
|
||||
<ClCompile Include="..\..\imgui_widgets.cpp" />
|
||||
<ClCompile Include="..\..\backends\imgui_impl_dx9.cpp" />
|
||||
<ClCompile Include="..\..\backends\imgui_impl_win32.cpp" />
|
||||
<ClCompile Include="Elements.h" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\imconfig.h" />
|
||||
<ClInclude Include="..\..\imgui.h" />
|
||||
<ClInclude Include="..\..\imgui_internal.h" />
|
||||
<ClInclude Include="..\..\backends\imgui_impl_dx9.h" />
|
||||
<ClInclude Include="..\..\backends\imgui_impl_win32.h" />
|
||||
<ClInclude Include="Header.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\misc\debuggers\imgui.natvis" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="sources">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="imgui">
|
||||
<UniqueIdentifier>{a82cba23-9de0-45c2-b1e3-2eb1666702de}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\imgui.cpp">
|
||||
<Filter>imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\imgui_demo.cpp">
|
||||
<Filter>imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\imgui_draw.cpp">
|
||||
<Filter>imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\backends\imgui_impl_win32.cpp">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\backends\imgui_impl_dx9.cpp">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\imgui_tables.cpp">
|
||||
<Filter>imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\imgui_widgets.cpp">
|
||||
<Filter>imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Elements.h">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\imconfig.h">
|
||||
<Filter>imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\imgui.h">
|
||||
<Filter>imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\imgui_internal.h">
|
||||
<Filter>imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\backends\imgui_impl_win32.h">
|
||||
<Filter>sources</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\backends\imgui_impl_dx9.h">
|
||||
<Filter>sources</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Header.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\misc\debuggers\imgui.natvis">
|
||||
<Filter>sources</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
35
example_win32_directx9/imgui.ini
Normal file
35
example_win32_directx9/imgui.ini
Normal file
@ -0,0 +1,35 @@
|
||||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
Size=400,400
|
||||
Collapsed=0
|
||||
|
||||
[Window][##WM]
|
||||
Pos=1062,-4
|
||||
Size=301,32
|
||||
Collapsed=0
|
||||
|
||||
[Window][##GUI]
|
||||
Pos=425,157
|
||||
Size=766,470
|
||||
Collapsed=0
|
||||
|
||||
[Window][##KB]
|
||||
Pos=134,345
|
||||
Size=180,60
|
||||
Collapsed=0
|
||||
|
||||
[Window][asd]
|
||||
Pos=60,60
|
||||
Size=113,164
|
||||
Collapsed=0
|
||||
|
||||
[Window][##WATER]
|
||||
Pos=387,110
|
||||
Size=248,33
|
||||
Collapsed=0
|
||||
|
||||
[Window][Main]
|
||||
Pos=320,138
|
||||
Size=776,556
|
||||
Collapsed=0
|
||||
|
369
example_win32_directx9/main.cpp
Normal file
369
example_win32_directx9/main.cpp
Normal file
@ -0,0 +1,369 @@
|
||||
// Dear ImGui: standalone example application for DirectX 9
|
||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_dx9.h"
|
||||
#include "imgui_impl_win32.h"
|
||||
#include "imgui_internal.h"
|
||||
#include <d3d9.h>
|
||||
#include <tchar.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#define random_f (float a, float b) rand() % (b - a + 1) + a;
|
||||
template<class T, class U>
|
||||
static T clamp(const T& in, const U& low, const U& high)
|
||||
{
|
||||
if (in <= low)
|
||||
return low;
|
||||
|
||||
if (in >= high)
|
||||
return high;
|
||||
|
||||
return in;
|
||||
}
|
||||
// Data
|
||||
static LPDIRECT3D9 g_pD3D = NULL;
|
||||
static LPDIRECT3DDEVICE9 g_pd3dDevice = NULL;
|
||||
static D3DPRESENT_PARAMETERS g_d3dpp = {};
|
||||
|
||||
// Forward declarations of helper functions
|
||||
bool CreateDeviceD3D(HWND hWnd);
|
||||
void CleanupDeviceD3D();
|
||||
void ResetDevice();
|
||||
LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
// Main code
|
||||
#define IM_USE using namespace ImGui;
|
||||
static int tab = 0;
|
||||
#include <math.h>
|
||||
#include "Header.h"
|
||||
#include <d3d9.h>
|
||||
#include <d3dx9.h>
|
||||
#include "Elements.h"
|
||||
#pragma comment (lib, "d3dx9.lib")
|
||||
#pragma comment (lib, "d3d9.lib")
|
||||
void CircularProgressBar(int x, int y, int r1, int r2, int s, int d, ImColor col, bool invert = false)
|
||||
{
|
||||
for (int i = s; i < s + d; i++)
|
||||
{
|
||||
auto rad = i * 3.1415 / 180;
|
||||
if (!invert)
|
||||
ImGui::GetOverlayDrawList()->AddLine(ImVec2(x + cos(rad) * r1, y + sin(rad) * r1), ImVec2(x + cos(rad) * r2, y + sin(rad) * r2), col);
|
||||
else
|
||||
ImGui::GetOverlayDrawList()->AddLine(ImVec2(x - cos(rad) * r1, y - sin(rad) * r1), ImVec2(x - cos(rad) * r2, y - sin(rad) * r2), col);
|
||||
}
|
||||
}
|
||||
|
||||
void FadedCircle(int x, int y, int radius, ImColor color) {
|
||||
auto step = color.Value.w / (radius * 0.5);
|
||||
|
||||
for (int i = 5; i <= radius; i++) {
|
||||
ImGui::GetOverlayDrawList()->AddCircle(ImVec2(x, y), 15 + i, ImColor(color.Value.x, color.Value.y, color.Value.z, color.Value.w - step * i));
|
||||
}
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
int rand_between(const int from, const int to) {
|
||||
if (to == from)
|
||||
return to;
|
||||
if (to < from)
|
||||
return rand_between(to, from);
|
||||
return from + rand() % (to - from + 1);
|
||||
}
|
||||
void CurPosx(int pos)
|
||||
{
|
||||
ImGui::SetCursorPosX(pos);
|
||||
}
|
||||
void CurPosy(int pos)
|
||||
{
|
||||
ImGui::SetCursorPosY(pos);
|
||||
}
|
||||
void CurPos(ImVec2 pos)
|
||||
{
|
||||
ImGui::SetCursorPos(pos);
|
||||
}
|
||||
|
||||
bool gui_key(const char* key_code)
|
||||
{
|
||||
static bool return_me = false;
|
||||
ImGui::SameLine(ImGui::GetWindowSize().x - (ImGui::CalcTextSize(key_code).x + 12));
|
||||
ImGui::PushStyleColor(ImGuiCol_::ImGuiCol_Button, ImVec4(0,0,0,0));
|
||||
ImGui::PushStyleColor(ImGuiCol_::ImGuiCol_ButtonActive, ImVec4(0, 0, 0, 0));
|
||||
ImGui::PushStyleColor(ImGuiCol_::ImGuiCol_ButtonHovered, ImVec4(0, 0, 0, 0));
|
||||
if (ImGui::Button(key_code, ImVec2(ImGui::CalcTextSize(key_code).x + 4, ImGui::CalcTextSize(key_code).y + 2)))return_me = true;
|
||||
ImGui::PopStyleColor(3);
|
||||
return return_me;
|
||||
}
|
||||
#include "imgui_internal.h"
|
||||
void decoration(float alpha, ImVec2 p, ImVec2 s)
|
||||
{
|
||||
auto draw = ImGui::GetWindowDrawList();
|
||||
//Background
|
||||
draw->AddRectFilled(ImVec2(p.x - 1, p.y - 1), ImVec2(p.x + s.x + 1, p.y + s.y + 1), ImColor(57, 71, 159, int(35 * alpha)), 4);
|
||||
draw->AddRectFilled(ImVec2(p.x - 2, p.y - 2), ImVec2(p.x + s.x + 2, p.y + s.y + 2), ImColor(57, 71, 159, int(25 * alpha)), 4);
|
||||
draw->AddRectFilled(ImVec2(p.x - 3, p.y - 3), ImVec2(p.x + s.x + 3, p.y + s.y + 3), ImColor(57, 71, 159, int(15 * alpha)), 4);
|
||||
|
||||
draw->AddRectFilled(ImVec2(p.x + 1, p.y + 1), ImVec2(p.x + s.x, p.y + s.y), ImColor(18, 25, 35, int(255 * alpha)), 4);
|
||||
//Left panel main
|
||||
draw->AddRectFilled(ImVec2(p.x, p.y + 50), ImVec2(p.x + 50, p.y + s.y), ImColor(28, 37, 54, int(255 * alpha)), 4, ImDrawFlags_RoundCornersBottomLeft);
|
||||
//Upper panel main
|
||||
draw->AddRectFilled(ImVec2(p.x + 50, p.y), ImVec2(p.x + s.x, p.y + 50), ImColor(28, 37, 54, int(255 * alpha)), 4, ImDrawFlags_RoundCornersTopRight);
|
||||
//Logo
|
||||
draw->AddRectFilled(ImVec2(p.x, p.y), ImVec2(p.x + 50, p.y + 50), ImColor(7, 152, 245, int(255 * alpha)), 4, ImDrawFlags_RoundCornersTopLeft);
|
||||
draw->AddRectFilledMultiColor(ImVec2(p.x + 5, p.y + 5), ImVec2(p.x + 50, p.y + 50), ImColor(7, 152, 245, int(255 * alpha)), ImColor(57, 71, 159, int(255 * alpha)), ImColor(57, 71, 159, int(255 * alpha)), ImColor(57, 71, 159, int(255 * alpha)));
|
||||
draw->AddRectFilledMultiColor(ImVec2(p.x, p.y + 5), ImVec2(p.x + 5, p.y + 50), ImColor(7, 152, 245, int(255 * alpha)), ImColor(7, 152, 245, int(255 * alpha)), ImColor(57, 71, 159, int(255 * alpha)), ImColor(57, 71, 159, int(255 * alpha)));
|
||||
draw->AddRectFilledMultiColor(ImVec2(p.x + 5, p.y), ImVec2(p.x + 50, p.y + 5), ImColor(7, 152, 245, int(255 * alpha)), ImColor(57, 71, 159, int(255 * alpha)), ImColor(57, 71, 159, int(255 * alpha)), ImColor(7, 152, 245, int(255 * alpha)));
|
||||
draw->AddLine(ImVec2(p.x, p.y + 50), ImVec2(p.x + s.x, p.y + 50), ImColor(5, 25, 35, int(85 * alpha)));
|
||||
draw->AddLine(ImVec2(p.x + 50, p.y), ImVec2(p.x + 50, p.y + s.y), ImColor(5, 25, 35, int(85 * alpha)));
|
||||
}
|
||||
//MAIN COLOR: 112, 146, 190
|
||||
int main(int, char**)
|
||||
{
|
||||
|
||||
// Create application window
|
||||
//ImGui_ImplWin32_EnableDpiAwareness();
|
||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
||||
::RegisterClassEx(&wc);
|
||||
HWND hwnd = ::CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX9 Example"), WS_POPUP, 0, 0, 1366, 768, NULL, NULL, wc.hInstance, NULL);
|
||||
|
||||
// Initialize Direct3D
|
||||
if (!CreateDeviceD3D(hwnd))
|
||||
{
|
||||
CleanupDeviceD3D();
|
||||
::UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Show the window
|
||||
::ShowWindow(hwnd, SW_SHOWDEFAULT);
|
||||
::UpdateWindow(hwnd);
|
||||
|
||||
// Setup Dear ImGui context
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||
|
||||
// Setup Dear ImGui style
|
||||
ImGui::StyleColorsDark();
|
||||
|
||||
// Setup Platform/Renderer backends
|
||||
ImGui_ImplWin32_Init(hwnd);
|
||||
ImGui_ImplDX9_Init(g_pd3dDevice);
|
||||
LPDIRECT3DTEXTURE9 lg = nullptr;
|
||||
if (lg == nullptr) {
|
||||
D3DXCreateTextureFromFileInMemory(g_pd3dDevice, &logo, sizeof(logo), &lg);
|
||||
}
|
||||
// Load Fonts
|
||||
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
|
||||
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
|
||||
// - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
|
||||
// - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
|
||||
// - Read 'docs/FONTS.md' for more instructions and details.
|
||||
// - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
|
||||
//io.Fonts->AddFontDefault();
|
||||
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
|
||||
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
|
||||
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
|
||||
ImFontConfig font_config;
|
||||
font_config.OversampleH = 1; //or 2 is the same
|
||||
font_config.OversampleV = 1;
|
||||
font_config.PixelSnapH = 1;
|
||||
|
||||
static const ImWchar ranges[] =
|
||||
{
|
||||
0x0020, 0x00FF, // Basic Latin + Latin Supplement
|
||||
0x0400, 0x044F, // Cyrillic
|
||||
0,
|
||||
};
|
||||
ImFont* name = io.Fonts->AddFontFromFileTTF("../../misc/fonts/Museo Sans Cyrl 700.ttf", 11.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
||||
ImFont* isis = io.Fonts->AddFontFromFileTTF("../../misc/fonts/Museo Sans Cyrl 700.ttf", 24.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
||||
ImFont* icon_font = io.Fonts->AddFontFromMemoryTTF((void*)Icons, sizeof(Icons), 24, &font_config, io.Fonts->GetGlyphRangesDefault());
|
||||
ImFont* weapon_icons = io.Fonts->AddFontFromMemoryTTF((void*)weapons_font, sizeof(weapons_font), 18, &font_config, io.Fonts->GetGlyphRangesDefault());
|
||||
ImFont* font_desc = io.Fonts->AddFontFromFileTTF("../../misc/fonts/MuseoSansCyrl_0.otf", 11.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
||||
ImFont* font = io.Fonts->AddFontFromFileTTF("../../misc/fonts/MuseoSansCyrl_1.otf", 14.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
||||
ImFont* GuiIcons = io.Fonts->AddFontFromFileTTF("../../misc/fonts/GuiIcons.ttf", 14.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
||||
//IM_ASSERT(font != NULL);
|
||||
|
||||
// Our state
|
||||
bool show_demo_window = true;
|
||||
bool show_another_window = false;
|
||||
ImVec4 clear_color = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
|
||||
// Main loop
|
||||
bool done = false;
|
||||
while (!done)
|
||||
{
|
||||
// Poll and handle messages (inputs, window resize, etc.)
|
||||
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
|
||||
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
|
||||
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
|
||||
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
||||
MSG msg;
|
||||
while (::PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
|
||||
{
|
||||
::TranslateMessage(&msg);
|
||||
::DispatchMessage(&msg);
|
||||
if (msg.message == WM_QUIT)
|
||||
done = true;
|
||||
}
|
||||
if (done)
|
||||
break;
|
||||
|
||||
// Start the Dear ImGui frame
|
||||
ImGui_ImplDX9_NewFrame();
|
||||
ImGui_ImplWin32_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
// Rendering
|
||||
ImVec2 s, p;
|
||||
static int tab = 0;
|
||||
auto pad = ImGui::GetStyle().WindowPadding;
|
||||
//static float gui_alpha = ImClamp(gui_alpha + (3.15f * ImGui::GetIO().DeltaTime * (gui_open ? 1.f : -1.0f)), 0.f, 1.f);
|
||||
ImGui::SetNextWindowSize(ImVec2(760 + pad.x * 2, 540 + pad.y * 2));
|
||||
ImGui::Begin("Main", NULL, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoBackground);
|
||||
{
|
||||
auto alpha = ImGui::GetStyle().Alpha; auto draw = ImGui::GetWindowDrawList(); s = ImVec2(ImGui::GetWindowSize().x - pad.x * 2, ImGui::GetWindowSize().y - pad.y * 2); p = ImVec2(ImGui::GetWindowPos().x + pad.x, ImGui::GetWindowPos().y + pad.y);
|
||||
decoration(alpha, p, s);
|
||||
|
||||
//tabs
|
||||
{
|
||||
ImGui::SetCursorPosY(50 + pad.y);
|
||||
ImGui::BeginGroup();
|
||||
{
|
||||
|
||||
ImGui::PushFont(icon_font);
|
||||
if (ImGui::tab("R", "Ragebot", tab == 0)) tab = 0;
|
||||
if (ImGui::tab("A", "Antiaim", tab == 1)) tab = 1;
|
||||
if (ImGui::tab("L", "Legitbot", tab == 2)) tab = 2;
|
||||
if (ImGui::tab("P", "Players", tab == 3)) tab = 3;
|
||||
if (ImGui::tab("W", "Visuals", tab == 4)) tab = 4;
|
||||
if (ImGui::tab("I", "Skins", tab == 5)) tab = 5;
|
||||
if (ImGui::tab("M", "Misc", tab == 6)) tab = 6;
|
||||
if (ImGui::tab("C", "Configs", tab == 7)) tab = 7;
|
||||
if (ImGui::tab("S", "Scripts", tab == 8)) tab = 8;
|
||||
ImGui::PopFont();
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
switch (tab)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
ImGui::SetCursorPos(ImVec2(60 + pad.x, 75 + pad.y));
|
||||
ImGui::MenuChild("Accuracy", ImVec2(340, 475));
|
||||
{
|
||||
static bool one, two = false; static int sl = 0;
|
||||
ImGui::Checkbox("Checkbox", &one);
|
||||
ImGui::Checkbox("Checkbox disabled", &two);
|
||||
ImGui::SliderInt("Slider", &sl, 0, 100);
|
||||
}
|
||||
ImGui::EndMenuChild();
|
||||
ImGui::SetCursorPos(ImVec2(410 + pad.x, 75 + pad.y));
|
||||
ImGui::MenuChild("Selection", ImVec2(340, 475));
|
||||
{
|
||||
|
||||
}
|
||||
ImGui::EndMenuChild();
|
||||
}break;
|
||||
}
|
||||
|
||||
}
|
||||
ImGui::End();
|
||||
ImGui::EndFrame();
|
||||
g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, 0);
|
||||
g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
g_pd3dDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
|
||||
D3DCOLOR clear_col_dx = D3DCOLOR_RGBA((int)(clear_color.x*clear_color.w*255.0f), (int)(clear_color.y*clear_color.w*255.0f), (int)(clear_color.z*clear_color.w*255.0f), (int)(clear_color.w*255.0f));
|
||||
g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, clear_col_dx, 1.0f, 0);
|
||||
if (g_pd3dDevice->BeginScene() >= 0)
|
||||
{
|
||||
ImGui::Render();
|
||||
ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
|
||||
g_pd3dDevice->EndScene();
|
||||
}
|
||||
HRESULT result = g_pd3dDevice->Present(NULL, NULL, NULL, NULL);
|
||||
|
||||
// Handle loss of D3D9 device
|
||||
if (result == D3DERR_DEVICELOST && g_pd3dDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET)
|
||||
ResetDevice();
|
||||
}
|
||||
|
||||
ImGui_ImplDX9_Shutdown();
|
||||
ImGui_ImplWin32_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
CleanupDeviceD3D();
|
||||
::DestroyWindow(hwnd);
|
||||
::UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Helper functions
|
||||
|
||||
bool CreateDeviceD3D(HWND hWnd)
|
||||
{
|
||||
if ((g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL)
|
||||
return false;
|
||||
|
||||
// Create the D3DDevice
|
||||
ZeroMemory(&g_d3dpp, sizeof(g_d3dpp));
|
||||
g_d3dpp.Windowed = TRUE;
|
||||
g_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
g_d3dpp.BackBufferFormat = D3DFMT_UNKNOWN; // Need to use an explicit format with alpha if needing per-pixel alpha composition.
|
||||
g_d3dpp.EnableAutoDepthStencil = TRUE;
|
||||
g_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
|
||||
g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; // Present with vsync
|
||||
//g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Present without vsync, maximum unthrottled framerate
|
||||
if (g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_d3dpp, &g_pd3dDevice) < 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CleanupDeviceD3D()
|
||||
{
|
||||
if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
|
||||
if (g_pD3D) { g_pD3D->Release(); g_pD3D = NULL; }
|
||||
}
|
||||
|
||||
void ResetDevice()
|
||||
{
|
||||
ImGui_ImplDX9_InvalidateDeviceObjects();
|
||||
HRESULT hr = g_pd3dDevice->Reset(&g_d3dpp);
|
||||
if (hr == D3DERR_INVALIDCALL)
|
||||
IM_ASSERT(0);
|
||||
ImGui_ImplDX9_CreateDeviceObjects();
|
||||
}
|
||||
|
||||
// Forward declare message handler from imgui_impl_win32.cpp
|
||||
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
// Win32 message handler
|
||||
LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam))
|
||||
return true;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_SIZE:
|
||||
if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED)
|
||||
{
|
||||
g_d3dpp.BackBufferWidth = LOWORD(lParam);
|
||||
g_d3dpp.BackBufferHeight = HIWORD(lParam);
|
||||
ResetDevice();
|
||||
}
|
||||
return 0;
|
||||
case WM_SYSCOMMAND:
|
||||
if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu
|
||||
return 0;
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
::PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
return ::DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
}
|
Reference in New Issue
Block a user