fix ui import in a ugly way, yell ui type on import and fix color
This commit is contained in:
parent
db0fe205ec
commit
62f8f02b58
3 changed files with 14 additions and 9 deletions
|
|
@ -10,7 +10,7 @@ modifier = {
|
|||
fields = [
|
||||
{ name="active" type="boolean" default=true }
|
||||
{ name="name" type="id32" default="unnamed" }
|
||||
{ name="color" type="float3" default=[1, 0, 0] }
|
||||
{ name="color" type="float4" default=[1, 0, 0, 1] }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ import "luxe: world" for Block
|
|||
construct new() {
|
||||
_active = true
|
||||
_name = "unnamed"
|
||||
_color = [1, 0, 0]
|
||||
_color = [1, 0, 0, 1]
|
||||
} //new
|
||||
|
||||
active { _active }
|
||||
|
|
@ -187,7 +187,7 @@ import "luxe: world" for Block
|
|||
|
||||
size = size + 4 // name
|
||||
|
||||
size = size + 12 // color
|
||||
size = size + 16 // color
|
||||
|
||||
size = size + 0
|
||||
|
||||
|
|
@ -238,10 +238,11 @@ import "luxe: world" for Block
|
|||
|
||||
|
||||
var color = instance["color"]
|
||||
if(color == null) color = [1, 0, 0]
|
||||
if(color == null) color = [1, 0, 0, 1]
|
||||
out.write_float32(color[0])
|
||||
out.write_float32(color[1])
|
||||
out.write_float32(color[2])
|
||||
out.write_float32(color[3])
|
||||
|
||||
|
||||
return out
|
||||
|
|
@ -250,7 +251,7 @@ import "luxe: world" for Block
|
|||
|
||||
bytes_count_block() {
|
||||
|
||||
return 52
|
||||
return 56
|
||||
|
||||
} //bytes_count_block
|
||||
|
||||
|
|
@ -278,11 +279,12 @@ import "luxe: world" for Block
|
|||
|
||||
// color
|
||||
out.write_uint32(compiler.string.hash("color"))
|
||||
out.write_uint32(1025475970) //type float3
|
||||
var color_default = [1, 0, 0]
|
||||
out.write_uint32(941587875) //type float4
|
||||
var color_default = [1, 0, 0, 1]
|
||||
out.write_float32(color_default[0])
|
||||
out.write_float32(color_default[1])
|
||||
out.write_float32(color_default[2])
|
||||
out.write_float32(color_default[3])
|
||||
|
||||
|
||||
} //write_block
|
||||
|
|
@ -321,7 +323,7 @@ import "luxe: world" for Block
|
|||
_inst = _inst_type.new(_block, 0)
|
||||
Block.add(_block, "active", "boolean", true)
|
||||
Block.add(_block, "name", "id32", "unnamed")
|
||||
Block.add(_block, "color", "float3", [1, 0, 0])
|
||||
Block.add(_block, "color", "float4", [1, 0, 0, 1])
|
||||
Block.set_type(_block, "blocks/human/human > data")
|
||||
} //new
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import "luxe: assets" for Strings
|
|||
import "luxe: input" for Input, MouseButton
|
||||
import "blocks/ui" for Ui
|
||||
|
||||
System.print("ui is: %(Ui)")
|
||||
|
||||
//User facing API
|
||||
//This is what the user of your modifier will interact with
|
||||
class Human {
|
||||
|
|
@ -94,6 +96,7 @@ class HumanSystem is ModifierSystem {
|
|||
|
||||
var game = Globals["Game"]
|
||||
System.print(Ui)
|
||||
import "blocks/ui" for Ui
|
||||
if(game.ui.ui_mode == Ui.Info){
|
||||
game.Focus.value = entity
|
||||
}
|
||||
|
|
@ -120,7 +123,7 @@ class HumanSystem is ModifierSystem {
|
|||
}
|
||||
if(!Sprite.has(entity)){
|
||||
Sprite.create(entity, _material, 10, 12)
|
||||
Sprite.set_color(entity, data.color.r, data.color.g, data.color.b, 1)
|
||||
Sprite.set_color(entity, data.color.r, data.color.g, data.color.b, data.color.a)
|
||||
}
|
||||
Transform.set_pos(entity, pos.x, pos.y)
|
||||
pos.x = pos.x + size.x
|
||||
|
|
|
|||
Loading…
Reference in a new issue