25 lines
No EOL
695 B
Text
25 lines
No EOL
695 B
Text
import "luxe: ui/control" for Control
|
|
import "luxe: world" for UI
|
|
import "luxe: render" for TextAlign
|
|
import "luxe: asset" for Asset
|
|
|
|
class UISimpleText{
|
|
static font{Asset.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
|
|
}
|
|
|
|
} |