diff options
Diffstat (limited to 'Editor/EditorMain.cpp')
-rw-r--r-- | Editor/EditorMain.cpp | 105 |
1 files changed, 77 insertions, 28 deletions
diff --git a/Editor/EditorMain.cpp b/Editor/EditorMain.cpp index 8868d88..9d77862 100644 --- a/Editor/EditorMain.cpp +++ b/Editor/EditorMain.cpp @@ -2,46 +2,95 @@ #include <vector>
#include "GUI/EditorWindows.h"
#include "Runtime/Scripting/LuaBind.h"
+#include "EditorManager.h"
+#include "Runtime/Graphics/OpenGL.h"
+
+// EditorÈë¿Ú
+
static int MainMessageLoop() {
- BOOL returnValue; - MSG msg, lastMsg; - msg.message = WM_NULL; - std::vector<MSG> messages; - PeekMessage(&msg, NULL, 0U, 0U, PM_NOREMOVE); - bool isQuitSignaled = msg.message == WM_QUIT; -
- while (!isQuitSignaled)
- {
- MSG msg; - while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE) != 0) - { - TranslateMessage(&msg); - DispatchMessage(&msg); + BOOL returnValue; + MSG msg, lastMsg; + msg.message = WM_NULL; + std::vector<MSG> messages; + PeekMessage(&msg, NULL, 0U, 0U, PM_NOREMOVE); + bool isQuitSignaled = msg.message == WM_QUIT; +
+ while (!isQuitSignaled)
+ {
+ MSG msg; + while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE) != 0) + { + TranslateMessage(&msg); + DispatchMessage(&msg); - if (msg.message == WM_QUIT) - isQuitSignaled = true; + if (msg.message == WM_QUIT) + isQuitSignaled = true; - - } + } - }
+ }
- return (INT)msg.wParam; + return (INT)msg.wParam; +}
+
+void OpenLogTags()
+{
+ //log_open_tag("WndProc");
+ //log_open_tag("Menu");
}
+#ifdef GAMELAB_DEBUG
+int main() +#else int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) +#endif {
- RegisterWindowClasses();
+ OpenLogTags();
+ WindowUtil::Init();
+
+ ContainnerWindow* wnd = new ContainnerWindow();
+ Vector2f min = Vector2f(100, 100);
+ Vector2f max = Vector2f(700, 700);
+ wnd->Init(Rectf(400, 400, 800, 500), ContainnerWindow::kShowMainWindow, min, max);
+ wnd->SetTitle("GameLab");
+ wnd->SetIcon("./Icon/GameLab.ico");
+
+ EditorManager::Instance()->SetMainWindow(wnd);
+ MenuManager::Instance()->Init();
+
+ GUIWindow* guiWnd = new GUIWindow();
+ guiWnd->Init();
+ guiWnd->SetContainnerWindow(wnd);
+ Rectf position;
+ position.x = 0;
+ position.y = 0;
+ position.width = 200;
+ position.height = 200;
+ guiWnd->SetPosition(position);
+
+ GUIWindow* guiWnd2 = new GUIWindow();
+ guiWnd2->Init();
+ guiWnd2->SetContainnerWindow(wnd);
+ position.x = 200;
+ position.y = 0;
+ position.width = 200;
+ position.height = 200;
+ guiWnd2->SetPosition(position);
+
+ // init gl
+ wglMakeCurrent(guiWnd2->GetDC(), guiWnd2->GetRC());
+ if (!gladLoadGL()) {
+ log_error("³õʼ»¯GL´íÎó");
+ }
- ContainnerWindow* wnd = new ContainnerWindow();
+ // force repaint
+ wnd->DoPaint();
+ guiWnd->DoPaint();
+ guiWnd2->DoPaint();
- Vector2f min = Vector2f(100, 100);
- Vector2f max = Vector2f(700, 700);
- wnd->Init(Rectf(400, 400, 500, 500), ContainnerWindow::kShowMainWindow, min, max);
+ MainMessageLoop();
- MainMessageLoop();
-
- return 0;
+ return 0;
}
\ No newline at end of file |