rendering the proper font 5 times also doent work
This commit is contained in:
parent
ee2dbc9c0a
commit
8645f7966a
1 changed files with 27 additions and 22 deletions
|
|
@ -9,21 +9,25 @@ class Tooltip{
|
|||
color{[1, 1, 1, 1]}
|
||||
background{[1, 0, 1, 1]}
|
||||
|
||||
shadowOffsets{[[1, 0],[0, 1],[-1, 0],[0, -1]]}
|
||||
|
||||
construct new(app){
|
||||
_text = Entity.create(app.ui)
|
||||
_bg = Entity.create(app.ui)
|
||||
var font1 = Assets.material("luxe: material/font")
|
||||
var font2 = Assets.material("luxe: material/font")
|
||||
Text.create(_bg, font1, 8, "assets/fonts/BabyBlocksBigger", background)
|
||||
Text.create(_text, font2, 8, "assets/fonts/BabyBlocks", color)
|
||||
var mat = Assets.material("luxe: material/font")
|
||||
Text.create(_text, mat, 8, "assets/fonts/BabyBlocks", color)
|
||||
|
||||
Transform.create(_text)
|
||||
Transform.set_pos(_text, 64, 128, depth)
|
||||
Transform.set_snap(_text, 1, 1, 0)
|
||||
|
||||
Transform.create(_bg)
|
||||
Transform.set_pos(_bg, 64, 128, depth)
|
||||
Transform.set_snap(_bg, 1, 1, 0)
|
||||
|
||||
var offsets = shadowOffsets
|
||||
_shadows = []
|
||||
for(i in offsets){
|
||||
var shadow = Entity.create(app.ui)
|
||||
Text.create(shadow, mat, 8, "assets/fonts/BabyBlocks", background)
|
||||
Transform.create(shadow)
|
||||
Transform.set_snap(_text, 1, 1, 0)
|
||||
_shadows.add(shadow)
|
||||
}
|
||||
|
||||
Globals["Tooltip"] = this
|
||||
}
|
||||
|
|
@ -38,7 +42,11 @@ class Tooltip{
|
|||
pos.y = _y
|
||||
}
|
||||
Transform.set_pos(_text, pos.x, pos.y, depth)
|
||||
Transform.set_pos(_bg, pos.x, pos.y - 1, depth-1)
|
||||
|
||||
var offsets = shadowOffsets
|
||||
for(i in 0...offsets.count){
|
||||
Transform.set_pos(_shadows[i], pos.x+offsets[i].x, pos.y+offsets[i].y, depth-10)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -55,10 +63,12 @@ class Tooltip{
|
|||
}
|
||||
|
||||
set(text, source){
|
||||
Text.set_text_buffer(_bg, text)
|
||||
Text.commit(_bg)
|
||||
//Text.set_text_buffer(_text, text)
|
||||
//Text.commit(_text)
|
||||
Text.set_text_buffer(_text, text)
|
||||
Text.commit(_text)
|
||||
for(shadow in _shadows){
|
||||
Text.set_text_buffer(shadow, text)
|
||||
Text.commit(shadow)
|
||||
}
|
||||
_active = true
|
||||
_source = source
|
||||
_x = null
|
||||
|
|
@ -70,13 +80,8 @@ class Tooltip{
|
|||
}
|
||||
|
||||
clear(source){
|
||||
if(_source != source) {
|
||||
return
|
||||
}
|
||||
Text.set_text_buffer(_text, "")
|
||||
Text.commit(_text)
|
||||
Text.set_text_buffer(_bg, "")
|
||||
Text.commit(_bg)
|
||||
if(_source != source) return
|
||||
set("", null)
|
||||
_active = false
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue