diff options
author | chai <chaifix@163.com> | 2018-09-19 08:31:17 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-09-19 08:31:17 +0800 |
commit | ec15b270d91e53bfd899eb30473e7fb5e85b393f (patch) | |
tree | 81d99c59e896f04bacba2e52aa1c2b24affadd09 /test/05Font/main.cpp | |
parent | 92bbaa7fbd2da52fd74de5fc470237265a3a3179 (diff) |
*update
Diffstat (limited to 'test/05Font/main.cpp')
-rw-r--r-- | test/05Font/main.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/test/05Font/main.cpp b/test/05Font/main.cpp index 1388537..78a1142 100644 --- a/test/05Font/main.cpp +++ b/test/05Font/main.cpp @@ -17,19 +17,17 @@ void onLoad() uniform float dt; Color effect(Color col, Texture tex, vec2 uv, vec2 screen) { - float d = 130; - float f = clamp(abs((screen.x - d * sin(dt))/75), 0, 1); - return vec4(col.r*(f), col.g*(1-f + 0.5), 0,Texel(tex, uv).a); - //return Texel(tex, uv); + float a = Texel(tex, uv).a; + return Color(col.rgb, a/5); } )"; shader = JSLProgram::createJSLProgram(program); Filesystem* fs = Filesystem::get(); fs->mount("../Debug"); Buffer buffer; - fs->read("font.ttf", &buffer); + fs->read("simhei.ttf", &buffer); data = FontData::createFontData((const unsigned char*)buffer.data, buffer.size); - font = Font::createFont(data, 17); + font = Font::createFont(data, 14); //canvas = Canvas::createCanvas(100, 100); } @@ -56,10 +54,10 @@ void onDraw() if (font != nullptr) { glColor4f(1, 1, 1, 1); - font->print(u8"Hello, world!", 10, 10); - font->print(u8"Привет мир!", 10, 10 + 15 * 1); - font->print(u8"こんにちは世界!", 10, 10 + 15 * 2); - font->print(u8"你好世界!", 10, 10 + 15*3); + font->print(u8"Hello,你好\n啊 world!", 10, 10); + //font->print(u8"Привет мир!", 10, 10 + 15 * 1); + //font->print(u8"こんにちは世界!", 10, 10 + 15 * 2); + //font->print(u8"你好世界!", 10, 10 + 15*3); glColor4f(1, 1, 1, 1); } shader->unuse(); |