Switched imgui over to SDL implementation, dialog input works.

This commit is contained in:
Justin Marshall
2020-06-07 21:13:25 -07:00
parent 290a7fb1c5
commit 871d7a8601
7 changed files with 31 additions and 13 deletions
+5
View File
@@ -2539,6 +2539,8 @@ void Go_Editor(bool flag)
*/ */
if (flag) { if (flag) {
AudMix_SetMusicState(false); // jmarshall: disable music if we are in editor mode AudMix_SetMusicState(false); // jmarshall: disable music if we are in editor mode
Hide_Mouse();
ShowCursor(TRUE);
Debug_Map = true; Debug_Map = true;
Debug_Unshroud = true; Debug_Unshroud = true;
@@ -2570,6 +2572,9 @@ void Go_Editor(bool flag)
} else { } else {
AudMix_SetMusicState(true); // jmarshall: enable music if we are going back into editor mode. AudMix_SetMusicState(true); // jmarshall: enable music if we are going back into editor mode.
Show_Mouse();
ShowCursor(FALSE);
/* /*
** Go into normal game mode ** Go into normal game mode
*/ */
+2 -2
View File
@@ -172,7 +172,7 @@
<ClCompile Include="..\ddraw\ddrawwrapper\DirectDrawSurfaceWrapper.cpp" /> <ClCompile Include="..\ddraw\ddrawwrapper\DirectDrawSurfaceWrapper.cpp" />
<ClCompile Include="..\ddraw\ddrawwrapper\DirectDrawWrapper.cpp" /> <ClCompile Include="..\ddraw\ddrawwrapper\DirectDrawWrapper.cpp" />
<ClCompile Include="..\external\imgui\examples\imgui_impl_dx9.cpp" /> <ClCompile Include="..\external\imgui\examples\imgui_impl_dx9.cpp" />
<ClCompile Include="..\external\imgui\examples\imgui_impl_win32.cpp" /> <ClCompile Include="..\external\imgui\examples\imgui_impl_sdl.cpp" />
<ClCompile Include="..\external\imgui\imgui.cpp" /> <ClCompile Include="..\external\imgui\imgui.cpp" />
<ClCompile Include="..\external\imgui\imgui_draw.cpp" /> <ClCompile Include="..\external\imgui\imgui_draw.cpp" />
<ClCompile Include="..\external\imgui\imgui_widgets.cpp" /> <ClCompile Include="..\external\imgui\imgui_widgets.cpp" />
@@ -488,7 +488,7 @@
<ClInclude Include="..\ddraw\ddrawwrapper\DirectDrawWrapper.h" /> <ClInclude Include="..\ddraw\ddrawwrapper\DirectDrawWrapper.h" />
<ClInclude Include="..\ddraw\ddrawwrapper\resource.h" /> <ClInclude Include="..\ddraw\ddrawwrapper\resource.h" />
<ClInclude Include="..\external\imgui\examples\imgui_impl_dx9.h" /> <ClInclude Include="..\external\imgui\examples\imgui_impl_dx9.h" />
<ClInclude Include="..\external\imgui\examples\imgui_impl_win32.h" /> <ClInclude Include="..\external\imgui\examples\imgui_impl_sdl.h" />
<ClInclude Include="..\external\imgui\imconfig.h" /> <ClInclude Include="..\external\imgui\imconfig.h" />
<ClInclude Include="..\external\imgui\imgui.h" /> <ClInclude Include="..\external\imgui\imgui.h" />
<ClInclude Include="..\external\imgui\imgui_internal.h" /> <ClInclude Include="..\external\imgui\imgui_internal.h" />
+6 -6
View File
@@ -951,9 +951,6 @@
<ClCompile Include="..\external\imgui\examples\imgui_impl_dx9.cpp"> <ClCompile Include="..\external\imgui\examples\imgui_impl_dx9.cpp">
<Filter>Source Files\imgui</Filter> <Filter>Source Files\imgui</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\external\imgui\examples\imgui_impl_win32.cpp">
<Filter>Source Files\imgui</Filter>
</ClCompile>
<ClCompile Include="..\external\imgui\imgui.cpp"> <ClCompile Include="..\external\imgui\imgui.cpp">
<Filter>Source Files\imgui</Filter> <Filter>Source Files\imgui</Filter>
</ClCompile> </ClCompile>
@@ -963,6 +960,9 @@
<ClCompile Include="..\external\imgui\imgui_widgets.cpp"> <ClCompile Include="..\external\imgui\imgui_widgets.cpp">
<Filter>Source Files\imgui</Filter> <Filter>Source Files\imgui</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\external\imgui\examples\imgui_impl_sdl.cpp">
<Filter>Source Files\imgui</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="ABSTRACT.H"> <ClInclude Include="ABSTRACT.H">
@@ -1865,9 +1865,6 @@
<ClInclude Include="..\external\imgui\examples\imgui_impl_dx9.h"> <ClInclude Include="..\external\imgui\examples\imgui_impl_dx9.h">
<Filter>Source Files\imgui</Filter> <Filter>Source Files\imgui</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\external\imgui\examples\imgui_impl_win32.h">
<Filter>Source Files\imgui</Filter>
</ClInclude>
<ClInclude Include="..\external\imgui\imconfig.h"> <ClInclude Include="..\external\imgui\imconfig.h">
<Filter>Source Files\imgui</Filter> <Filter>Source Files\imgui</Filter>
</ClInclude> </ClInclude>
@@ -1886,6 +1883,9 @@
<ClInclude Include="..\external\imgui\imstb_truetype.h"> <ClInclude Include="..\external\imgui\imstb_truetype.h">
<Filter>Source Files\imgui</Filter> <Filter>Source Files\imgui</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\external\imgui\examples\imgui_impl_sdl.h">
<Filter>Source Files\imgui</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="COORDA.ASM"> <None Include="COORDA.ASM">
+3 -2
View File
@@ -37,11 +37,12 @@
// jmarshall - imgui // jmarshall - imgui
#include "imgui.h" #include "imgui.h"
#include "examples/imgui_impl_win32.h" #include "examples/imgui_impl_sdl.h"
#include "examples/imgui_impl_dx9.h" #include "examples/imgui_impl_dx9.h"
#include <d3d9.h> #include <d3d9.h>
extern LPDIRECT3DDEVICE9 globald3d9Device; extern LPDIRECT3DDEVICE9 globald3d9Device;
extern SDL_Window* game_window;
// jmarshall end // jmarshall end
@@ -574,7 +575,7 @@ int PASCAL WinMain ( HINSTANCE instance , HINSTANCE , char * command_line , int
//ImGui::StyleColorsClassic(); //ImGui::StyleColorsClassic();
// Setup Platform/Renderer bindings // Setup Platform/Renderer bindings
ImGui_ImplWin32_Init(MainWindow); ImGui_ImplSDL2_InitForD3D(game_window);
ImGui_ImplDX9_Init(globald3d9Device); ImGui_ImplDX9_Init(globald3d9Device);
io.Fonts->AddFontFromFileTTF("code/fonts/Roboto-Medium.ttf", 16.0f); io.Fonts->AddFontFromFileTTF("code/fonts/Roboto-Medium.ttf", 16.0f);
+4
View File
@@ -318,6 +318,10 @@ void WWMouseClass::Hide_Mouse()
void WWMouseClass::Low_Show_Mouse(int x, int y) void WWMouseClass::Low_Show_Mouse(int x, int y)
{ {
extern bool Debug_Map;
if (Debug_Map)
return;
// //
// If the mouse is completely visible then draw it at its current // If the mouse is completely visible then draw it at its current
// position. // position.
+6 -1
View File
@@ -41,9 +41,11 @@
* Focus_Loss -- this function is called when a library function detects focus loss * * Focus_Loss -- this function is called when a library function detects focus loss *
* Memory_Error_Handler -- Handle a possibly fatal failure to allocate memory * * Memory_Error_Handler -- Handle a possibly fatal failure to allocate memory *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "imgui.h"
#include "examples/imgui_impl_sdl.h"
#include "function.h" #include "function.h"
#ifdef WINSOCK_IPX #ifdef WINSOCK_IPX
#include "WSProto.h" #include "WSProto.h"
#else //WINSOCK_IPX #else //WINSOCK_IPX
@@ -755,6 +757,9 @@ void WWSDL_ProcessEvents(KeyNumType& key, int& flags) {
Keyboard->Put_Element(event.key.keysym.sym); Keyboard->Put_Element(event.key.keysym.sym);
break; break;
} }
if (Debug_Map)
ImGui_ImplSDL2_ProcessEvent(&event);
} }
if (!leftMouseProcessed && numFramesLMouse != 0) if (!leftMouseProcessed && numFramesLMouse != 0)
+5 -2
View File
@@ -1,10 +1,11 @@
#define UNICODE #define UNICODE
#include "DirectDrawWrapper.h" #include "DirectDrawWrapper.h"
#include "imgui.h" #include "imgui.h"
#include "examples/imgui_impl_win32.h" #include "examples/imgui_impl_sdl.h"
#include "examples/imgui_impl_dx9.h" #include "examples/imgui_impl_dx9.h"
//#include "resource.h" //#include "resource.h"
LPDIRECT3DDEVICE9 globald3d9Device; LPDIRECT3DDEVICE9 globald3d9Device;
extern SDL_Window* game_window;
/******************* /*******************
**IUnknown methods** **IUnknown methods**
@@ -1324,10 +1325,12 @@ HRESULT IDirectDrawWrapper::Present()
if (Imgui_Dialog_Function) { if (Imgui_Dialog_Function) {
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
io.DisplaySize = ImVec2(displayWidth, displayHeight); io.DisplaySize = ImVec2(displayWidth, displayHeight);
ImGui_ImplDX9_NewFrame(); ImGui_ImplDX9_NewFrame();
ImGui::NewFrame(); ImGui::NewFrame();
ImGui_ImplSDL2_NewFrame(game_window);
Imgui_Dialog_Function(); Imgui_Dialog_Function();
ImGui::Render(); ImGui::Render();