1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

glfw, freetype: remove the display of general information

This commit is contained in:
yuyi 2020-03-03 21:41:26 +08:00 committed by GitHub
parent 69f256b900
commit 3f67ba08b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 10 deletions

View File

@ -49,13 +49,13 @@ pub const (
struct Character {
code i64
texture_id u32
size gg.Vec2
horizontal_bearing_px gg.Vec2
horizontal_advance_px u32
vertical_bearing_px gg.Vec2
vertical_advance_px u32
}
@ -112,7 +112,7 @@ struct C.Glyph {
bitmap_left int
bitmap_top int
advance Advance
metrics FT_Glyph_Metrics
metrics FT_Glyph_Metrics
}
[typedef]
@ -155,10 +155,10 @@ fn ft_load_char(face C.FT_Face, code i64) Character {
size: gg.vec2(fgwidth, fgrows)
// Note: advance is number of 1/64 pixels
// Bitshift by 6 to get value in pixels (2^6 = 64 (divide amount of 1/64th pixels by 64 to get amount of pixels))
// Bitshift by 6 to get value in pixels (2^6 = 64 (divide amount of 1/64th pixels by 64 to get amount of pixels))
horizontal_bearing_px: gg.vec2(face.glyph.metrics.horiBearingX >> 6, face.glyph.metrics.horiBearingY >> 6)
vertical_bearing_px: gg.vec2(face.glyph.metrics.vertBearingX >> 6, face.glyph.metrics.vertBearingY >> 6) // not used for now
horizontal_advance_px: face.glyph.metrics.horiAdvance >> 6
vertical_advance_px: face.glyph.metrics.vertAdvance >> 6
}
@ -408,7 +408,7 @@ pub fn (ctx mut FreeType) text_size(s string) (int, int) {
mut ch := Character{}
for i in 0..utext.len {
_rune = utext.at(i)
ch = Character{}
ch = Character{}
mut found := false
if _rune.len == 1 {
idx := _rune[0]
@ -444,7 +444,7 @@ pub fn (ctx mut FreeType) text_size(s string) (int, int) {
//scaled_x := x
//scaled_y := maxy
scaled_x := int(f64(x)/ctx.scale)
scaled_y := int(f64(maxy)/ctx.scale)
scaled_y := int(f64(maxy)/ctx.scale)
//println('text_size of "${s}" | x,y: $x,$maxy | scaled_x: ${scaled_x:3d} | scaled_y: ${scaled_y:3d} ')
return scaled_x, scaled_y
}

View File

@ -131,7 +131,7 @@ pub fn create_window(c WinCfg) &glfw.Window {
println('failed to create a glfw window, make sure you have a GPU driver installed')
C.glfwTerminate()
}
println('create window wnd=$cwindow ptr==$c.ptr')
// println('create window wnd=$cwindow ptr==$c.ptr')
C.glfwSetWindowUserPointer(cwindow, c.ptr)
window := &glfw.Window {
data: cwindow,
@ -305,4 +305,3 @@ pub fn (size Size) str() string {
pub fn get_window_user_pointer(gwnd voidptr) voidptr {
return C.glfwGetWindowUserPointer(gwnd)
}