summaryrefslogtreecommitdiff
path: root/Data/Scripts/Editor/AssetBrowser.lua
blob: 6d02579f824565db34f87806769784662a32cf2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
local Debug    = GameLab.Debug
local GL       = GameLab.Engine.GL
local Matrix44 = GameLab.Engine.Math.Matrix44
local Engine   = GameLab.Engine
local Editor   = GameLab.Editor
local IO       = GameLab.IO
local inspect  = require("inspect")

local AssetBrowser = GameLab.Editor.EditorWindow.Extend("GameLab.Editor.AssetBrowser")

AssetBrowser.Ctor = function(self)
	self.base.Ctor(self, "AssetBrowser")
end

local shader = nil
local tex

AssetBrowser.OnGUI = function(self)
	if tex == nil then 
		tex = Engine.Resource.LoadTexture("./Resources/Images/tile.png")
		--tex = Engine.Resource.LoadTexture("./Resources/Images/brickwall_small.jpg")
	end

	if shader == nil then 
		-- local glsl = IO.ReadFile("./Resources/Shaders/Editor-Text.glsl", IO.EFileMode.Text) 
		-- shader = Engine.Rendering.Shader.New(glsl)
		shader = Engine.Rendering.Shader.CreateFromFile("./Resources/Shaders/Editor-Text.glsl")
	end 

	local ortho = Matrix44.New() 
    ortho:SetOrtho(0, 400, 400, 0,  0.1, 10)

	Debug.Log("AssetBrowser.OnGUI()")
	GL.ClearColor({0.13, 0.13, 0.13, 1})
	GL.Clear(GL.EBufferType.ColorBuffer)

	Engine.Rendering.UseShader(shader)
	Engine.Rendering.SetMatrix44("gamelab_mat_mvp", ortho)
	Engine.Rendering.SetVector2("gamelab_ui_position", {0, 0})
	--Engine.Rendering.SetTexture("gamelab_main_tex", tex)
	--Engine.Rendering.DrawUIQuad({0, 0, 200, 200})
	Editor.GUI.Text(_G["default_font"], "你好世界!\nMaterials\nHello,World!\nProject Window Properties", 12)	
	
	-- Engine.Rendering.SetVector2("gamelab_ui_position", {0, 100})
	-- Editor.GUI.Text(_G["default_font"], "你好世界!\nHello,World!\nProject Window Properties", 12)	

	--Engine.Rendering.DrawUI9Slicing(1, {25, 25}, {25, 25}, {80, 80}, {400, 30} )
end

AssetBrowser.OnFocus = function(self)

end

return AssetBrowser