Sort of got menus working (not great design though)
This commit is contained in:
@@ -21,6 +21,7 @@ public:
|
|||||||
static int surfaceId;
|
static int surfaceId;
|
||||||
static const std::string g_PlaceholderName;
|
static const std::string g_PlaceholderName;
|
||||||
static COLORREF g_acrCustClr[16]; //Will be dynamic later
|
static COLORREF g_acrCustClr[16]; //Will be dynamic later
|
||||||
|
static HWND mainHwnd;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::vector<Instance*> postRenderStack;
|
extern std::vector<Instance*> postRenderStack;
|
||||||
@@ -36,4 +37,5 @@ extern COLORREF g_acrCustClr[16]; //Will be dynamic later
|
|||||||
extern std::string cameraSound;
|
extern std::string cameraSound;
|
||||||
extern std::string clickSound;
|
extern std::string clickSound;
|
||||||
extern std::string dingSound;
|
extern std::string dingSound;
|
||||||
|
extern HWND mainHwnd;
|
||||||
const std::string g_PlaceholderName = "Dygysphere";
|
const std::string g_PlaceholderName = "Dygysphere";
|
||||||
@@ -136,6 +136,8 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
|
|||||||
button->fontLocationRelativeTo = Vector2(10, 0);
|
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||||
button->setAllColorsSame();
|
button->setAllColorsSame();
|
||||||
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||||
|
button->name = "file";
|
||||||
|
button->setButtonListener(new MenuButtonListener());
|
||||||
|
|
||||||
button = makeTextButton();
|
button = makeTextButton();
|
||||||
button->boxBegin = Vector2(125, 0);
|
button->boxBegin = Vector2(125, 0);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ POINT Globals::mousepoint;
|
|||||||
|
|
||||||
GFontRef g_fntdominant = NULL;
|
GFontRef g_fntdominant = NULL;
|
||||||
GFontRef g_fntlighttrek = NULL;
|
GFontRef g_fntlighttrek = NULL;
|
||||||
|
HWND Globals::mainHwnd = NULL;
|
||||||
|
|
||||||
Globals::Globals(void){}
|
Globals::Globals(void){}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "Listener/MenuButtonListener.h"
|
#include "Listener/MenuButtonListener.h"
|
||||||
#include "DataModel/ToggleImageButtonInstance.h"
|
#include "DataModel/ToggleImageButtonInstance.h"
|
||||||
|
#include "Application.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
{
|
{
|
||||||
@@ -8,4 +9,15 @@ void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
g_dataModel->toggleRun();
|
g_dataModel->toggleRun();
|
||||||
((ToggleImageButtonInstance*)button)->checked = g_dataModel->isRunning();
|
((ToggleImageButtonInstance*)button)->checked = g_dataModel->isRunning();
|
||||||
}
|
}
|
||||||
|
else if(button->name == "file")
|
||||||
|
{
|
||||||
|
HMENU mainmenu = CreatePopupMenu();
|
||||||
|
AppendMenu(mainmenu, MF_STRING, 100, "New");
|
||||||
|
AppendMenu(mainmenu, MF_STRING, 101, "Open...");
|
||||||
|
AppendMenu(mainmenu, MF_STRING, 101, "Close");
|
||||||
|
AppendMenu(mainmenu, MF_SEPARATOR, 0, NULL);
|
||||||
|
POINT p;
|
||||||
|
GetCursorPos(&p);
|
||||||
|
TrackPopupMenu(mainmenu, TPM_LEFTBUTTON, p.x, p.y, 0, Globals::mainHwnd, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
SendMessage(hwndMain, WM_SETICON, ICON_BIG,(LPARAM)LoadImage(GetModuleHandle(NULL), (LPCSTR)MAKEINTRESOURCEW(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE));
|
SendMessage(hwndMain, WM_SETICON, ICON_BIG,(LPARAM)LoadImage(GetModuleHandle(NULL), (LPCSTR)MAKEINTRESOURCEW(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE));
|
||||||
|
|
||||||
|
Globals::mainHwnd = hwndMain;
|
||||||
Application app = Application(hwndMain);
|
Application app = Application(hwndMain);
|
||||||
app.run();
|
app.run();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user