aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-10-21 22:56:40 +0800
committerchai <chaifix@163.com>2018-10-21 22:56:40 +0800
commitd9a6fbd29abe2e8060d1213c5c9f5f2e8363b23f (patch)
tree80a45ecb2c7038ddfc8c26ec8f7d33d8b28b7bf7 /src/lua/modules
parent12322c584c487b20a550fd9d22b806fba0304014 (diff)
*调整默认字体
Diffstat (limited to 'src/lua/modules')
-rw-r--r--src/lua/modules/graphics/graphics.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lua/modules/graphics/graphics.cpp b/src/lua/modules/graphics/graphics.cpp
index 0d34619..2608051 100644
--- a/src/lua/modules/graphics/graphics.cpp
+++ b/src/lua/modules/graphics/graphics.cpp
@@ -45,6 +45,21 @@ namespace JinEngine
{
/* load default font */
Bitmap* bitmap = Bitmap::createBitmap(default_font_bitmap, sizeof(default_font_bitmap));
+ const Color* pixels = bitmap->getPixels();
+ ofstream f = ofstream();
+ f.open("font.pixels", ios_base::app);
+ for (int y = 0; y < bitmap->getHeight(); ++y)
+ {
+ for (int x = 0; x < bitmap->getWidth(); ++x)
+ {
+ Color c = pixels[x + y * bitmap->getWidth()];
+ f << (int)c.r << ",";
+ f << (int)c.g << ",";
+ f << (int)c.b << ",";
+ f << (int)c.a << ",";
+ }
+ }
+
TextureFont* tf = TextureFont::createTextureFont(bitmap, Text(Encode::UTF8, default_charset), default_font_split, bitmap->getHeight());
context.defaultFont = tf;
delete bitmap;