aboutsummaryrefslogtreecommitdiff
path: root/test/05Font/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/05Font/main.cpp')
-rw-r--r--test/05Font/main.cpp18
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();