try to do outlines via frankenfont
This commit is contained in:
parent
8cce750252
commit
ee2dbc9c0a
6 changed files with 42 additions and 16 deletions
7
Luxe/assets/fonts/BabyBlocksBigger.font.lx
Normal file
7
Luxe/assets/fonts/BabyBlocksBigger.font.lx
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
font = {
|
||||||
|
source = "assets/fonts/src/BabyBlocksBigger.ttf"
|
||||||
|
ranges = [
|
||||||
|
"0020-007F"
|
||||||
|
"00A0-00FF"
|
||||||
|
]
|
||||||
|
}
|
||||||
BIN
Luxe/assets/fonts/src/BabyBlocksBigger.ttf
(Stored with Git LFS)
Normal file
BIN
Luxe/assets/fonts/src/BabyBlocksBigger.ttf
(Stored with Git LFS)
Normal file
Binary file not shown.
|
|
@ -23,9 +23,8 @@ class Human {
|
||||||
}
|
}
|
||||||
static set_name(entity, name){
|
static set_name(entity, name){
|
||||||
var data = Modifiers.get(This, entity)
|
var data = Modifiers.get(This, entity)
|
||||||
var id = Strings.add(name)
|
Strings.add(name)
|
||||||
System.print("Setting name of %(entity) to %(name) via string id of %(id).")
|
data.name = name
|
||||||
//data.name = id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static get_name(entity){
|
static get_name(entity){
|
||||||
|
|
@ -77,6 +76,8 @@ class HumanSystem is ModifierSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
tick(delta) {
|
tick(delta) {
|
||||||
|
if(World.tag_has(_world, "edit")) return
|
||||||
|
|
||||||
//called usually once every frame.
|
//called usually once every frame.
|
||||||
//called when the world that this modifier lives in, is ticked
|
//called when the world that this modifier lives in, is ticked
|
||||||
each {|entity, data|
|
each {|entity, data|
|
||||||
|
|
@ -105,6 +106,8 @@ class HumanSystem is ModifierSystem {
|
||||||
} //tick
|
} //tick
|
||||||
|
|
||||||
update(){
|
update(){
|
||||||
|
if(World.tag_has(_world, "edit")) return
|
||||||
|
|
||||||
var size = Vector.new(player_size)
|
var size = Vector.new(player_size)
|
||||||
var pos = Vector.new(player_start) + size / 2
|
var pos = Vector.new(player_start) + size / 2
|
||||||
each {|entity, data|
|
each {|entity, data|
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,23 @@ import "math/vector" for Vector
|
||||||
class Tooltip{
|
class Tooltip{
|
||||||
depth{100}
|
depth{100}
|
||||||
color{[1, 1, 1, 1]}
|
color{[1, 1, 1, 1]}
|
||||||
|
background{[1, 0, 1, 1]}
|
||||||
|
|
||||||
construct new(app){
|
construct new(app){
|
||||||
_ent = Entity.create(app.ui)
|
_text = Entity.create(app.ui)
|
||||||
_mat_font = Assets.material("luxe: material/font")
|
_bg = Entity.create(app.ui)
|
||||||
Text.create(_ent, _mat_font, 8, "assets/fonts/BabyBlocks", color)
|
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)
|
||||||
|
|
||||||
Transform.create(_ent)
|
Transform.create(_text)
|
||||||
Transform.set_pos(_ent, 64, 128, depth)
|
Transform.set_pos(_text, 64, 128, depth)
|
||||||
Transform.set_snap(_ent, 1, 1, 0)
|
Transform.set_snap(_text, 1, 1, 0)
|
||||||
|
|
||||||
|
Transform.create(_bg)
|
||||||
|
Transform.set_pos(_bg, 64, 128, depth)
|
||||||
|
Transform.set_snap(_bg, 1, 1, 0)
|
||||||
|
|
||||||
Globals["Tooltip"] = this
|
Globals["Tooltip"] = this
|
||||||
}
|
}
|
||||||
|
|
@ -29,7 +37,8 @@ class Tooltip{
|
||||||
if(_y){
|
if(_y){
|
||||||
pos.y = _y
|
pos.y = _y
|
||||||
}
|
}
|
||||||
Transform.set_pos(_ent, pos.x, pos.y, depth)
|
Transform.set_pos(_text, pos.x, pos.y, depth)
|
||||||
|
Transform.set_pos(_bg, pos.x, pos.y - 1, depth-1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,8 +55,10 @@ class Tooltip{
|
||||||
}
|
}
|
||||||
|
|
||||||
set(text, source){
|
set(text, source){
|
||||||
Text.set_text_buffer(_ent, text)
|
Text.set_text_buffer(_bg, text)
|
||||||
Text.commit(_ent)
|
Text.commit(_bg)
|
||||||
|
//Text.set_text_buffer(_text, text)
|
||||||
|
//Text.commit(_text)
|
||||||
_active = true
|
_active = true
|
||||||
_source = source
|
_source = source
|
||||||
_x = null
|
_x = null
|
||||||
|
|
@ -62,8 +73,10 @@ class Tooltip{
|
||||||
if(_source != source) {
|
if(_source != source) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Text.set_text_buffer(_ent, "")
|
Text.set_text_buffer(_text, "")
|
||||||
Text.commit(_ent)
|
Text.commit(_text)
|
||||||
|
Text.set_text_buffer(_bg, "")
|
||||||
|
Text.commit(_bg)
|
||||||
_active = false
|
_active = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +132,7 @@ class Ui{
|
||||||
Control.set_id(name, "human name info")
|
Control.set_id(name, "human name info")
|
||||||
Globals["Game"].Focus.on_change(true) {|val|
|
Globals["Game"].Focus.on_change(true) {|val|
|
||||||
var name_string = Human.get_name(val) || "-"
|
var name_string = Human.get_name(val) || "-"
|
||||||
UISimpleText.set_text(name, name_string)
|
UISimpleText.set_text(name, name_string + "\n" + name_string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ class UISimpleText{
|
||||||
var text = Control.create(ent)
|
var text = Control.create(ent)
|
||||||
Control.set_state_data(text, {"text": ""})
|
Control.set_state_data(text, {"text": ""})
|
||||||
Control.set_size(text, 100, size)
|
Control.set_size(text, 100, size)
|
||||||
Control.set_render(text) {|control, state, x,y,w,h|
|
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)
|
UI.draw_text(control, x, y + size/2, 0, state["text"], size, font, [1,1,1,1], TextAlign.left, TextAlign.top)
|
||||||
}
|
}
|
||||||
return text
|
return text
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue