move to luxe 2020.3
This commit is contained in:
parent
8645f7966a
commit
6e1db30a8b
13 changed files with 91 additions and 50 deletions
|
|
@ -3,18 +3,18 @@ names = [
|
|||
//make groups based on origin culture / meaning
|
||||
//probably better to do when I have a procgen text engine
|
||||
|
||||
"Bob",
|
||||
"Steve",
|
||||
"Ronja",
|
||||
"Amelia",
|
||||
"Chloe",
|
||||
"Lauren",
|
||||
"Innes",
|
||||
"Rami",
|
||||
"Mao",
|
||||
"Richard",
|
||||
"Jules",
|
||||
"Mercedes",
|
||||
"Karl",
|
||||
"Bob"
|
||||
"Steve"
|
||||
"Ronja"
|
||||
"Amelia"
|
||||
"Chloe"
|
||||
"Lauren"
|
||||
"Innes"
|
||||
"Rami"
|
||||
"Mao"
|
||||
"Richard"
|
||||
"Jules"
|
||||
"Mercedes"
|
||||
"Karl"
|
||||
"Lara"
|
||||
]
|
||||
|
|
@ -1,16 +1,19 @@
|
|||
modifier = {
|
||||
description = "Moves to a point in space at a constant speed."
|
||||
description = "What is a man?"
|
||||
field = "human"
|
||||
display = "Human"
|
||||
class = "Human"
|
||||
dependency = []
|
||||
|
||||
blocks = {
|
||||
data={
|
||||
data = {
|
||||
fields = [
|
||||
{ name="active" type="boolean" default=true }
|
||||
{ name="name" type="id32" default="unnamed" }
|
||||
{ name="color" type="float4" default=[1, 0, 0, 1] }
|
||||
{ name="active" type="boolean" default=true }
|
||||
{ name="name" type="id32" default="unnamed" }
|
||||
{ name="color" type="float4" default=[1, 0, 0, 1] }
|
||||
//todo: turn this into a implicit number via references from adventure list
|
||||
//todo: make this int?
|
||||
{ name="adventure_count" type="number" default=0 }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ import "luxe: world" for Block
|
|||
_active = true
|
||||
_name = "unnamed"
|
||||
_color = [1, 0, 0, 1]
|
||||
_adventure_count = 0
|
||||
} //new
|
||||
|
||||
active { _active }
|
||||
|
|
@ -170,6 +171,9 @@ import "luxe: world" for Block
|
|||
color { _color }
|
||||
color=(vvv) { _color = vvv }
|
||||
|
||||
adventure_count { _adventure_count }
|
||||
adventure_count=(vvv) { _adventure_count = vvv }
|
||||
|
||||
} //ModifierData
|
||||
|
||||
//`blocks/human/human > data` compilers
|
||||
|
|
@ -189,6 +193,8 @@ import "luxe: world" for Block
|
|||
|
||||
size = size + 16 // color
|
||||
|
||||
size = size + 8 // adventure_count
|
||||
|
||||
size = size + 0
|
||||
|
||||
return size
|
||||
|
|
@ -204,6 +210,7 @@ import "luxe: world" for Block
|
|||
"active": false,
|
||||
"name": false,
|
||||
"color": false,
|
||||
"adventure_count": false,
|
||||
}
|
||||
for(element in elements) {
|
||||
var instance = element.value
|
||||
|
|
@ -245,13 +252,18 @@ import "luxe: world" for Block
|
|||
out.write_float32(color[3])
|
||||
|
||||
|
||||
var adventure_count = instance["adventure_count"]
|
||||
if(adventure_count == null) adventure_count = 0
|
||||
out.write_float64(adventure_count)
|
||||
|
||||
|
||||
return out
|
||||
|
||||
} //write
|
||||
|
||||
bytes_count_block() {
|
||||
|
||||
return 56
|
||||
return 72
|
||||
|
||||
} //bytes_count_block
|
||||
|
||||
|
|
@ -261,7 +273,7 @@ import "luxe: world" for Block
|
|||
out.write_uint32(compiler.string.hash("blocks/human/human > data"))
|
||||
|
||||
//fields count
|
||||
out.write_int32(3)
|
||||
out.write_int32(4)
|
||||
|
||||
// active
|
||||
out.write_uint32(compiler.string.hash("active"))
|
||||
|
|
@ -287,6 +299,13 @@ import "luxe: world" for Block
|
|||
out.write_float32(color_default[3])
|
||||
|
||||
|
||||
// adventure_count
|
||||
out.write_uint32(compiler.string.hash("adventure_count"))
|
||||
out.write_uint32(467038368) //type number
|
||||
var adventure_count_default = 0
|
||||
out.write_float64(adventure_count_default)
|
||||
|
||||
|
||||
} //write_block
|
||||
|
||||
write(instance) {
|
||||
|
|
@ -324,6 +343,7 @@ import "luxe: world" for Block
|
|||
Block.add(_block, "active", "boolean", true)
|
||||
Block.add(_block, "name", "id32", "unnamed")
|
||||
Block.add(_block, "color", "float4", [1, 0, 0, 1])
|
||||
Block.add(_block, "adventure_count", "number", 0)
|
||||
Block.set_type(_block, "blocks/human/human > data")
|
||||
} //new
|
||||
|
||||
|
|
@ -336,6 +356,8 @@ import "luxe: world" for Block
|
|||
name=(v) { Block.set(_block, "name", _slot, v) }
|
||||
color { Block.get(_block, "color", _slot) }
|
||||
color=(v) { Block.set(_block, "color", _slot, v) }
|
||||
adventure_count { Block.get(_block, "adventure_count", _slot) }
|
||||
adventure_count=(v) { Block.set(_block, "adventure_count", _slot, v) }
|
||||
slot { _slot }
|
||||
entity { Block.get_handle(_block, _slot) }
|
||||
block_set_slot(value) {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,17 @@ class Human {
|
|||
return data.color
|
||||
}
|
||||
|
||||
static get_adventure_count(entity){
|
||||
if(entity == 0 || !entity) return null
|
||||
var data = Modifiers.get(This, entity)
|
||||
return data.adventure_count
|
||||
}
|
||||
|
||||
static increase_adventure_count(entity){
|
||||
var data = Modifiers.get(This, entity)
|
||||
data.adventure_count = data.adventure_count + 1
|
||||
}
|
||||
|
||||
} //Human
|
||||
|
||||
//Your modifier system implementation.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import "luxe: world" for Entity, Text, Transform
|
||||
import "luxe: assets" for Assets
|
||||
import "luxe: render" for Material
|
||||
|
||||
import "globals" for Globals
|
||||
import "math/vector" for Vector
|
||||
|
|
@ -7,9 +8,9 @@ import "math/vector" for Vector
|
|||
class Tooltip{
|
||||
depth{100}
|
||||
color{[1, 1, 1, 1]}
|
||||
background{[1, 0, 1, 1]}
|
||||
background{[0, 0, 0, 1]}
|
||||
|
||||
shadowOffsets{[[1, 0],[0, 1],[-1, 0],[0, -1]]}
|
||||
shadowOffsets{[[1, 0],[0, 1],[-1, 0],[0, -1],[1, 1],[1, -1],[-1, -1],[-1, 1]]}
|
||||
|
||||
construct new(app){
|
||||
_text = Entity.create(app.ui)
|
||||
|
|
@ -23,9 +24,9 @@ class Tooltip{
|
|||
_shadows = []
|
||||
for(i in offsets){
|
||||
var shadow = Entity.create(app.ui)
|
||||
Text.create(shadow, mat, 8, "assets/fonts/BabyBlocks", background)
|
||||
Text.create(shadow, Material.clone(mat), 8, "assets/fonts/BabyBlocks", background)
|
||||
Transform.create(shadow)
|
||||
Transform.set_snap(_text, 1, 1, 0)
|
||||
Transform.set_snap(shadow, 1, 1, 0)
|
||||
_shadows.add(shadow)
|
||||
}
|
||||
|
||||
|
|
@ -63,12 +64,12 @@ class Tooltip{
|
|||
}
|
||||
|
||||
set(text, source){
|
||||
Text.set_text_buffer(_text, text)
|
||||
Text.commit(_text)
|
||||
for(shadow in _shadows){
|
||||
Text.set_text_buffer(shadow, text)
|
||||
Text.commit(shadow)
|
||||
}
|
||||
Text.set_text_buffer(_text, text)
|
||||
Text.commit(_text)
|
||||
_active = true
|
||||
_source = source
|
||||
_x = null
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ class Ui{
|
|||
ImageButton.set_tooltip(button, "Adventure!")
|
||||
ImageButton.set_tile_uv(button, tiles, [1, 0])
|
||||
ImageButton.set_state_change(button) { |data|
|
||||
System.print("adventure button: %(data)")
|
||||
if(data["press"]){
|
||||
ui_mode = Ui.Planning
|
||||
}
|
||||
|
|
@ -128,11 +129,20 @@ class Ui{
|
|||
var name = UISimpleText.create(_ui)
|
||||
Control.set_pos(name, 33, 1)
|
||||
Control.child_add(root, name)
|
||||
Control.set_allow_input(name, true)
|
||||
Control.set_id(name, "human name info")
|
||||
Globals["Game"].Focus.on_change(true) {|val|
|
||||
var name_string = Human.get_name(val) || "-"
|
||||
UISimpleText.set_text(name, name_string + "\n" + name_string)
|
||||
UISimpleText.set_text(name, name_string)
|
||||
}
|
||||
|
||||
var adventures = UISimpleText.create(_ui)
|
||||
Control.set_pos(adventures, 33, 10)
|
||||
Control.child_add(root, adventures)
|
||||
Control.set_id(name, "human adventure count")
|
||||
Globals["Game"].Focus.on_change(true) {|val|
|
||||
var count = Human.get_adventure_count(val)
|
||||
var text = count ? "Adventures: %(count)" : ""
|
||||
UISimpleText.set_text(adventures, text)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -158,7 +168,8 @@ class Ui{
|
|||
UIImage.set_image(button, adventureButtons)
|
||||
ImageButton.set_tooltip(button, "Info")
|
||||
ImageButton.set_tile_uv(button, tiles, [1, 0])
|
||||
ImageButton.set_state_change(button) { |data|
|
||||
ImageButton.set_state_change(button) { |data|
|
||||
System.print("info button: %(data)")
|
||||
if(data["press"]){
|
||||
ui_mode = Ui.Info
|
||||
}
|
||||
|
|
@ -205,10 +216,6 @@ class Ui{
|
|||
Control.set_pos(button, i*16, 0) //let list handle this in future
|
||||
return button
|
||||
}
|
||||
|
||||
test(){
|
||||
ImageButton.get_data(_test)
|
||||
}
|
||||
}
|
||||
|
||||
//this is behind the class def to make cyclic dependency happy lol
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import "luxe: game" for Game
|
||||
import "luxe: game" for Ready
|
||||
import "luxe: input" for Input, Key
|
||||
import "luxe: world" for World, Entity, Transform, Sprite, Values, Tags, Camera
|
||||
import "luxe: math" for Math
|
||||
|
|
@ -19,8 +19,9 @@ import "math/observable" for Observable
|
|||
import "blocks/tooltip" for Tooltip
|
||||
import "blocks/human/human" for Human
|
||||
|
||||
class game is Game {
|
||||
class Game is Ready {
|
||||
construct ready() {
|
||||
super("Cabin Game")
|
||||
Globals["Game"] = this
|
||||
|
||||
_focus = Observable.new()
|
||||
|
|
@ -53,8 +54,6 @@ class game is Game {
|
|||
if(Input.key_state_pressed(Key.key_q)) {
|
||||
_tooltip.cycle_size()
|
||||
}
|
||||
|
||||
_ui.test()
|
||||
|
||||
DrawDebug.commit()
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class Util{
|
|||
|
||||
static material_from_image(image){
|
||||
var material = Material.create("luxe: material_basis/sprite_pixelated")
|
||||
Material.set_image(material, 0, image)
|
||||
Material.set_input(material, "sprite.image", image)
|
||||
return material
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,11 +73,8 @@ class App {
|
|||
|
||||
//update worlds
|
||||
|
||||
World.tick_systems(_world, delta)
|
||||
World.tick_systems(_ui_world, delta)
|
||||
|
||||
World.tick_world(_world, delta)
|
||||
World.tick_world(_ui_world, delta)
|
||||
World.tick(_world, delta)
|
||||
World.tick(_ui_world, delta)
|
||||
|
||||
//render worlds
|
||||
render_empty("clear")
|
||||
|
|
|
|||
|
|
@ -136,9 +136,10 @@ class Renderer {
|
|||
} //ui_render_path
|
||||
|
||||
target_to_screen(ctx){
|
||||
//{ library="luxe: shaders" function="vert_color_uv" }
|
||||
var out_pass = PassLayerDesc.new()
|
||||
out_pass.library = "shaders/upscale"
|
||||
out_pass.function = "upscale_top_center"
|
||||
out_pass.fragment.library = "shaders/upscale"
|
||||
out_pass.fragment.function = "upscale_top_center"
|
||||
out_pass.targets = ["screen"]
|
||||
out_pass.inputs = {
|
||||
"pass.flipy" : true,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ engine = {
|
|||
window = {
|
||||
width = 512
|
||||
height = 768
|
||||
resizable = true
|
||||
resizable = false
|
||||
fullscreen = false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import "luxe: project" for Project
|
||||
import "luxe: project" for Entry
|
||||
|
||||
class project is Project {
|
||||
class Project is Entry {
|
||||
|
||||
construct new(target) {
|
||||
construct entry(target) {
|
||||
|
||||
name = "Cabin Game"
|
||||
version = "0.0.0"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
modules = {
|
||||
luxe = "2020.2.0"
|
||||
luxe = "2020.3.0"
|
||||
} //modules
|
||||
|
|
|
|||
Loading…
Reference in a new issue