freetype: minor fixes
parent
f86ddcf496
commit
02c29624d8
|
@ -152,11 +152,12 @@ fn main() {
|
||||||
gg.clear(BackgroundColor)
|
gg.clear(BackgroundColor)
|
||||||
// Try to load font
|
// Try to load font
|
||||||
game.ft = freetype.new_context(gg.Cfg{
|
game.ft = freetype.new_context(gg.Cfg{
|
||||||
width: WinWidth
|
width: WinWidth
|
||||||
height: WinHeight
|
height: WinHeight
|
||||||
use_ortho: true
|
use_ortho: true
|
||||||
font_size: 18
|
font_size: 18
|
||||||
scale: 2
|
scale: 2
|
||||||
|
window_user_ptr: 0
|
||||||
})
|
})
|
||||||
game.font_loaded = (game.ft != 0 )
|
game.font_loaded = (game.ft != 0 )
|
||||||
for {
|
for {
|
||||||
|
|
|
@ -197,7 +197,7 @@ pub fn new_context(cfg gg.Cfg) &FreeType {
|
||||||
// Load first 128 characters of ASCII set
|
// Load first 128 characters of ASCII set
|
||||||
mut chars := []Character
|
mut chars := []Character
|
||||||
for c := 0; c < 128; c++ {
|
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 := utf32_to_str(uint(0x043f))
|
||||||
// s := 'п'
|
// s := 'п'
|
||||||
// ch = ft_load_char(f, s.utf32_code())
|
// 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
|
// # ch = gg__ft_load_char(f, 0xd0bf) ; // UTF 8
|
||||||
chars << ch
|
chars << ch
|
||||||
}
|
}
|
||||||
ch := Character{}
|
//ch := Character{}
|
||||||
// Configure VAO
|
// Configure VAO
|
||||||
vao := gl.gen_vertex_array()
|
vao := gl.gen_vertex_array()
|
||||||
println('new gg text context vao=$vao')
|
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)
|
x *= ctx.scale// f32(2)
|
||||||
// println('y=$_y height=$ctx.height')
|
// println('y=$_y height=$ctx.height')
|
||||||
// _y = _y * int(ctx.scale) //+ 26
|
// _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
|
y = f32(ctx.height) - y
|
||||||
color := cfg.color
|
color := cfg.color
|
||||||
// Activate corresponding render state
|
// Activate corresponding render state
|
||||||
|
|
Loading…
Reference in New Issue