From 02c29624d874aaf91169fd65e649d686bafc835c Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 12 Dec 2019 14:44:29 +0300 Subject: [PATCH] freetype: minor fixes --- examples/tetris/tetris.v | 11 ++++++----- vlib/freetype/freetype.v | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/tetris/tetris.v b/examples/tetris/tetris.v index 42a9a03718..5f6aac33a5 100644 --- a/examples/tetris/tetris.v +++ b/examples/tetris/tetris.v @@ -152,11 +152,12 @@ fn main() { gg.clear(BackgroundColor) // Try to load font game.ft = freetype.new_context(gg.Cfg{ - width: WinWidth - height: WinHeight - use_ortho: true - font_size: 18 - scale: 2 + width: WinWidth + height: WinHeight + use_ortho: true + font_size: 18 + scale: 2 + window_user_ptr: 0 }) game.font_loaded = (game.ft != 0 ) for { diff --git a/vlib/freetype/freetype.v b/vlib/freetype/freetype.v index 1700c12957..dca7776a48 100644 --- a/vlib/freetype/freetype.v +++ b/vlib/freetype/freetype.v @@ -197,7 +197,7 @@ pub fn new_context(cfg gg.Cfg) &FreeType { // Load first 128 characters of ASCII set mut chars := []Character for c := 0; c < 128; c++ { - mut ch := ft_load_char(face, i64(c)) + ch := ft_load_char(face, i64(c)) // s := utf32_to_str(uint(0x043f)) // s := 'п' // ch = ft_load_char(f, s.utf32_code()) @@ -208,7 +208,7 @@ pub fn new_context(cfg gg.Cfg) &FreeType { // # ch = gg__ft_load_char(f, 0xd0bf) ; // UTF 8 chars << ch } - ch := Character{} + //ch := Character{} // Configure VAO vao := gl.gen_vertex_array() println('new gg text context vao=$vao') @@ -285,7 +285,7 @@ fn (ctx mut FreeType) private_draw_text(_x, _y int, utext ustring, cfg gx.TextCf x *= ctx.scale// f32(2) // println('y=$_y height=$ctx.height') // _y = _y * int(ctx.scale) //+ 26 - y = y * int(ctx.scale) + ((cfg.size * ctx.scale) / 2) + 5 * ctx.scale + y = y * ctx.scale + ((cfg.size * ctx.scale) / 2) + 5 * ctx.scale y = f32(ctx.height) - y color := cfg.color // Activate corresponding render state