diff options
Diffstat (limited to 'source/Asura.Editor')
-rw-r--r-- | source/Asura.Editor/Config.h | 0 | ||||
-rw-r--r-- | source/Asura.Editor/Configure/BuildConfigure.h | 8 | ||||
-rw-r--r-- | source/Asura.Editor/Controls/GUILabel.cpp | 2 | ||||
-rw-r--r-- | source/Asura.Editor/Core/GUIState.h | 4 | ||||
-rw-r--r-- | source/Asura.Editor/Editor.cpp | 52 | ||||
-rw-r--r-- | source/Asura.Editor/Editor.h | 33 | ||||
-rw-r--r-- | source/Asura.Editor/Main.cpp | 51 | ||||
-rw-r--r-- | source/Asura.Editor/System/Input.cpp | 61 | ||||
-rw-r--r-- | source/Asura.Editor/config.h | 0 | ||||
-rw-r--r-- | source/Asura.Editor/editor.cpp | 52 | ||||
-rw-r--r-- | source/Asura.Editor/editor.h | 33 | ||||
-rw-r--r-- | source/Asura.Editor/main.cpp | 51 |
12 files changed, 236 insertions, 111 deletions
diff --git a/source/Asura.Editor/Config.h b/source/Asura.Editor/Config.h deleted file mode 100644 index e69de29..0000000 --- a/source/Asura.Editor/Config.h +++ /dev/null diff --git a/source/Asura.Editor/Configure/BuildConfigure.h b/source/Asura.Editor/Configure/BuildConfigure.h new file mode 100644 index 0000000..6fd3aad --- /dev/null +++ b/source/Asura.Editor/Configure/BuildConfigure.h @@ -0,0 +1,8 @@ +// Copy to asura-configure folder + +#ifndef _ASURA_EDITOR_CONFIGURE_H_ +#define _ASURA_EDITOR_CONFIGURE_H_ + +#define ASURA_EDITOR 1 + +#endif
\ No newline at end of file diff --git a/source/Asura.Editor/Controls/GUILabel.cpp b/source/Asura.Editor/Controls/GUILabel.cpp index c5741c1..90b277b 100644 --- a/source/Asura.Editor/Controls/GUILabel.cpp +++ b/source/Asura.Editor/Controls/GUILabel.cpp @@ -1,4 +1,4 @@ -#include "gui_button.h" +#include "GUIButton.h" namespace_begin(AsuraEditor) diff --git a/source/Asura.Editor/Core/GUIState.h b/source/Asura.Editor/Core/GUIState.h index 88c9891..0abaf58 100644 --- a/source/Asura.Editor/Core/GUIState.h +++ b/source/Asura.Editor/Core/GUIState.h @@ -19,9 +19,9 @@ private: }; +extern GUIState g_GUIState; namespace_end -#endif - +#endif
\ No newline at end of file diff --git a/source/Asura.Editor/Editor.cpp b/source/Asura.Editor/Editor.cpp index 38e7c26..6ffd789 100644 --- a/source/Asura.Editor/Editor.cpp +++ b/source/Asura.Editor/Editor.cpp @@ -1,5 +1,51 @@ +#include "Editor.h" -int main(int argc, char *argv[]) +#include <vector> + +namespace_begin(AsuraEditor) + +void TranslateAndDispatch(MSG& msg) +{ + //if (g_BatchMode || !TranslateAccelerator(gMainWindow, GetMainMenuAccelerators(), &msg)) + //{ + // ResetGfxDeviceIfNeeded(); + // TranslateMessage(&msg); + // DispatchMessage(&msg); + //} +} + +int MainMessageLoop() { - -}
\ No newline at end of file + MSG msg, lastMsg; + msg.message = WM_NULL; + std::vector<MSG> messages; + PeekMessage(&msg, NULL, 0U, 0U, PM_NOREMOVE); + bool isQuit = msg.message == WM_QUIT; + while (!isQuit) + { + messages.clear(); + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + if (msg.message == WM_INPUT || msg.message == WM_PAINT) + { + + } + + if (msg.message == WM_QUIT) + isQuit = true; + + messages.push_back(msg); + + if (messages.size() > 100) + break; + } + + for (unsigned i = 0; i < messages.size(); ++i) + { + msg = messages[i]; + } + } +} + + +namespace_end
\ No newline at end of file diff --git a/source/Asura.Editor/Editor.h b/source/Asura.Editor/Editor.h index 2f5f8ca..ab91ab7 100644 --- a/source/Asura.Editor/Editor.h +++ b/source/Asura.Editor/Editor.h @@ -2,36 +2,15 @@ #define _ASURA_EDITOR_H_ #include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Classes.h> -namespace AsuraEditor -{ - - /// - /// ༭ʵ - /// - class Editor - { - public: +#include <windows.h> - /// - /// ýlua State - /// - Luax::LuaxState& GetLuaxState(); +namespace_begin(AsuraEditor) - private: +int MainMessageLoop(); +void TranslateAndDispatch(MSG& msg); - /// - /// е - /// - Luax::LuaxVM* mEditorVM; - - /// - /// Ϸʱ - /// - Luax::LuaxVM* mRunnerVM; - - }; - -} +namespace_end #endif
\ No newline at end of file diff --git a/source/Asura.Editor/Main.cpp b/source/Asura.Editor/Main.cpp index 207474b..87207f0 100644 --- a/source/Asura.Editor/Main.cpp +++ b/source/Asura.Editor/Main.cpp @@ -1,30 +1,33 @@ -/** - * Copyright (c) 2018-2019 AsuraEngine Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software m_ust not be m_isrepresented; you m_ust not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions m_ust be plainly m_arked as such, and m_ust not be - * m_isrepresented as being the original software. - * 3. This notice m_ay not be removed or altered from any source distribution. - **/ +#include <windows.h> -/// -/// ༭ĽͨdirectUIʵ֣Ⱦasura-libϣ¼Ӧͨwin32APIʵ֡ -/// -int main(int argn, char* args[]) -{ +int main(int argn, char* args[]) +{ + bool gotMsg; + MSG msg; + msg.message = WM_NULL; + PeekMessage(&msg, NULL, 0U, 0U, PM_NOREMOVE); + HANDLE hevent = (HANDLE)CreateEvent(NULL, FALSE, FALSE, NULL); + while (WM_QUIT != msg.message) + { + // Use PeekMessage() if the app is active, so we can use idle time to + // render the scene. Else, use GetMessage() to avoid eating CPU time. + //bool dontWaitForMessages = gAppActive || (!gAlreadyClosing && GetPlayerRunInBackground()) || (kPlayerPausing == GetPlayerPause()); + bool dontWaitForMessages = false; + if (dontWaitForMessages) + gotMsg = (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE) != 0); + else + gotMsg = (GetMessage(&msg, NULL, 0U, 0U) != 0); + if (gotMsg) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else { + // perform main loop + //PerformMainLoop(); + } + } }
\ No newline at end of file diff --git a/source/Asura.Editor/System/Input.cpp b/source/Asura.Editor/System/Input.cpp index e69de29..c10eb3b 100644 --- a/source/Asura.Editor/System/Input.cpp +++ b/source/Asura.Editor/System/Input.cpp @@ -0,0 +1,61 @@ +#include "Input.h" + +namespace_begin(AsuraEditor) + + +Input::Input() +{ +} + +Input::~Input() +{ +} + +bool Input::Open(HWND window) +{ +} + +void Input::Close(void) +{ +} + +bool Input::GetJoystickNames(std::vector<std::string> &names) +{ +} + + +bool Input::Activate(bool active) +{ +} + +bool Input::ToggleFullscreen(bool fullscreen, HWND window) +{ +} + + +bool Input::Process(bool discard) +{ +} + +LRESULT Input::OnKey(HWND window, UINT message, WPARAM wParam, LPARAM lParam) +{ +} + +LRESULT Input::OnInput(HWND window, UINT message, WPARAM wParam, LPARAM lParam) +{ +} + +LRESULT Input::OnDeviceChange(LPCWSTR name, bool add) +{ +} + +bool Input::ConvertPositionToClientAreaCoord(HWND activeWindow, POINT position, AEMath::Vector2f& newPos) +{ +} + +bool Input::UpdateState() +{ + +} + +namespace_end diff --git a/source/Asura.Editor/config.h b/source/Asura.Editor/config.h deleted file mode 100644 index e69de29..0000000 --- a/source/Asura.Editor/config.h +++ /dev/null diff --git a/source/Asura.Editor/editor.cpp b/source/Asura.Editor/editor.cpp index 38e7c26..6ffd789 100644 --- a/source/Asura.Editor/editor.cpp +++ b/source/Asura.Editor/editor.cpp @@ -1,5 +1,51 @@ +#include "Editor.h" -int main(int argc, char *argv[]) +#include <vector> + +namespace_begin(AsuraEditor) + +void TranslateAndDispatch(MSG& msg) +{ + //if (g_BatchMode || !TranslateAccelerator(gMainWindow, GetMainMenuAccelerators(), &msg)) + //{ + // ResetGfxDeviceIfNeeded(); + // TranslateMessage(&msg); + // DispatchMessage(&msg); + //} +} + +int MainMessageLoop() { - -}
\ No newline at end of file + MSG msg, lastMsg; + msg.message = WM_NULL; + std::vector<MSG> messages; + PeekMessage(&msg, NULL, 0U, 0U, PM_NOREMOVE); + bool isQuit = msg.message == WM_QUIT; + while (!isQuit) + { + messages.clear(); + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + if (msg.message == WM_INPUT || msg.message == WM_PAINT) + { + + } + + if (msg.message == WM_QUIT) + isQuit = true; + + messages.push_back(msg); + + if (messages.size() > 100) + break; + } + + for (unsigned i = 0; i < messages.size(); ++i) + { + msg = messages[i]; + } + } +} + + +namespace_end
\ No newline at end of file diff --git a/source/Asura.Editor/editor.h b/source/Asura.Editor/editor.h index 2f5f8ca..ab91ab7 100644 --- a/source/Asura.Editor/editor.h +++ b/source/Asura.Editor/editor.h @@ -2,36 +2,15 @@ #define _ASURA_EDITOR_H_ #include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Classes.h> -namespace AsuraEditor -{ - - /// - /// ༭ʵ - /// - class Editor - { - public: +#include <windows.h> - /// - /// ýlua State - /// - Luax::LuaxState& GetLuaxState(); +namespace_begin(AsuraEditor) - private: +int MainMessageLoop(); +void TranslateAndDispatch(MSG& msg); - /// - /// е - /// - Luax::LuaxVM* mEditorVM; - - /// - /// Ϸʱ - /// - Luax::LuaxVM* mRunnerVM; - - }; - -} +namespace_end #endif
\ No newline at end of file diff --git a/source/Asura.Editor/main.cpp b/source/Asura.Editor/main.cpp index 207474b..87207f0 100644 --- a/source/Asura.Editor/main.cpp +++ b/source/Asura.Editor/main.cpp @@ -1,30 +1,33 @@ -/** - * Copyright (c) 2018-2019 AsuraEngine Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software m_ust not be m_isrepresented; you m_ust not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions m_ust be plainly m_arked as such, and m_ust not be - * m_isrepresented as being the original software. - * 3. This notice m_ay not be removed or altered from any source distribution. - **/ +#include <windows.h> -/// -/// ༭ĽͨdirectUIʵ֣Ⱦasura-libϣ¼Ӧͨwin32APIʵ֡ -/// -int main(int argn, char* args[]) -{ +int main(int argn, char* args[]) +{ + bool gotMsg; + MSG msg; + msg.message = WM_NULL; + PeekMessage(&msg, NULL, 0U, 0U, PM_NOREMOVE); + HANDLE hevent = (HANDLE)CreateEvent(NULL, FALSE, FALSE, NULL); + while (WM_QUIT != msg.message) + { + // Use PeekMessage() if the app is active, so we can use idle time to + // render the scene. Else, use GetMessage() to avoid eating CPU time. + //bool dontWaitForMessages = gAppActive || (!gAlreadyClosing && GetPlayerRunInBackground()) || (kPlayerPausing == GetPlayerPause()); + bool dontWaitForMessages = false; + if (dontWaitForMessages) + gotMsg = (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE) != 0); + else + gotMsg = (GetMessage(&msg, NULL, 0U, 0U) != 0); + if (gotMsg) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else { + // perform main loop + //PerformMainLoop(); + } + } }
\ No newline at end of file |