diff options
Diffstat (limited to 'Data')
-rw-r--r-- | Data/Resources/Font/msyh.ttc | bin | 0 -> 19647736 bytes | |||
-rw-r--r-- | Data/Resources/Shaders/Editor-Text.glsl | 17 | ||||
-rw-r--r-- | Data/Scripts/Editor/AssetBrowser.lua | 15 | ||||
-rw-r--r-- | Data/Scripts/EditorApplication.lua | 5 |
4 files changed, 16 insertions, 21 deletions
diff --git a/Data/Resources/Font/msyh.ttc b/Data/Resources/Font/msyh.ttc Binary files differnew file mode 100644 index 0000000..37c28de --- /dev/null +++ b/Data/Resources/Font/msyh.ttc diff --git a/Data/Resources/Shaders/Editor-Text.glsl b/Data/Resources/Shaders/Editor-Text.glsl index e2c2ae7..c58bd48 100644 --- a/Data/Resources/Shaders/Editor-Text.glsl +++ b/Data/Resources/Shaders/Editor-Text.glsl @@ -7,8 +7,7 @@ DepthTest Off CMD_END uniform mat4 gamelab_mat_mvp; -uniform sampler2D uiTex; -uniform vec2 uiText_ST; +uniform sampler2D gamelab_main_tex; VSH_BEGIN layout (location = 0) in vec2 vPos; @@ -16,24 +15,30 @@ layout (location = 1) in vec2 vUV; layout (location = 2) in vec4 vColor; out vec2 uv; +out vec4 color; void main() { - vec4 clip = gamelab_mat_mvp * vec4(vPos, -1, 1.0); + vec2 pos = vPos + vec2(10, 40); + vec4 clip = gamelab_mat_mvp * vec4(pos, -1, 1.0); gl_Position = clip; uv = vUV; + color = vColor; } VSH_END FSH_BEGIN in vec2 uv; +in vec4 color; out vec4 FragColor; void main() { - vec2 uv = vec2(uv.x, 1 - uv.y); - vec4 sampled = vec4(1,1,1,texture(uiTex, uv).r); - FragColor = sampled; + //vec2 uv = vec2(uv.x, 1 - uv.y); + vec4 sampled = vec4(1,1,1,texture(gamelab_main_tex, uv).r); + sampled *= color; + // vec4 sampled = vec4(1,1,1,1); + FragColor = sampled; } FSH_END diff --git a/Data/Scripts/Editor/AssetBrowser.lua b/Data/Scripts/Editor/AssetBrowser.lua index d726654..ecaecda 100644 --- a/Data/Scripts/Editor/AssetBrowser.lua +++ b/Data/Scripts/Editor/AssetBrowser.lua @@ -27,24 +27,17 @@ AssetBrowser.OnGUI = function(self) end
local ortho = Matrix44.New()
- ortho:SetOrtho(0, 400, 400, 0, 0.1, 10)
+ ortho:SetOrtho(0, 400, 0, 400, 0.1, 10)
Debug.Log("AssetBrowser.OnGUI()")
GL.ClearColor({0.1,0.1,0.1,1})
GL.Clear(GL.EBufferType.ColorBuffer)
- -- GL.Color({1,1,0,1})
- -- GL.LoadPixelMatrix(-250, 250, -300, 300)
- -- GL.Begin(GL.EPrimitiveType.Triangles)
- -- GL.Vertex({0,0,-1})
- -- GL.Vertex({0,300,-1})
- -- GL.Vertex({250,0,-1})
- -- GL.End()
Engine.Rendering.UseShader(shader)
Engine.Rendering.SetMatrix44("gamelab_mat_mvp", ortho)
- Engine.Rendering.SetTexture("uiTex", tex)
- Engine.Rendering.DrawUIQuad({10, 30, 300, 300})
-
+ --Engine.Rendering.SetTexture("gamelab_main_tex", tex)
+ --Engine.Rendering.DrawUIQuad({0, 0, 10, 20})
+ _G["default_font"]:GetCharacters("你好世界!Hello,World! Project Window Properties", 12)
Engine.Rendering.ResetUniformState()
end
diff --git a/Data/Scripts/EditorApplication.lua b/Data/Scripts/EditorApplication.lua index eb3c7d8..535136b 100644 --- a/Data/Scripts/EditorApplication.lua +++ b/Data/Scripts/EditorApplication.lua @@ -113,11 +113,8 @@ local fsh = [[ BeforeMainLoop() -local font = Engine.GUI.Font.New("./Resources/Font/deng.ttf", {256, 256}, 5, 5) +local font = Engine.GUI.Font.New("./Resources/Font/msyh.ttc", {512, 512}, 5, 5) _G["default_font"] = font -font:GetCharacters([[ -UTF-8是Unicode的一种实现,是一种变长字节编码方式。对于某一个字符的UTF-8编码,如果只有一个字节则其最高二进制位为0;如果是多字节,其第一个字节从最高位开始,连续的二进制位值为1的个数决定了其编码的位数,其余各字节均以10开头。UTF-8最多可用到6个字节。 -]], 12) while true do |