ft: clean up
parent
61983a6799
commit
27fad0f19b
|
@ -794,16 +794,16 @@ fn (p mut Parser) fn_call_args(f mut Fn) *Fn {
|
||||||
// `mut numbers := [1,2,3]; reverse(mut numbers);`
|
// `mut numbers := [1,2,3]; reverse(mut numbers);`
|
||||||
if arg.is_mut {
|
if arg.is_mut {
|
||||||
if p.tok != .key_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 {
|
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)
|
p.check(.key_mut)
|
||||||
var_name := p.lit
|
var_name := p.lit
|
||||||
v := p.cur_fn.find_var(var_name)
|
v := p.cur_fn.find_var(var_name)
|
||||||
if v.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 {
|
if !v.is_changed {
|
||||||
p.cur_fn.mark_var_changed(v)
|
p.cur_fn.mark_var_changed(v)
|
||||||
|
|
|
@ -6,8 +6,8 @@ module ft
|
||||||
|
|
||||||
import (
|
import (
|
||||||
os
|
os
|
||||||
gx
|
gx
|
||||||
gg
|
gg
|
||||||
stbi
|
stbi
|
||||||
glm
|
glm
|
||||||
gl
|
gl
|
||||||
|
@ -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) {
|
// 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) {
|
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_tmp()
|
||||||
// utext := text.ustring()
|
// utext := text.ustring()
|
||||||
ctx._draw_text(_x, _y, utext, cfg)
|
ctx._draw_text(_x, _y, utext, cfg)
|
||||||
println('draw text end')
|
|
||||||
// utext.free()
|
// utext.free()
|
||||||
// # glScissor(0,0,ctx->width*2,ctx->height*2);
|
// # glScissor(0,0,ctx->width*2,ctx->height*2);
|
||||||
// gl.disable(GL_SCISSOR_TEST)// TODO
|
// 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) //+ 26
|
||||||
y = y * int(ctx.scale) + ((cfg.size * ctx.scale) / 2) + 5 * ctx.scale
|
y = y * int(ctx.scale) + ((cfg.size * ctx.scale) / 2) + 5 * ctx.scale
|
||||||
y = f32(ctx.height) - y
|
y = f32(ctx.height) - y
|
||||||
println('($x, $y)' )
|
|
||||||
color := cfg.color
|
color := cfg.color
|
||||||
// Activate corresponding render state
|
// Activate corresponding render state
|
||||||
ctx.shader.use()
|
ctx.shader.use()
|
||||||
|
|
Loading…
Reference in New Issue