CabinGame/Luxe/blocks/ui/simple_text.wren
Ronja 8cce750252 make simple text work and use it to display name
except block strings still dont work (:
2020-09-06 17:45:33 +02:00

24 lines
No EOL
648 B
Text

import "luxe: ui/control" for Control
import "luxe: world" for UI
import "luxe: render" for TextAlign
class UISimpleText{
static font{"assets/fonts/BabyBlocks"}
static size{8}
static create(ent){
var text = Control.create(ent)
Control.set_state_data(text, {"text": ""})
Control.set_size(text, 100, size)
Control.set_render(text) {|control, state, x,y,w,h|
UI.draw_text(control, x, y + size/2, 0, state["text"], size, font, [1,1,1,1], TextAlign.left, TextAlign.top)
}
return text
}
static set_text(con, text){
var data = Control.get_state_data(con)
data["text"] = text
}
}