Split project into seperate OpenGL and DirectX9 files.
OpenGL support is broken and incomplete.
This commit is contained in:
parent
af93bd0cf5
commit
da96d13a07
@ -1,6 +1,22 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug-Directx9|Win32">
|
||||||
|
<Configuration>Debug-Directx9</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug-Directx9|x64">
|
||||||
|
<Configuration>Debug-Directx9</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug-OpenGL|Win32">
|
||||||
|
<Configuration>Debug-OpenGL</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug-OpenGL|x64">
|
||||||
|
<Configuration>Debug-OpenGL</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
@ -24,7 +40,7 @@
|
|||||||
<ProjectGuid>{6e4373c3-3e97-4007-9b8b-597f55378360}</ProjectGuid>
|
<ProjectGuid>{6e4373c3-3e97-4007-9b8b-597f55378360}</ProjectGuid>
|
||||||
<RootNamespace>ConsoleAppTest</RootNamespace>
|
<RootNamespace>ConsoleAppTest</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
<ProjectName>GuiTestAppCpp</ProjectName>
|
<ProjectName>ImGuiTestCPP</ProjectName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
@ -33,6 +49,12 @@
|
|||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-OpenGL|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
@ -46,6 +68,12 @@
|
|||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-OpenGL|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
@ -53,6 +81,12 @@
|
|||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug-Directx9|Win32'">
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug-Directx9|x64'">
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
@ -61,16 +95,25 @@
|
|||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<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" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-OpenGL|Win32'" 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'">
|
<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" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-OpenGL|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|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Directx9|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
@ -83,6 +126,18 @@
|
|||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-OpenGL|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
@ -106,12 +161,29 @@
|
|||||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||||
<AdditionalIncludeDirectories>lib\imgui\;lib\imgui\backends;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>lib\imgui\;lib\imgui\backends;include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>d3d9.lib;opengl32.lib;glfw3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(ProjectDir)lib\GLFW\lib-vc2022;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-OpenGL|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_OPENGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||||
|
<AdditionalIncludeDirectories>lib\imgui\;lib\imgui\backends;include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>d3d9.lib;opengl32.lib;glfw3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(ProjectDir)lib\GLFW\lib-vc2022;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
@ -130,6 +202,16 @@
|
|||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Directx9|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalIncludeDirectories>lib\imgui\;lib\imgui\backends;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>_DIRECTX9</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>d3d9.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Main.cpp" />
|
<ClCompile Include="Main.cpp" />
|
||||||
<ClCompile Include="lib\ImGui\backends\imgui_impl_dx9.cpp" />
|
<ClCompile Include="lib\ImGui\backends\imgui_impl_dx9.cpp" />
|
||||||
@ -139,6 +221,8 @@
|
|||||||
<ClCompile Include="lib\ImGui\imgui_draw.cpp" />
|
<ClCompile Include="lib\ImGui\imgui_draw.cpp" />
|
||||||
<ClCompile Include="lib\ImGui\imgui_tables.cpp" />
|
<ClCompile Include="lib\ImGui\imgui_tables.cpp" />
|
||||||
<ClCompile Include="lib\ImGui\imgui_widgets.cpp" />
|
<ClCompile Include="lib\ImGui\imgui_widgets.cpp" />
|
||||||
|
<ClCompile Include="test\directx9_test.cpp" />
|
||||||
|
<ClCompile Include="test\opengl_test.cpp" />
|
||||||
<ClCompile Include="util\textFileFunctions.cpp" />
|
<ClCompile Include="util\textFileFunctions.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -150,6 +234,8 @@
|
|||||||
<ClInclude Include="lib\ImGui\imstb_rectpack.h" />
|
<ClInclude Include="lib\ImGui\imstb_rectpack.h" />
|
||||||
<ClInclude Include="lib\ImGui\imstb_textedit.h" />
|
<ClInclude Include="lib\ImGui\imstb_textedit.h" />
|
||||||
<ClInclude Include="lib\ImGui\imstb_truetype.h" />
|
<ClInclude Include="lib\ImGui\imstb_truetype.h" />
|
||||||
|
<ClInclude Include="test\directx9_test.h" />
|
||||||
|
<ClInclude Include="test\opengl_test.h" />
|
||||||
<ClInclude Include="util\textFileFunctions.h" />
|
<ClInclude Include="util\textFileFunctions.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Source Files">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header Files">
|
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
||||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Resource Files">
|
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="Main.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="lib\ImGui\imgui_widgets.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="lib\ImGui\imgui_tables.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="lib\ImGui\imgui_draw.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="lib\ImGui\imgui_demo.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="lib\ImGui\imgui.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="lib\ImGui\backends\imgui_impl_dx9.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="lib\ImGui\backends\imgui_impl_win32.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="util\textFileFunctions.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="lib\ImGui\imstb_truetype.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="lib\ImGui\imstb_textedit.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="lib\ImGui\imstb_rectpack.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="lib\ImGui\imgui_internal.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="lib\ImGui\imgui.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="lib\ImGui\imconfig.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="lib\ImGui\backends\imgui_impl_dx9.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="lib\ImGui\backends\imgui_impl_win32.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="util\textFileFunctions.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -3,12 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.8.34330.188
|
VisualStudioVersion = 17.8.34330.188
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleAppTest", "ConsoleAppTest.vcxproj", "{6E4373C3-3E97-4007-9B8B-597F55378360}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImGuiTestCPP", "ConsoleAppTest.vcxproj", "{6E4373C3-3E97-4007-9B8B-597F55378360}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
Debug|x86 = Debug|x86
|
Debug|x86 = Debug|x86
|
||||||
|
Debug-Directx9|x64 = Debug-Directx9|x64
|
||||||
|
Debug-Directx9|x86 = Debug-Directx9|x86
|
||||||
|
Debug-OpenGL|x64 = Debug-OpenGL|x64
|
||||||
|
Debug-OpenGL|x86 = Debug-OpenGL|x86
|
||||||
Release|x64 = Release|x64
|
Release|x64 = Release|x64
|
||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
@ -17,6 +21,14 @@ Global
|
|||||||
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug|x64.Build.0 = Debug|x64
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug|x64.Build.0 = Debug|x64
|
||||||
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug|x86.ActiveCfg = Debug|Win32
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug|x86.Build.0 = Debug|Win32
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug-Directx9|x64.ActiveCfg = Debug-Directx9|x64
|
||||||
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug-Directx9|x64.Build.0 = Debug-Directx9|x64
|
||||||
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug-Directx9|x86.ActiveCfg = Debug-Directx9|Win32
|
||||||
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug-Directx9|x86.Build.0 = Debug-Directx9|Win32
|
||||||
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug-OpenGL|x64.ActiveCfg = Debug-OpenGL|x64
|
||||||
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug-OpenGL|x64.Build.0 = Debug-OpenGL|x64
|
||||||
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug-OpenGL|x86.ActiveCfg = Debug-OpenGL|Win32
|
||||||
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Debug-OpenGL|x86.Build.0 = Debug-OpenGL|Win32
|
||||||
{6E4373C3-3E97-4007-9B8B-597F55378360}.Release|x64.ActiveCfg = Release|x64
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Release|x64.ActiveCfg = Release|x64
|
||||||
{6E4373C3-3E97-4007-9B8B-597F55378360}.Release|x64.Build.0 = Release|x64
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Release|x64.Build.0 = Release|x64
|
||||||
{6E4373C3-3E97-4007-9B8B-597F55378360}.Release|x86.ActiveCfg = Release|Win32
|
{6E4373C3-3E97-4007-9B8B-597F55378360}.Release|x86.ActiveCfg = Release|Win32
|
399
Main.cpp
399
Main.cpp
@ -1,3 +1,5 @@
|
|||||||
|
#ifdef _TEST
|
||||||
|
#ifdef _DIRECTX9
|
||||||
// Dear ImGui: standalone example application for DirectX 9
|
// Dear ImGui: standalone example application for DirectX 9
|
||||||
|
|
||||||
// Learn about Dear ImGui:
|
// Learn about Dear ImGui:
|
||||||
@ -6,9 +8,15 @@
|
|||||||
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||||
// - Introduction, links and more at the top of imgui.cpp
|
// - Introduction, links and more at the top of imgui.cpp
|
||||||
|
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_dx9.h"
|
#include "imgui_impl_dx9.h"
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
#include "imgui_impl_win32.h"
|
#include "imgui_impl_win32.h"
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <d3d9.h>
|
#include <d3d9.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
|
|
||||||
@ -18,6 +26,15 @@
|
|||||||
|
|
||||||
#include "util/textFileFunctions.h"
|
#include "util/textFileFunctions.h"
|
||||||
|
|
||||||
|
// https://www.geeksforgeeks.org/macros-and-its-types-in-c-cpp/
|
||||||
|
// Test macros
|
||||||
|
#define LIMIT 5
|
||||||
|
|
||||||
|
// Test code
|
||||||
|
#ifndef _TEST
|
||||||
|
#define _TEST
|
||||||
|
#endif
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
static LPDIRECT3D9 g_pD3D = nullptr;
|
static LPDIRECT3D9 g_pD3D = nullptr;
|
||||||
static LPDIRECT3DDEVICE9 g_pd3dDevice = nullptr;
|
static LPDIRECT3DDEVICE9 g_pd3dDevice = nullptr;
|
||||||
@ -42,6 +59,17 @@ static void HelpMarker(const char* desc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Windows specific features
|
||||||
|
// https://stackoverflow.com/questions/41600981/how-do-i-check-if-a-key-is-pressed-on-c
|
||||||
|
#ifdef _WIN32
|
||||||
|
SHORT keyState = GetKeyState(VK_CAPITAL/*(caps lock)*/);
|
||||||
|
bool isToggled = keyState & 1;
|
||||||
|
bool isDown = keyState & 0x8000;
|
||||||
|
//[DllImport("kernel32.dll")]
|
||||||
|
//static extern IntPtr GetConsoleWindow();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Will this work?
|
// Will this work?
|
||||||
|
|
||||||
static void setBulletText(const char* text)
|
static void setBulletText(const char* text)
|
||||||
@ -51,11 +79,63 @@ static void setBulletText(const char* text)
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
int test()
|
||||||
|
{
|
||||||
|
int num1 = 5;
|
||||||
|
int num2 = 10;
|
||||||
|
|
||||||
|
return num1 + num2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://www.geeksforgeeks.org/converting-number-to-string-in-cpp/
|
||||||
|
// Prints the value of
|
||||||
|
std::string testString1()
|
||||||
|
{
|
||||||
|
int num1 = 5;
|
||||||
|
int num2 = 10;
|
||||||
|
int sum = num1 + num2;
|
||||||
|
std::string num1_string = std::to_string(num1);
|
||||||
|
std::string num2_string = std::to_string(num2);
|
||||||
|
std::string sum_string = std::to_string(sum);
|
||||||
|
|
||||||
|
return "The value of " + num1_string + " + " + num2_string + " = " + sum_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// imgui_demo line 256
|
||||||
|
static void ShowWindow(bool* p_open)
|
||||||
|
{
|
||||||
|
static bool show_main_menu = false;
|
||||||
|
|
||||||
|
if (show_main_menu)
|
||||||
|
{
|
||||||
|
if (ImGui::Begin("Test"))
|
||||||
|
{
|
||||||
|
ImGui::Text("Hello World!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ImGui::Begin("Test", p_open))
|
||||||
|
{
|
||||||
|
|
||||||
|
ImGui::End();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Main code
|
// Main code
|
||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifdef _TEST
|
||||||
|
//std::cout << testString1();
|
||||||
|
std::cout << "Hello world!";
|
||||||
|
|
||||||
|
#else
|
||||||
// Create application window
|
// Create application window
|
||||||
//ImGui_ImplWin32_EnableDpiAwareness();
|
//ImGui_ImplWin32_EnableDpiAwareness();
|
||||||
WNDCLASSEXW wc = { sizeof(wc), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(nullptr), nullptr, nullptr, nullptr, nullptr, L"ImGui Example", nullptr };
|
WNDCLASSEXW wc = { sizeof(wc), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(nullptr), nullptr, nullptr, nullptr, nullptr, L"ImGui Example", nullptr };
|
||||||
::RegisterClassExW(&wc);
|
::RegisterClassExW(&wc);
|
||||||
HWND hwnd = ::CreateWindowW(wc.lpszClassName, L"Dear ImGui DirectX9 Example", WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, nullptr, nullptr, wc.hInstance, nullptr);
|
HWND hwnd = ::CreateWindowW(wc.lpszClassName, L"Dear ImGui DirectX9 Example", WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, nullptr, nullptr, wc.hInstance, nullptr);
|
||||||
@ -109,11 +189,14 @@ int main(int, char**)
|
|||||||
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
||||||
|
|
||||||
// Show window
|
// Show window
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Main loop
|
// Main loop
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
bool button1_clicked = false;
|
||||||
|
static bool show_app_main_menu_bar = false;
|
||||||
|
//static bool toggle_text = false;
|
||||||
|
static bool dark_mode = false;
|
||||||
|
static bool define_test = false;
|
||||||
|
|
||||||
while (!done)
|
while (!done)
|
||||||
{
|
{
|
||||||
// Poll and handle messages (inputs, window resize, etc.)
|
// Poll and handle messages (inputs, window resize, etc.)
|
||||||
@ -143,116 +226,216 @@ int main(int, char**)
|
|||||||
ImGui_ImplWin32_NewFrame();
|
ImGui_ImplWin32_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
static bool show_app_main_menu_bar = false;
|
if (ImGui::Begin("My new window", nullptr, ImGuiWindowFlags_MenuBar))
|
||||||
static bool toggle_text = false;
|
{
|
||||||
|
// Menu bar
|
||||||
|
if (ImGui::BeginMenuBar())
|
||||||
if (ImGui::Begin("My new window", nullptr, ImGuiWindowFlags_MenuBar))
|
|
||||||
{
|
{
|
||||||
if (ImGui::CollapsingHeader("test1"))
|
if (ImGui::BeginMenu("Test"))
|
||||||
{
|
{
|
||||||
ImGui::BulletText("Hello, this should show up.");
|
ImGui::MenuItem("Main menu bar", NULL, &show_app_main_menu_bar);
|
||||||
ImGui::Separator();
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
ImGui::EndMenuBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Main testing header.
|
||||||
|
if (ImGui::CollapsingHeader("test1"))
|
||||||
if (ImGui::Button("Menu toggle"))
|
{
|
||||||
{
|
ImGui::BulletText("Hello, this should show up.");
|
||||||
std::cout << "Test" << std::endl;
|
ImGui::Separator();
|
||||||
// How would I check if dark mode is enabled?
|
|
||||||
//if (ImGui::GetStyle == ImGui) {
|
|
||||||
//ImGui::StyleColorsLight();
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
// {
|
|
||||||
//ImGui::StyleColorsDark();
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// I couldn't figure this out yet.
|
// Menu toggle button
|
||||||
// This shows up for a second then dies.
|
if (ImGui::Button("Menu toggle"))
|
||||||
ImGui::Separator();
|
{
|
||||||
if (ImGui::Button("Click"))
|
std::cout << "Test" << std::endl;
|
||||||
|
// How would I check if dark mode is enabled?
|
||||||
|
//if (ImGui::GetStyle == ImGui) {
|
||||||
|
//ImGui::StyleColorsLight();
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
// {
|
||||||
|
//ImGui::StyleColorsDark();
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// I couldn't figure this out yet.
|
||||||
|
// This shows up for a second then dies.
|
||||||
|
ImGui::Separator();
|
||||||
|
if (!ImGui::Button("Click"))
|
||||||
|
{
|
||||||
|
button1_clicked = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
button1_clicked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!button1_clicked)
|
||||||
|
{
|
||||||
|
setBulletText("You clicked the button");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::BulletText("Button not pressed.");
|
||||||
|
|
||||||
|
//ImGui::BulletText("You clicked the button!");
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
|
||||||
|
//if (ImGui::Button("Click"))
|
||||||
|
//{
|
||||||
|
|
||||||
|
// setBulletText("You clicked the button");
|
||||||
|
// //ImGui::BulletText("You clicked the button!");
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// ImGui::BulletText("Button not pressed.");
|
||||||
|
//}
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
|
||||||
|
// This below works for a dark mode toggle.
|
||||||
|
// 5-16-2024 @ 9:14PM
|
||||||
|
|
||||||
|
#ifndef _TEST
|
||||||
|
#define _TEST
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _TEST
|
||||||
|
// Well the checkbox is inverted lol, oh well I'll fix it later.
|
||||||
|
// If it is checked it turns off dark mode, I guess its because I have dark mode as the default theme.
|
||||||
|
if (!ImGui::Checkbox("Dark Mode", &dark_mode))
|
||||||
|
{
|
||||||
|
if (!dark_mode)
|
||||||
{
|
{
|
||||||
|
|
||||||
setBulletText("You clicked the button");
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::BulletText("You clicked the button!");
|
ImGui::BulletText("On");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
ImGui::BulletText("Button not pressed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
|
|
||||||
// This below works for a dark mode toggle.
|
|
||||||
// 5-16-2024 @ 9:14PM
|
|
||||||
ImGui::Checkbox("Dark Mode", &toggle_text);
|
|
||||||
|
|
||||||
if (toggle_text)
|
|
||||||
{
|
{
|
||||||
ImGui::StyleColorsLight();
|
ImGui::StyleColorsLight();
|
||||||
ImGui::BulletText("Off");
|
ImGui::BulletText("Off");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
ImGui::StyleColorsDark();
|
|
||||||
ImGui::BulletText("On");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Possibly implement feature to read from a text file and write it to some output box.
|
|
||||||
ImGui::Text("Test");
|
|
||||||
|
|
||||||
//if (ImGui::Checkbox("Show Text", &toggle_text))
|
|
||||||
//{
|
|
||||||
// ImGui::BulletText("Hello");
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// ImGui::BulletText("Hola");
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
// How do I update this text in code?
|
|
||||||
// Like if a button is pressed.
|
|
||||||
//ImGui::Separator();
|
|
||||||
//ImGui::BulletText("Test");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::CollapsingHeader("Text File Functions"))
|
#else
|
||||||
|
ImGui::Checkbox("Dark Mode", &dark_mode);
|
||||||
|
if (dark_mode)
|
||||||
{
|
{
|
||||||
ImGui::BulletText("I will add reading files, writing and more to this.");
|
ImGui::StyleColorsLight();
|
||||||
ImGui::Separator();
|
ImGui::BulletText("Off");
|
||||||
|
|
||||||
// I almost got this working 5-17-2024 @ 3:14PM
|
|
||||||
// It doesn't print out all of the lines from the return value.
|
|
||||||
if (ImGui::Button("Test"))
|
|
||||||
{
|
|
||||||
std::cout << TextFileFunctions::printTextOutput("test.txt") << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::StyleColorsDark();
|
||||||
|
|
||||||
//if (ImGui::BeginMenu("My menu"))
|
ImGui::BulletText("On");
|
||||||
|
}
|
||||||
|
#endif //_TEST
|
||||||
|
// Disable preprocessor
|
||||||
|
#undef _TEST
|
||||||
|
|
||||||
|
// This works for toggling the demo window on and off
|
||||||
|
ImGui::Checkbox("Demo window", &show_demo_window);
|
||||||
|
|
||||||
|
|
||||||
|
// Possibly implement feature to read from a text file and write it to some output box.
|
||||||
|
//ImGui::Text("Test");
|
||||||
|
|
||||||
|
//const char *test = "Test";
|
||||||
|
|
||||||
|
//// I never did get this working yet.
|
||||||
|
//// https://www.programiz.com/cpp-programming/buffer
|
||||||
|
//char* buf = new char[40];
|
||||||
|
////char InputBuf[256];
|
||||||
|
//// https://stackoverflow.com/questions/502856/whats-the-difference-between-size-t-and-int-in-c
|
||||||
|
//size_t num = 1;
|
||||||
|
////char deref = &test;
|
||||||
|
|
||||||
|
//// This doesn't work right.
|
||||||
|
//if (ImGui::InputText("##Username", buf, num))
|
||||||
//{
|
//{
|
||||||
// //ImGui::BulletText("You should see this");
|
// //std::cout << buf;
|
||||||
// ImGui::MenuItem("test", NULL);
|
|
||||||
// ImGui::EndMenu();
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} ImGui::End();
|
// This works.
|
||||||
|
if (ImGui::IsMousePosValid())
|
||||||
|
ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y);
|
||||||
|
else
|
||||||
|
ImGui::Text("Mouse pos: <INVALID>");
|
||||||
|
|
||||||
|
//if (ImGui::Checkbox("Show Text", &toggle_text))
|
||||||
|
//{
|
||||||
|
// ImGui::BulletText("Hello");
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// ImGui::BulletText("Hola");
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
// How do I update this text in code?
|
||||||
|
// Like if a button is pressed.
|
||||||
|
//ImGui::Separator();
|
||||||
|
//ImGui::BulletText("Test");
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _TEST
|
||||||
|
ImGui::Checkbox("Define Test", &define_test);
|
||||||
|
|
||||||
|
if (define_test)
|
||||||
|
{
|
||||||
|
ImGui::Text("Value of limit is: " + LIMIT);
|
||||||
|
std::cout << "Value of limit is " << LIMIT;
|
||||||
|
}
|
||||||
|
#endif //_TEST
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// End main test menu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Text file functions test menu
|
||||||
|
if (ImGui::CollapsingHeader("Text File Functions"))
|
||||||
|
{
|
||||||
|
ImGui::BulletText("I will add reading files, writing and more to this.");
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
// I almost got this working 5-17-2024 @ 3:14PM
|
||||||
|
// It doesn't print out all of the lines from the return value.
|
||||||
|
if (ImGui::Button("Test"))
|
||||||
|
{
|
||||||
|
TextFileFunctions::printTextOutput("test.txt");
|
||||||
|
//std::cout << TextFileFunctions::printTextOutput("test.txt") << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// End Text file functions test menu
|
||||||
|
|
||||||
|
//if (ImGui::BeginMenu("My menu"))
|
||||||
|
//{
|
||||||
|
// //ImGui::BulletText("You should see this");
|
||||||
|
// ImGui::MenuItem("test", NULL);
|
||||||
|
// ImGui::EndMenu();
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
// End ImGui
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::EndFrame();
|
ImGui::EndFrame();
|
||||||
@ -283,6 +466,9 @@ int main(int, char**)
|
|||||||
::UnregisterClassW(wc.lpszClassName, wc.hInstance);
|
::UnregisterClassW(wc.lpszClassName, wc.hInstance);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif //_TEST
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper functions
|
// Helper functions
|
||||||
@ -353,3 +539,38 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
return ::DefWindowProcW(hWnd, msg, wParam, lParam);
|
return ::DefWindowProcW(hWnd, msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //_DIRECTX9
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Main code
|
||||||
|
// I moved the DirectX9 code into the test/directx9_test.cpp file,
|
||||||
|
// The code above is disabled with a preprocessor.
|
||||||
|
|
||||||
|
#ifdef _DIRECTX9
|
||||||
|
#include "test/directx9_test.h"
|
||||||
|
#endif //_DIRECTX9
|
||||||
|
|
||||||
|
#ifdef _OPENGL
|
||||||
|
#include "test/opengl_test.h"
|
||||||
|
#endif //_OPENGL
|
||||||
|
|
||||||
|
int main(int, char**)
|
||||||
|
{
|
||||||
|
#ifdef _DIRECTX9
|
||||||
|
DirectX9Test::directX9Test();
|
||||||
|
#endif //_DIRECTX9
|
||||||
|
|
||||||
|
#ifdef _OPENGL
|
||||||
|
OpenGLTest::openGLTest();
|
||||||
|
#endif //_OPENGL
|
||||||
|
|
||||||
|
//std::cout << "Hello World";
|
||||||
|
}
|
||||||
|
#endif // _TEST
|
15
imgui.ini
15
imgui.ini
@ -4,7 +4,7 @@ Size=400,400
|
|||||||
Collapsed=1
|
Collapsed=1
|
||||||
|
|
||||||
[Window][Dear ImGui Demo]
|
[Window][Dear ImGui Demo]
|
||||||
Pos=654,43
|
Pos=652,43
|
||||||
Size=550,680
|
Size=550,680
|
||||||
|
|
||||||
[Window][Hello, world!]
|
[Window][Hello, world!]
|
||||||
@ -12,7 +12,7 @@ Pos=116,183
|
|||||||
Size=339,180
|
Size=339,180
|
||||||
|
|
||||||
[Window][My new window]
|
[Window][My new window]
|
||||||
Pos=48,170
|
Pos=10,55
|
||||||
Size=517,436
|
Size=517,436
|
||||||
|
|
||||||
[Window][Example: Console]
|
[Window][Example: Console]
|
||||||
@ -35,3 +35,14 @@ Size=499,136
|
|||||||
IsChild=1
|
IsChild=1
|
||||||
Size=200,100
|
Size=200,100
|
||||||
|
|
||||||
|
[Table][0x64418101,3]
|
||||||
|
RefScale=13
|
||||||
|
Column 0 Width=63
|
||||||
|
Column 1 Width=63
|
||||||
|
Column 2 Width=63
|
||||||
|
|
||||||
|
[Table][0xE0773582,3]
|
||||||
|
Column 0 Weight=1.0000
|
||||||
|
Column 1 Weight=1.0000
|
||||||
|
Column 2 Weight=1.0000
|
||||||
|
|
||||||
|
3
links.txt
Normal file
3
links.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
ImGui C++ (Used for this project): https://github.com/ocornut/imgui
|
||||||
|
|
||||||
|
C++ Naming scheme: https://manual.gromacs.org/documentation/2019/dev-manual/naming.html
|
552
test/directx9_test.cpp
Normal file
552
test/directx9_test.cpp
Normal file
@ -0,0 +1,552 @@
|
|||||||
|
#include "directx9_test.h"
|
||||||
|
|
||||||
|
// I would like to move opengl and directx into their own classes.
|
||||||
|
// So I can switch between them and the main file won't be so messy.
|
||||||
|
|
||||||
|
#ifndef _TEST
|
||||||
|
#define _TEST
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _DIRECTX9
|
||||||
|
//#define _DIRECTX9
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _DIRECTX9
|
||||||
|
#ifdef _TEST
|
||||||
|
// Dear ImGui: standalone example application for DirectX 9
|
||||||
|
|
||||||
|
// Learn about Dear ImGui:
|
||||||
|
// - FAQ https://dearimgui.com/faq
|
||||||
|
// - Getting Started https://dearimgui.com/getting-started
|
||||||
|
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||||
|
// - Introduction, links and more at the top of imgui.cpp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "imgui_impl_dx9.h"
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
#include "imgui_impl_win32.h"
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <d3d9.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include "../util/textFileFunctions.h"
|
||||||
|
|
||||||
|
// https://www.geeksforgeeks.org/macros-and-its-types-in-c-cpp/
|
||||||
|
// Test macros
|
||||||
|
#define LIMIT 5
|
||||||
|
|
||||||
|
// Test code
|
||||||
|
#ifndef _TEST
|
||||||
|
//#define _TEST
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Data
|
||||||
|
static LPDIRECT3D9 g_pD3D = nullptr;
|
||||||
|
static LPDIRECT3DDEVICE9 g_pd3dDevice = nullptr;
|
||||||
|
static UINT g_ResizeWidth = 0, g_ResizeHeight = 0;
|
||||||
|
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);
|
||||||
|
|
||||||
|
static void HelpMarker(const char* desc)
|
||||||
|
{
|
||||||
|
ImGui::TextDisabled("(?)");
|
||||||
|
if (ImGui::BeginItemTooltip())
|
||||||
|
{
|
||||||
|
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
||||||
|
ImGui::TextUnformatted(desc);
|
||||||
|
ImGui::PopTextWrapPos();
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Windows specific features
|
||||||
|
// https://stackoverflow.com/questions/41600981/how-do-i-check-if-a-key-is-pressed-on-c
|
||||||
|
#ifdef _WIN32
|
||||||
|
SHORT keyState = GetKeyState(VK_CAPITAL/*(caps lock)*/);
|
||||||
|
bool isToggled = keyState & 1;
|
||||||
|
bool isDown = keyState & 0x8000;
|
||||||
|
//[DllImport("kernel32.dll")]
|
||||||
|
//static extern IntPtr GetConsoleWindow();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Will this work?
|
||||||
|
|
||||||
|
static void setBulletText(const char* text)
|
||||||
|
{
|
||||||
|
ImGui::BulletText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
int test()
|
||||||
|
{
|
||||||
|
int num1 = 5;
|
||||||
|
int num2 = 10;
|
||||||
|
|
||||||
|
return num1 + num2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://www.geeksforgeeks.org/converting-number-to-string-in-cpp/
|
||||||
|
// Prints the value of
|
||||||
|
std::string testString1()
|
||||||
|
{
|
||||||
|
int num1 = 5;
|
||||||
|
int num2 = 10;
|
||||||
|
int sum = num1 + num2;
|
||||||
|
std::string num1_string = std::to_string(num1);
|
||||||
|
std::string num2_string = std::to_string(num2);
|
||||||
|
std::string sum_string = std::to_string(sum);
|
||||||
|
|
||||||
|
return "The value of " + num1_string + " + " + num2_string + " = " + sum_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// imgui_demo line 256
|
||||||
|
static void ShowWindow(bool* p_open)
|
||||||
|
{
|
||||||
|
static bool show_main_menu = false;
|
||||||
|
|
||||||
|
if (show_main_menu)
|
||||||
|
{
|
||||||
|
if (ImGui::Begin("Test"))
|
||||||
|
{
|
||||||
|
ImGui::Text("Hello World!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ImGui::Begin("Test", p_open))
|
||||||
|
{
|
||||||
|
|
||||||
|
ImGui::End();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Main code
|
||||||
|
void DirectX9Test::directX9Test()
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef _TEST
|
||||||
|
std::cout << testString1();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Create application window
|
||||||
|
//ImGui_ImplWin32_EnableDpiAwareness();
|
||||||
|
WNDCLASSEXW wc = { sizeof(wc), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(nullptr), nullptr, nullptr, nullptr, nullptr, L"ImGui Example", nullptr };
|
||||||
|
::RegisterClassExW(&wc);
|
||||||
|
HWND hwnd = ::CreateWindowW(wc.lpszClassName, L"Dear ImGui DirectX9 Example", WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, nullptr, nullptr, wc.hInstance, nullptr);
|
||||||
|
|
||||||
|
// Initialize Direct3D
|
||||||
|
if (!CreateDeviceD3D(hwnd))
|
||||||
|
{
|
||||||
|
CleanupDeviceD3D();
|
||||||
|
::UnregisterClassW(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();
|
||||||
|
//ImGui::StyleColorsLight();
|
||||||
|
|
||||||
|
// Setup Platform/Renderer backends
|
||||||
|
ImGui_ImplWin32_Init(hwnd);
|
||||||
|
ImGui_ImplDX9_Init(g_pd3dDevice);
|
||||||
|
|
||||||
|
// 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 a nullptr. 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.
|
||||||
|
// - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use Freetype for higher quality font rendering.
|
||||||
|
// - 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("c:\\Windows\\Fonts\\segoeui.ttf", 18.0f);
|
||||||
|
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
|
||||||
|
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
|
||||||
|
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
|
||||||
|
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, nullptr, io.Fonts->GetGlyphRangesJapanese());
|
||||||
|
//IM_ASSERT(font != nullptr);
|
||||||
|
|
||||||
|
// Our state
|
||||||
|
bool show_demo_window = true;
|
||||||
|
bool show_another_window = false;
|
||||||
|
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
||||||
|
|
||||||
|
// Show window
|
||||||
|
// Main loop
|
||||||
|
bool done = false;
|
||||||
|
bool button1_clicked = false;
|
||||||
|
static bool show_app_main_menu_bar = false;
|
||||||
|
//static bool toggle_text = false;
|
||||||
|
static bool dark_mode = false;
|
||||||
|
static bool define_test = false;
|
||||||
|
|
||||||
|
while (!done)
|
||||||
|
{
|
||||||
|
// Poll and handle messages (inputs, window resize, etc.)
|
||||||
|
// See the WndProc() function below for our to dispatch events to the Win32 backend.
|
||||||
|
MSG msg;
|
||||||
|
while (::PeekMessage(&msg, nullptr, 0U, 0U, PM_REMOVE))
|
||||||
|
{
|
||||||
|
::TranslateMessage(&msg);
|
||||||
|
::DispatchMessage(&msg);
|
||||||
|
if (msg.message == WM_QUIT)
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
if (done)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Handle window resize (we don't resize directly in the WM_SIZE handler)
|
||||||
|
if (g_ResizeWidth != 0 && g_ResizeHeight != 0)
|
||||||
|
{
|
||||||
|
g_d3dpp.BackBufferWidth = g_ResizeWidth;
|
||||||
|
g_d3dpp.BackBufferHeight = g_ResizeHeight;
|
||||||
|
g_ResizeWidth = g_ResizeHeight = 0;
|
||||||
|
ResetDevice();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start the Dear ImGui frame
|
||||||
|
ImGui_ImplDX9_NewFrame();
|
||||||
|
ImGui_ImplWin32_NewFrame();
|
||||||
|
ImGui::NewFrame();
|
||||||
|
|
||||||
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
if (ImGui::Begin("My new window", nullptr, ImGuiWindowFlags_MenuBar))
|
||||||
|
{
|
||||||
|
// Menu bar
|
||||||
|
if (ImGui::BeginMenuBar())
|
||||||
|
{
|
||||||
|
if (ImGui::BeginMenu("Test"))
|
||||||
|
{
|
||||||
|
ImGui::MenuItem("Main menu bar", NULL, &show_app_main_menu_bar);
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
ImGui::EndMenuBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Main testing header.
|
||||||
|
if (ImGui::CollapsingHeader("test1"))
|
||||||
|
{
|
||||||
|
ImGui::BulletText("Hello, this should show up.");
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
// Menu toggle button
|
||||||
|
if (ImGui::Button("Menu toggle"))
|
||||||
|
{
|
||||||
|
std::cout << "Test" << std::endl;
|
||||||
|
// How would I check if dark mode is enabled?
|
||||||
|
//if (ImGui::GetStyle == ImGui) {
|
||||||
|
//ImGui::StyleColorsLight();
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
// {
|
||||||
|
//ImGui::StyleColorsDark();
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// I couldn't figure this out yet.
|
||||||
|
// This shows up for a second then dies.
|
||||||
|
ImGui::Separator();
|
||||||
|
if (!ImGui::Button("Click"))
|
||||||
|
{
|
||||||
|
button1_clicked = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
button1_clicked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!button1_clicked)
|
||||||
|
{
|
||||||
|
setBulletText("You clicked the button");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::BulletText("Button not pressed.");
|
||||||
|
|
||||||
|
//ImGui::BulletText("You clicked the button!");
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
|
||||||
|
//if (ImGui::Button("Click"))
|
||||||
|
//{
|
||||||
|
|
||||||
|
// setBulletText("You clicked the button");
|
||||||
|
// //ImGui::BulletText("You clicked the button!");
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// ImGui::BulletText("Button not pressed.");
|
||||||
|
//}
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
|
||||||
|
// This below works for a dark mode toggle.
|
||||||
|
// 5-16-2024 @ 9:14PM
|
||||||
|
|
||||||
|
#ifndef _TEST
|
||||||
|
#define _TEST
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _TEST
|
||||||
|
// Well the checkbox is inverted lol, oh well I'll fix it later.
|
||||||
|
// If it is checked it turns off dark mode, I guess its because I have dark mode as the default theme.
|
||||||
|
if (!ImGui::Checkbox("Dark Mode", &dark_mode))
|
||||||
|
{
|
||||||
|
if (!dark_mode)
|
||||||
|
{
|
||||||
|
|
||||||
|
ImGui::StyleColorsDark();
|
||||||
|
ImGui::BulletText("On");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::StyleColorsLight();
|
||||||
|
ImGui::BulletText("Off");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
ImGui::Checkbox("Dark Mode", &dark_mode);
|
||||||
|
if (dark_mode)
|
||||||
|
{
|
||||||
|
ImGui::StyleColorsLight();
|
||||||
|
ImGui::BulletText("Off");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::StyleColorsDark();
|
||||||
|
|
||||||
|
ImGui::BulletText("On");
|
||||||
|
}
|
||||||
|
#endif //_TEST
|
||||||
|
// Disable preprocessor
|
||||||
|
#undef _TEST
|
||||||
|
|
||||||
|
// This works for toggling the demo window on and off
|
||||||
|
ImGui::Checkbox("Demo window", &show_demo_window);
|
||||||
|
|
||||||
|
|
||||||
|
// Possibly implement feature to read from a text file and write it to some output box.
|
||||||
|
//ImGui::Text("Test");
|
||||||
|
|
||||||
|
//const char *test = "Test";
|
||||||
|
|
||||||
|
//// I never did get this working yet.
|
||||||
|
//// https://www.programiz.com/cpp-programming/buffer
|
||||||
|
//char* buf = new char[40];
|
||||||
|
////char InputBuf[256];
|
||||||
|
//// https://stackoverflow.com/questions/502856/whats-the-difference-between-size-t-and-int-in-c
|
||||||
|
//size_t num = 1;
|
||||||
|
////char deref = &test;
|
||||||
|
|
||||||
|
//// This doesn't work right.
|
||||||
|
//if (ImGui::InputText("##Username", buf, num))
|
||||||
|
//{
|
||||||
|
// //std::cout << buf;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// This works.
|
||||||
|
if (ImGui::IsMousePosValid())
|
||||||
|
ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y);
|
||||||
|
else
|
||||||
|
ImGui::Text("Mouse pos: <INVALID>");
|
||||||
|
|
||||||
|
//if (ImGui::Checkbox("Show Text", &toggle_text))
|
||||||
|
//{
|
||||||
|
// ImGui::BulletText("Hello");
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// ImGui::BulletText("Hola");
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
// How do I update this text in code?
|
||||||
|
// Like if a button is pressed.
|
||||||
|
//ImGui::Separator();
|
||||||
|
//ImGui::BulletText("Test");
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _TEST
|
||||||
|
ImGui::Checkbox("Define Test", &define_test);
|
||||||
|
|
||||||
|
if (define_test)
|
||||||
|
{
|
||||||
|
ImGui::Text("Value of limit is: " + LIMIT);
|
||||||
|
std::cout << "Value of limit is " << LIMIT;
|
||||||
|
}
|
||||||
|
#endif //_TEST
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// End main test menu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Text file functions test menu
|
||||||
|
if (ImGui::CollapsingHeader("Text File Functions"))
|
||||||
|
{
|
||||||
|
ImGui::BulletText("I will add reading files, writing and more to this.");
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
// I almost got this working 5-17-2024 @ 3:14PM
|
||||||
|
// It doesn't print out all of the lines from the return value.
|
||||||
|
if (ImGui::Button("Test"))
|
||||||
|
{
|
||||||
|
TextFileFunctions::printTextOutput("test.txt");
|
||||||
|
//std::cout << TextFileFunctions::printTextOutput("test.txt") << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// End Text file functions test menu
|
||||||
|
|
||||||
|
//if (ImGui::BeginMenu("My menu"))
|
||||||
|
//{
|
||||||
|
// //ImGui::BulletText("You should see this");
|
||||||
|
// ImGui::MenuItem("test", NULL);
|
||||||
|
// ImGui::EndMenu();
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
// End ImGui
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
|
// Rendering
|
||||||
|
ImGui::EndFrame();
|
||||||
|
g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
|
||||||
|
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, nullptr, 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(nullptr, nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
::UnregisterClassW(wc.lpszClassName, wc.hInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper functions
|
||||||
|
|
||||||
|
bool CreateDeviceD3D(HWND hWnd)
|
||||||
|
{
|
||||||
|
if ((g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == nullptr)
|
||||||
|
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 = nullptr; }
|
||||||
|
if (g_pD3D) { g_pD3D->Release(); g_pD3D = nullptr; }
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
// 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, or clear/overwrite your copy of the mouse data.
|
||||||
|
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application, or clear/overwrite your copy of the keyboard data.
|
||||||
|
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
||||||
|
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 (wParam == SIZE_MINIMIZED)
|
||||||
|
return 0;
|
||||||
|
g_ResizeWidth = (UINT)LOWORD(lParam); // Queue resize
|
||||||
|
g_ResizeHeight = (UINT)HIWORD(lParam);
|
||||||
|
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 ::DefWindowProcW(hWnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //_TEST
|
||||||
|
#endif //_DIRECTX9
|
5
test/directx9_test.h
Normal file
5
test/directx9_test.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
class DirectX9Test {
|
||||||
|
public:
|
||||||
|
static void directX9Test();
|
||||||
|
};
|
209
test/opengl_test.cpp
Normal file
209
test/opengl_test.cpp
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
#include "opengl_test.h"
|
||||||
|
|
||||||
|
// Moving opengl test into this file until I'm ready to mess with it.
|
||||||
|
// 5-25-2024 @ 12:21PM
|
||||||
|
|
||||||
|
#ifndef _OPENGL
|
||||||
|
//#define _OPENGL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// I never did get this one working.
|
||||||
|
// Keeps giving linker errors and library not found errors.
|
||||||
|
#ifdef _OPENGL
|
||||||
|
|
||||||
|
// Dear ImGui: standalone example application for GLFW + OpenGL 3, using programmable pipeline
|
||||||
|
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan/Metal graphics context creation, etc.)
|
||||||
|
|
||||||
|
// Learn about Dear ImGui:
|
||||||
|
// - FAQ https://dearimgui.com/faq
|
||||||
|
// - Getting Started https://dearimgui.com/getting-started
|
||||||
|
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||||
|
// - Introduction, links and more at the top of imgui.cpp
|
||||||
|
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "imgui_impl_glfw.h"
|
||||||
|
#include "imgui_impl_opengl3.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#define GL_SILENCE_DEPRECATION
|
||||||
|
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||||
|
#include <GLES2/gl2.h>
|
||||||
|
#endif
|
||||||
|
#include <GLFW/glfw3.h> // Will drag system OpenGL headers
|
||||||
|
|
||||||
|
// [Win32] Our example includes a copy of glfw3.lib pre-compiled with VS2010 to maximize ease of testing and compatibility with old VS compilers.
|
||||||
|
// To link with VS2010-era libraries, VS2015+ requires linking with legacy_stdio_definitions.lib, which we do using this pragma.
|
||||||
|
// Your own project should not be affected, as you are likely to link with a newer binary of GLFW that is adequate for your version of Visual Studio.
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1900) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
||||||
|
#pragma comment(lib, "legacy_stdio_definitions")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// This example can also compile and run with Emscripten! See 'Makefile.emscripten' for details.
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
#include "../libs/emscripten/emscripten_mainloop_stub.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void glfw_error_callback(int error, const char* description)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "GLFW Error %d: %s\n", error, description);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Main code
|
||||||
|
void OpenGLTest::openGLTest()
|
||||||
|
{
|
||||||
|
glfwSetErrorCallback(glfw_error_callback);
|
||||||
|
if (!glfwInit())
|
||||||
|
|
||||||
|
// Decide GL+GLSL versions
|
||||||
|
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||||
|
// GL ES 2.0 + GLSL 100
|
||||||
|
const char* glsl_version = "#version 100";
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||||
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
// GL 3.2 + GLSL 150
|
||||||
|
const char* glsl_version = "#version 150";
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||||
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only
|
||||||
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Required on Mac
|
||||||
|
#else
|
||||||
|
// GL 3.0 + GLSL 130
|
||||||
|
const char* glsl_version = "#version 130";
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||||
|
//glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only
|
||||||
|
//glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // 3.0+ only
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Create window with graphics context
|
||||||
|
GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+OpenGL3 example", nullptr, nullptr);
|
||||||
|
if (window == nullptr)
|
||||||
|
glfwMakeContextCurrent(window);
|
||||||
|
glfwSwapInterval(1); // Enable vsync
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
//ImGui::StyleColorsLight();
|
||||||
|
|
||||||
|
// Setup Platform/Renderer backends
|
||||||
|
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback("#canvas");
|
||||||
|
#endif
|
||||||
|
ImGui_ImplOpenGL3_Init(glsl_version);
|
||||||
|
|
||||||
|
// 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 a nullptr. 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.
|
||||||
|
// - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use Freetype for higher quality font rendering.
|
||||||
|
// - 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 \\ !
|
||||||
|
// - Our Emscripten build process allows embedding fonts to be accessible at runtime from the "fonts/" folder. See Makefile.emscripten for details.
|
||||||
|
//io.Fonts->AddFontDefault();
|
||||||
|
//io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf", 18.0f);
|
||||||
|
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
|
||||||
|
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
|
||||||
|
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
|
||||||
|
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, nullptr, io.Fonts->GetGlyphRangesJapanese());
|
||||||
|
//IM_ASSERT(font != nullptr);
|
||||||
|
|
||||||
|
// Our state
|
||||||
|
bool show_demo_window = true;
|
||||||
|
bool show_another_window = false;
|
||||||
|
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
||||||
|
|
||||||
|
// Main loop
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
// For an Emscripten build we are disabling file-system access, so let's not attempt to do a fopen() of the imgui.ini file.
|
||||||
|
// You may manually call LoadIniSettingsFromMemory() to load settings from your own storage.
|
||||||
|
io.IniFilename = nullptr;
|
||||||
|
EMSCRIPTEN_MAINLOOP_BEGIN
|
||||||
|
#else
|
||||||
|
while (!glfwWindowShouldClose(window))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
// Poll and handle events (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, or clear/overwrite your copy of the mouse data.
|
||||||
|
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application, or clear/overwrite your copy of the keyboard data.
|
||||||
|
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
||||||
|
glfwPollEvents();
|
||||||
|
|
||||||
|
// Start the Dear ImGui frame
|
||||||
|
ImGui_ImplOpenGL3_NewFrame();
|
||||||
|
ImGui_ImplGlfw_NewFrame();
|
||||||
|
ImGui::NewFrame();
|
||||||
|
|
||||||
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
|
if (show_demo_window)
|
||||||
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
|
{
|
||||||
|
static float f = 0.0f;
|
||||||
|
static int counter = 0;
|
||||||
|
|
||||||
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
||||||
|
|
||||||
|
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||||
|
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||||
|
ImGui::Checkbox("Another Window", &show_another_window);
|
||||||
|
|
||||||
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
|
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||||
|
|
||||||
|
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||||
|
counter++;
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Text("counter = %d", counter);
|
||||||
|
|
||||||
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Show another simple window.
|
||||||
|
if (show_another_window)
|
||||||
|
{
|
||||||
|
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
||||||
|
ImGui::Text("Hello from another window!");
|
||||||
|
if (ImGui::Button("Close Me"))
|
||||||
|
show_another_window = false;
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rendering
|
||||||
|
ImGui::Render();
|
||||||
|
int display_w, display_h;
|
||||||
|
glfwGetFramebufferSize(window, &display_w, &display_h);
|
||||||
|
glViewport(0, 0, display_w, display_h);
|
||||||
|
glClearColor(clear_color.x * clear_color.w, clear_color.y * clear_color.w, clear_color.z * clear_color.w, clear_color.w);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
||||||
|
glfwSwapBuffers(window);
|
||||||
|
}
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
EMSCRIPTEN_MAINLOOP_END;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
ImGui_ImplOpenGL3_Shutdown();
|
||||||
|
ImGui_ImplGlfw_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
|
|
||||||
|
glfwDestroyWindow(window);
|
||||||
|
glfwTerminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif //_OPENGL
|
5
test/opengl_test.h
Normal file
5
test/opengl_test.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
class OpenGLTest{
|
||||||
|
public:
|
||||||
|
static void openGLTest();
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user