diff options
author | chai <chaifix@163.com> | 2021-10-28 10:39:31 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-28 10:39:31 +0800 |
commit | 8cbcd2dc3f7ea5a1d8656cd3885b553121cb7450 (patch) | |
tree | 216433c4e919ecac921e0d1eb3a96e19fc4fd032 | |
parent | d162d7711177c414e5ea9a3876dc6fa3414c937e (diff) |
*internal
-rw-r--r-- | Editor/GUI/ContainerWindow.cpp | 12 | ||||
-rw-r--r-- | Editor/GUI/EditorWindows.h | 4 | ||||
-rw-r--r-- | Editor/GUI/WindowManager.cpp | 6 | ||||
-rw-r--r-- | Editor/Scripting/EditorGUI/ContainerWindow.bind.cpp | 4 | ||||
-rw-r--r-- | Projects/VisualStudio/Editor/Editor.vcxproj | 1 | ||||
-rw-r--r-- | Projects/VisualStudio/Editor/Editor.vcxproj.filters | 3 | ||||
-rw-r--r-- | Runtime/Graphics/Quad.cpp | 2 | ||||
-rw-r--r-- | Runtime/Graphics/UIQuad.cpp | 6 | ||||
-rw-r--r-- | Runtime/Lua/LuaHelper.cpp | 20 | ||||
-rw-r--r-- | Runtime/Math/Vector2.cpp | 4 | ||||
-rw-r--r-- | Runtime/Math/Vector2.h | 49 |
11 files changed, 55 insertions, 56 deletions
diff --git a/Editor/GUI/ContainerWindow.cpp b/Editor/GUI/ContainerWindow.cpp index 5f3e6f8..96e5a1b 100644 --- a/Editor/GUI/ContainerWindow.cpp +++ b/Editor/GUI/ContainerWindow.cpp @@ -265,16 +265,16 @@ bool ContainerWindow::SetRenderContext() if (m_RC && !g_IsGLInitialized) { log_info("Initialize OpenGL"); - wglMakeCurrent(m_DC, m_RC);
- if (!gladLoadGL()) {
- log_error("初始化GL错误");
- }
+ wglMakeCurrent(m_DC, m_RC); + if (!gladLoadGL()) { + log_error("初始化GL错误"); + } g_IsGLInitialized = true; } } // 初始化,创建窗口 -void ContainerWindow::Init(Rect pixelRect, int showMode, const Vector2& minSize, const Vector2& maxSize, std::string name) +void ContainerWindow::Init(Rect pixelRect, int showMode, const Internal::Vector2& minSize, const Internal::Vector2& maxSize, std::string name) { // Aux windows are mac only. on windows they look just like normal utility windows. if (showMode == kShowAuxWindow) @@ -343,7 +343,7 @@ void ContainerWindow::Init(Rect pixelRect, int showMode, const Vector2& minSize, // parentWindow = GetMainEditorWindow(); } - bool notSizeable = (minSize == maxSize) && (minSize != Vector2::zero); + bool notSizeable = (minSize == maxSize) && (minSize != Internal::Vector2::zero); if (notSizeable) windowStyle &= ~(WS_THICKFRAME); diff --git a/Editor/GUI/EditorWindows.h b/Editor/GUI/EditorWindows.h index 3e0471a..9628af8 100644 --- a/Editor/GUI/EditorWindows.h +++ b/Editor/GUI/EditorWindows.h @@ -29,7 +29,7 @@ public : class WindowManager : Singleton<WindowManager> { public: - static Vector2 GetMousePosition(); + static Internal::Vector2 GetMousePosition(); static GUIWindow* GetMouseOverWindow(); private: @@ -56,7 +56,7 @@ public: ContainerWindow(LuaBind::VM* vm); ~ContainerWindow(); - void Init(Rect size, int showMode, const Vector2& minSize, const Vector2& maxSize, std::string name = ""); + void Init(Rect size, int showMode, const Internal::Vector2& minSize, const Internal::Vector2& maxSize, std::string name = ""); void SetTitle(const char* title); void SetIcon(LPCSTR iconName); void SetAsRenderContext(); diff --git a/Editor/GUI/WindowManager.cpp b/Editor/GUI/WindowManager.cpp index d8a4135..d6d8b1e 100644 --- a/Editor/GUI/WindowManager.cpp +++ b/Editor/GUI/WindowManager.cpp @@ -8,12 +8,12 @@ GUIWindow* WindowManager::GetMouseOverWindow() return NULL; } -Vector2 WindowManager::GetMousePosition() +Internal::Vector2 WindowManager::GetMousePosition() { POINT pt; if (!GetCursorPos(&pt)) - return Vector2(0, 0); + return Internal::Vector2(0, 0); - return Vector2(pt.x, pt.y); + return Internal::Vector2(pt.x, pt.y); } diff --git a/Editor/Scripting/EditorGUI/ContainerWindow.bind.cpp b/Editor/Scripting/EditorGUI/ContainerWindow.bind.cpp index 02b29df..531128b 100644 --- a/Editor/Scripting/EditorGUI/ContainerWindow.bind.cpp +++ b/Editor/Scripting/EditorGUI/ContainerWindow.bind.cpp @@ -58,8 +58,8 @@ LUA_BIND_IMPL_METHOD(ContainerWindow, ContainerWindow::_New) Rect rect = state.GetValue<Rect>(state, Rect()); int showMode = state.GetValue<int>(2, 0); - Vector2 min = state.GetValue<Vector2>(state, Vector2()); - Vector2 max = state.GetValue<Vector2>(state, Vector2()); + Internal::Vector2 min = state.GetValue<Internal::Vector2>(state, Internal::Vector2()); + Internal::Vector2 max = state.GetValue<Internal::Vector2>(state, Internal::Vector2()); wnd->Init(rect, showMode, min, max); diff --git a/Projects/VisualStudio/Editor/Editor.vcxproj b/Projects/VisualStudio/Editor/Editor.vcxproj index 04a853b..c05b33a 100644 --- a/Projects/VisualStudio/Editor/Editor.vcxproj +++ b/Projects/VisualStudio/Editor/Editor.vcxproj @@ -178,7 +178,6 @@ <ClCompile Include="..\..\..\Runtime\FileSystem\Path.cpp" />
<ClCompile Include="..\..\..\Runtime\FileSystem\Unzip.cpp" />
<ClCompile Include="..\..\..\Runtime\Graphics\CustomVertexLayout.cpp" />
- <ClCompile Include="..\..\..\Runtime\Graphics\CustomVertexLayout.cpp" />
<ClCompile Include="..\..\..\Runtime\Graphics\DefaultVertexLayout.cpp" />
<ClCompile Include="..\..\..\Runtime\Graphics\GfxDevice.cpp" />
<ClCompile Include="..\..\..\Runtime\Graphics\FrameBuffer.cpp" />
diff --git a/Projects/VisualStudio/Editor/Editor.vcxproj.filters b/Projects/VisualStudio/Editor/Editor.vcxproj.filters index 3aa90fd..c55184a 100644 --- a/Projects/VisualStudio/Editor/Editor.vcxproj.filters +++ b/Projects/VisualStudio/Editor/Editor.vcxproj.filters @@ -357,9 +357,6 @@ <ClCompile Include="..\..\..\Runtime\Graphics\GPUDataBuffer.cpp">
<Filter>Runtime\Graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\Runtime\Graphics\CustomVertexLayout.cpp">
- <Filter>Runtime\FileSystem</Filter>
- </ClCompile>
<ClCompile Include="..\..\..\Runtime\Graphics\DefaultVertexLayout.cpp">
<Filter>Runtime\FileSystem</Filter>
</ClCompile>
diff --git a/Runtime/Graphics/Quad.cpp b/Runtime/Graphics/Quad.cpp index b98f4f2..f584fe8 100644 --- a/Runtime/Graphics/Quad.cpp +++ b/Runtime/Graphics/Quad.cpp @@ -6,7 +6,7 @@ struct QuadVBOLayout { Vector3 position; - Vector2 uv; + Internal::Vector2 uv; }; void Quad::Draw() diff --git a/Runtime/Graphics/UIQuad.cpp b/Runtime/Graphics/UIQuad.cpp index 5f1a54d..fb5964f 100644 --- a/Runtime/Graphics/UIQuad.cpp +++ b/Runtime/Graphics/UIQuad.cpp @@ -4,8 +4,8 @@ struct UIQuadLayout { - Vector2 position; - Vector2 uv; + Internal::Vector2 position; + Internal::Vector2 uv; }; void UIQuad::Draw() @@ -13,7 +13,7 @@ void UIQuad::Draw() CustomVertexLayout layout; VertexAttributeDescriptor POSITION = VertexAttributeDescriptor(0, 2, VertexAttrFormat_Float, sizeof(UIQuadLayout)); - VertexAttributeDescriptor UV = VertexAttributeDescriptor(sizeof(Vector2), 2, VertexAttrFormat_Float, sizeof(UIQuadLayout)); + VertexAttributeDescriptor UV = VertexAttributeDescriptor(sizeof(Internal::Vector2), 2, VertexAttrFormat_Float, sizeof(UIQuadLayout)); layout.attributes.push_back(POSITION); layout.attributes.push_back(UV); diff --git a/Runtime/Lua/LuaHelper.cpp b/Runtime/Lua/LuaHelper.cpp index 9381b6c..a47d528 100644 --- a/Runtime/Lua/LuaHelper.cpp +++ b/Runtime/Lua/LuaHelper.cpp @@ -2,23 +2,23 @@ using namespace LuaBind;
-template <> +template <>
Rect State::GetValue < Rect >(int idx, const Rect value)
{
Rect rect;
- rect.x = GetField<float>(idx, 1, 0); - rect.y = GetField<float>(idx, 2, 0); - rect.width = GetField<float>(idx, 3, 0); - rect.height = GetField<float>(idx, 4, 0); + rect.x = GetField<float>(idx, 1, 0);
+ rect.y = GetField<float>(idx, 2, 0);
+ rect.width = GetField<float>(idx, 3, 0);
+ rect.height = GetField<float>(idx, 4, 0);
return rect;
}
-template <> -Vector2 State::GetValue < Vector2 >(int idx, const Vector2 value)
+template <>
+Internal::Vector2 State::GetValue < Internal::Vector2 >(int idx, const Internal::Vector2 value)
{
- Vector2 v2; - v2.x = GetField<float>(idx, 1, 0); - v2.y = GetField<float>(idx, 2, 0); + Internal::Vector2 v2;
+ v2.x = GetField<float>(idx, 1, 0);
+ v2.y = GetField<float>(idx, 2, 0);
return v2;
}
diff --git a/Runtime/Math/Vector2.cpp b/Runtime/Math/Vector2.cpp index 2b70b24..185e66f 100644 --- a/Runtime/Math/Vector2.cpp +++ b/Runtime/Math/Vector2.cpp @@ -1,4 +1,4 @@ #include "Vector2.h" -Vector2 Vector2::one = Vector2(1, 1); -Vector2 Vector2::zero = Vector2(0, 0); +Internal::Vector2 Internal::Vector2::one = Internal::Vector2(1, 1); +Internal::Vector2 Internal::Vector2::zero = Internal::Vector2(0, 0); diff --git a/Runtime/Math/Vector2.h b/Runtime/Math/Vector2.h index 5fb230c..27cf312 100644 --- a/Runtime/Math/Vector2.h +++ b/Runtime/Math/Vector2.h @@ -1,30 +1,33 @@ #pragma once -struct Vector2 +namespace Internal { - Vector2(float x=0, float y = 0) - { - this->x = x; - this->y = y; - } - inline void Set(float x, float y) - { - this->x = x; - this->y = y; - } + struct Vector2 + { + Vector2(float x = 0, float y = 0) + { + this->x = x; + this->y = y; + } + inline void Set(float x, float y) + { + this->x = x; + this->y = y; + } - bool operator == (const Vector2& v) const - { - return v.x == x && v.y == y; - } + bool operator == (const Vector2& v) const + { + return v.x == x && v.y == y; + } - bool operator != (const Vector2& v) const - { - return v.x != x || v.y != y; - } + bool operator != (const Vector2& v) const + { + return v.x != x || v.y != y; + } - float x, y; + float x, y; - static Vector2 zero; - static Vector2 one; -};
\ No newline at end of file + static Vector2 zero; + static Vector2 one; + }; +} |