From 2ba76bc9b7ad18e734fd989cf7b868b52d0e5b75 Mon Sep 17 00:00:00 2001 From: Vulpovile Date: Fri, 5 Mar 2021 22:23:40 -0800 Subject: [PATCH] Renamed G3D-Fun to Blocks3D --- G3DTest.dsp => Blocks3D.dsp | 20 +++++++------- G3DTest.dsw => Blocks3D.dsw | 2 +- G3DTest.sln => Blocks3D.sln | 2 +- G3DTest.vcproj => Blocks3D.vcproj | 24 ++++++++-------- src/source/DataModel/GuiRootInstance.cpp | 2 ++ src/source/Listener/MenuButtonListener.cpp | 32 ++++++++++++++++++++++ src/source/main.cpp | 21 ++++++++++++++ 7 files changed, 79 insertions(+), 24 deletions(-) rename G3DTest.dsp => Blocks3D.dsp (86%) rename G3DTest.dsw => Blocks3D.dsw (89%) rename G3DTest.sln => Blocks3D.sln (85%) rename G3DTest.vcproj => Blocks3D.vcproj (96%) diff --git a/G3DTest.dsp b/Blocks3D.dsp similarity index 86% rename from G3DTest.dsp rename to Blocks3D.dsp index acdea3a..f387ffc 100644 --- a/G3DTest.dsp +++ b/Blocks3D.dsp @@ -1,24 +1,24 @@ -# Microsoft Developer Studio Project File - Name="G3DTest" - Package Owner=<4> +# Microsoft Developer Studio Project File - Name="Blocks3D" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Application" 0x0101 -CFG=G3DTest - Win32 Debug +CFG=Blocks3D - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE -!MESSAGE NMAKE /f "G3DTest.mak". +!MESSAGE NMAKE /f "Blocks3D.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE -!MESSAGE NMAKE /f "G3DTest.mak" CFG="G3DTest - Win32 Debug" +!MESSAGE NMAKE /f "Blocks3D.mak" CFG="Blocks3D - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE -!MESSAGE "G3DTest - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "G3DTest - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "Blocks3D - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "Blocks3D - Win32 Debug" (based on "Win32 (x86) Application") !MESSAGE # Begin Project @@ -29,7 +29,7 @@ CPP=cl.exe MTL=midl.exe RSC=rc.exe -!IF "$(CFG)" == "G3DTest - Win32 Release" +!IF "$(CFG)" == "Blocks3D - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 @@ -54,7 +54,7 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -!ELSEIF "$(CFG)" == "G3DTest - Win32 Debug" +!ELSEIF "$(CFG)" == "Blocks3D - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 @@ -83,8 +83,8 @@ LINK32=link.exe # Begin Target -# Name "G3DTest - Win32 Release" -# Name "G3DTest - Win32 Debug" +# Name "Blocks3D - Win32 Release" +# Name "Blocks3D - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" diff --git a/G3DTest.dsw b/Blocks3D.dsw similarity index 89% rename from G3DTest.dsw rename to Blocks3D.dsw index 49454be..b9e739d 100644 --- a/G3DTest.dsw +++ b/Blocks3D.dsw @@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00 ############################################################################### -Project: "G3DTest"=.\G3DTest.dsp - Package Owner=<4> +Project: "Blocks3D"=.\Blocks3D.dsp - Package Owner=<4> Package=<5> {{{ diff --git a/G3DTest.sln b/Blocks3D.sln similarity index 85% rename from G3DTest.sln rename to Blocks3D.sln index 897497e..836a214 100644 --- a/G3DTest.sln +++ b/Blocks3D.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 9.00 # Visual C++ Express 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "G3DTest", "G3DTest.vcproj", "{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Blocks3D", "Blocks3D.vcproj", "{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/G3DTest.vcproj b/Blocks3D.vcproj similarity index 96% rename from G3DTest.vcproj rename to Blocks3D.vcproj index 55bac88..11afcb6 100644 --- a/G3DTest.vcproj +++ b/Blocks3D.vcproj @@ -2,9 +2,9 @@ @@ -95,7 +95,7 @@ @@ -193,7 +193,7 @@ fontLocationRelativeTo = Vector2(10, 0); button->setAllColorsSame(); button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F); + button->name = "file"; + button->setButtonListener(new MenuButtonListener()); button = makeTextButton(); button->boxBegin = Vector2(125, 0); diff --git a/src/source/Listener/MenuButtonListener.cpp b/src/source/Listener/MenuButtonListener.cpp index fe585d3..10f5eba 100644 --- a/src/source/Listener/MenuButtonListener.cpp +++ b/src/source/Listener/MenuButtonListener.cpp @@ -8,4 +8,36 @@ void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button) g_dataModel->toggleRun(); ((ToggleImageButtonInstance*)button)->checked = g_dataModel->isRunning(); } + else if(button->name == "file") + { + HMENU hPopupMenu = CreatePopupMenu(); + HWND hwnd = CreateWindowEx( + WS_EX_APPWINDOW, + "MenuWindow", + "Main test", + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, + CW_USEDEFAULT, + 800, + 660, + NULL, // parent + NULL, // menu + GetModuleHandle(NULL), + NULL + ); + + AppendMenu(hPopupMenu, MF_STRING, 0, "Test"); + if(hPopupMenu == NULL) + { + MessageBox(NULL, "Menu is null!", "Failed", MB_OK); + } + else if(hwnd == NULL) + { + MessageBox(NULL, "HWND is null!", "Failed", MB_OK); + } + else if(!TrackPopupMenu(hPopupMenu, TPM_LEFTBUTTON, 100, 100, 0, hwnd, 0)) + { + MessageBox(NULL, "Failed to track!", "Failed", MB_OK); + } + } } \ No newline at end of file diff --git a/src/source/main.cpp b/src/source/main.cpp index 35cb162..253d7d0 100644 --- a/src/source/main.cpp +++ b/src/source/main.cpp @@ -145,6 +145,25 @@ LRESULT CALLBACK G3DProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return 0; } + +LRESULT CALLBACK MenuProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + Application *app = (Application *)GetWindowLongPtr(hwnd, GWL_USERDATA); + if (app==NULL) + { + return DefWindowProc(hwnd, msg, wParam, lParam); + } + switch(msg) + { + default: + { + return DefWindowProc(hwnd, msg, wParam, lParam); + } + } + + return 0; +} + int main(int argc, char** argv) { try{ hresult = OleInitialize(NULL); @@ -187,6 +206,8 @@ int main(int argc, char** argv) { return false; if (!createWindowClass("G3DWindow",G3DProc,hThisInstance)) return false; + if (!createWindowClass("MenuWindow",MenuProc,hThisInstance)) + return false; HWND hwndMain = CreateWindowEx( WS_EX_APPWINDOW,