38 lines
838 B
Text
38 lines
838 B
Text
|
|
import "luxe: world" for Entity, Text, Transform
|
||
|
|
import "luxe: assets" for Assets
|
||
|
|
|
||
|
|
import "globals" for Globals
|
||
|
|
import "math/vector" for Vector
|
||
|
|
|
||
|
|
class Tooltip{
|
||
|
|
construct new(app){
|
||
|
|
_ent = Entity.create(app.ui)
|
||
|
|
_mat_font = Assets.material("luxe: material/font")
|
||
|
|
Text.create(_ent, _mat_font, 8, "assets/fonts/BabyBlocks", [1, 1, 1, 1])
|
||
|
|
|
||
|
|
Transform.create(_ent)
|
||
|
|
Transform.set_pos(_ent, 64, 128, 12)
|
||
|
|
Transform.set_snap(_ent, 1, 1, 0)
|
||
|
|
|
||
|
|
_size = 8
|
||
|
|
}
|
||
|
|
|
||
|
|
tick(){
|
||
|
|
var pos = Vector.new(Globals["UiMouse"])
|
||
|
|
if(_active && pos){
|
||
|
|
Transform.set_pos(_ent, pos.x, pos.y, 12)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
set(text){
|
||
|
|
Text.set_text_buffer(_ent, text)
|
||
|
|
Text.commit(_ent)
|
||
|
|
_active = true
|
||
|
|
}
|
||
|
|
|
||
|
|
clear(){
|
||
|
|
Text.set_text_buffer(_ent, "")
|
||
|
|
Text.commit(_ent)
|
||
|
|
_active = false
|
||
|
|
}
|
||
|
|
}
|