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

ft: clean up

This commit is contained in:
Alexander Medvednikov 2019-08-08 10:08:39 +02:00
parent 61983a6799
commit 27fad0f19b
2 changed files with 8 additions and 11 deletions

View File

@ -794,16 +794,16 @@ fn (p mut Parser) fn_call_args(f mut Fn) *Fn {
// `mut numbers := [1,2,3]; reverse(mut numbers);`
if arg.is_mut {
if p.tok != .key_mut {
p.error('`$arg.name` is a key_mut argument, you need to provide `mut`: `$f.name(...mut a...)`')
p.error('`$arg.name` is a mutable argument, you need to provide `mut`: `$f.name(...mut a...)`')
}
if p.peek() != .name {
p.error('`$arg.name` is a key_mut argument, you need to provide a variable to modify: `$f.name(... mut a...)`')
p.error('`$arg.name` is a mutable argument, you need to provide a variable to modify: `$f.name(... mut a...)`')
}
p.check(.key_mut)
var_name := p.lit
v := p.cur_fn.find_var(var_name)
if v.name == '' {
p.error('`$arg.name` is a key_mut argument, you need to provide a variable to modify: `$f.name(... mut a...)`')
p.error('`$arg.name` is a mutable argument, you need to provide a variable to modify: `$f.name(... mut a...)`')
}
if !v.is_changed {
p.cur_fn.mark_var_changed(v)

View File

@ -6,11 +6,11 @@ module ft
import (
os
gx
gg
stbi
glm
gl
gx
gg
stbi
glm
gl
)
#flag darwin -I/usr/local/Cellar/freetype/2.10.0/include/freetype2
@ -248,11 +248,9 @@ fn (ctx mut GG) init_utf8_runes() {
// fn (ctx &GG) render_text(text string, x, y, scale f32, color gx.Color) {
pub fn (ctx &GG) draw_text(_x, _y int, text string, cfg gx.TextCfg) {
println('draw text start')
utext := text.ustring_tmp()
// utext := text.ustring()
ctx._draw_text(_x, _y, utext, cfg)
println('draw text end')
// utext.free()
// # glScissor(0,0,ctx->width*2,ctx->height*2);
// gl.disable(GL_SCISSOR_TEST)// TODO
@ -289,7 +287,6 @@ fn (ctx &GG) _draw_text(_x, _y int, utext ustring, cfg gx.TextCfg) {
// _y = _y * int(ctx.scale) //+ 26
y = y * int(ctx.scale) + ((cfg.size * ctx.scale) / 2) + 5 * ctx.scale
y = f32(ctx.height) - y
println('($x, $y)' )
color := cfg.color
// Activate corresponding render state
ctx.shader.use()