From 0944b2f95b9971d62f35b9dcc38d28a27e278249 Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 20 Nov 2021 20:29:08 +0800 Subject: * mv gui to editor --- .../Libraries/GameLab/Engine/GUI/GUIState.lua | 23 ----- .../BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua | 114 --------------------- Data/BuiltIn/Libraries/GameLab/Engine/GUI/init.lua | 3 - 3 files changed, 140 deletions(-) delete mode 100644 Data/BuiltIn/Libraries/GameLab/Engine/GUI/GUIState.lua delete mode 100644 Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua (limited to 'Data/BuiltIn') diff --git a/Data/BuiltIn/Libraries/GameLab/Engine/GUI/GUIState.lua b/Data/BuiltIn/Libraries/GameLab/Engine/GUI/GUIState.lua deleted file mode 100644 index bb4884e..0000000 --- a/Data/BuiltIn/Libraries/GameLab/Engine/GUI/GUIState.lua +++ /dev/null @@ -1,23 +0,0 @@ -local GUIState = GameLab.GlobalStaticClass("GameLab.Engine.GUI.GUIState") - -local hotControl = 0 -local currentId = 0 -- 当前可分配的controlID - -GUIState.get_hotControl = function() - return hotControl -end - -GUIState.set_hotControl = function(value) - hotControl = value -end - -GUIState.GetControlID = function() - currentId = currentId + 1 - return currentId -end - -GUIState.ResetControlID = function() - currentId = 0 -end - -return GUIState \ No newline at end of file diff --git a/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua b/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua deleted file mode 100644 index 3c99622..0000000 --- a/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua +++ /dev/null @@ -1,114 +0,0 @@ -local GUI = GameLab.Package("GameLab.Engine.GUI") - -local find = GameLab.Find - -local EditorGUI = GameLab.Editor.GUI - -local Debug = GameLab.Debug -local GUIState = GUI.GUIState -local Event = GameLab.Events.Event -local GL = GameLab.Engine.GL -local Matrix44 = find "GameLab.Engine.Math.Matrix44" -local Rendering = GameLab.Engine.Rendering -local EEventType = GameLab.Events.EEventType -local Resource = GameLab.Engine.Resource -local Vector2 = GameLab.Engine.Math.Vector2 -local Vector4 = GameLab.Engine.Math.Vector4 -local Color = Rendering.Color -local builtin_res = require "GameLab.BuiltInResources" - -local editor_res -if GAMELAB_EDITOR then - editor_res = find "Scripts/EditorResources" -elseif GAMELAB_RUNNER then -end - -GUI.BeginOnGUI = function() - GUIState.ResetControlID() -end - -GUI.EndOnGUI = function() - GUIState.ResetControlID() -end - -GUI.BeginFrame = function() - GUIState.ResetControlID() -end - -GUI.EndFrame = function() - GUIState.ResetControlID() -end - ------------------------------------------------------------------------------------------------- --- Controls ------------------------------------------------------------------------------------------------- - -GUI.Button = function(rect, content ) - -end - -GUI.Toggle = function() - -end - -GUI.Label = function() - -end - -GUI.Box = function(rect, color) - if Event.current.type == EEventType.Repaint then - Rendering.UseShader(editor_res.shaders["EditorShape"]) - Rendering.SetVector2("gamelab_ui_position", rect.position) - Rendering.SetColor("gamelab_color", color) - GUI.DrawQuad(Vector2(0,0), rect.size) - end -end - -GUI.BoxFrame = function(rect, color) - if Event.current.type == EEventType.Repaint then - GUI.Line(Vector2(rect.x, rect.y), Vector2(rect.x + rect.w, rect.y), color) - GUI.Line(Vector2(rect.x + rect.w, rect.y), Vector2(rect.x + rect.w, rect.y + rect.h), color) - GUI.Line(Vector2(rect.x + rect.w, rect.y + rect.h), Vector2(rect.x, rect.y + rect.h), color) - GUI.Line(Vector2(rect.x, rect.y + rect.h), Vector2(rect.x, rect.y), color) - end -end - -GUI.HorizontalSlider = function() - -end - -GUI.VerticalSlider = function() - -end - -GUI.TextField = function() - -end - -GUI.TextArea = function() - -end - -GUI.Toolbar = function() - -end - -GUI.VerticalScrollbar = function() - -end - -GUI.HorizontalScrollbar = function() - -end - -GUI.Line = function(from, to, color) - if Event.current.type ~= EEventType.Repaint then - return - end - Rendering.UseShader(editor_res.shaders["EditorShape"]) - Rendering.SetVector2("gamelab_ui_position", {0, 0}) - Rendering.SetColor("gamelab_color", color) - GUI.DrawLine(from, to) -end - -return GUI \ No newline at end of file diff --git a/Data/BuiltIn/Libraries/GameLab/Engine/GUI/init.lua b/Data/BuiltIn/Libraries/GameLab/Engine/GUI/init.lua index 3012551..2eb8ac2 100644 --- a/Data/BuiltIn/Libraries/GameLab/Engine/GUI/init.lua +++ b/Data/BuiltIn/Libraries/GameLab/Engine/GUI/init.lua @@ -1,7 +1,4 @@ local GUI = GameLab.Package("GameLab.Engine.GUI") local import = GameLab.Import(...) -import "GUIState" -import "imgui" - return GUI \ No newline at end of file -- cgit v1.1-26-g67d0