diff --git a/.luxeignore b/.luxeignore deleted file mode 100644 index a3de5ef..0000000 --- a/.luxeignore +++ /dev/null @@ -1 +0,0 @@ -preview.png \ No newline at end of file diff --git a/queue.wren b/api/_queue.wren similarity index 93% rename from queue.wren rename to api/_queue.wren index c24f10f..48d56cf 100644 --- a/queue.wren +++ b/api/_queue.wren @@ -1,3 +1,4 @@ +#hidden class Queue is Sequence{ data{_data} count{_count} diff --git a/modifiers/trail/trail.modifier.wren b/api/modifier/trail.modifier.wren similarity index 92% rename from modifiers/trail/trail.modifier.wren rename to api/modifier/trail.modifier.wren index 54d4f88..b460035 100644 --- a/modifiers/trail/trail.modifier.wren +++ b/api/modifier/trail.modifier.wren @@ -5,7 +5,7 @@ import "luxe: io" for IO import "luxe: bytes" for Byter, Bytes import "luxe: world" for Block -//`modifiers/trail/trail > runtime` types +//`trail: modifier/trail > runtime` types class ModifierRuntime { @@ -14,7 +14,7 @@ import "luxe: world" for Block } //ModifierRuntime -//`modifiers/trail/trail > runtime` compilers +//`trail: modifier/trail > runtime` compilers class ModifierRuntimeCompiler { @@ -73,7 +73,7 @@ import "luxe: world" for Block write_block(compiler, out) { //source id - out.write_uint32(compiler.string.hash("modifiers/trail/trail > runtime")) + out.write_uint32(compiler.string.hash("trail: modifier/trail > runtime")) //fields count out.write_int32(0) @@ -95,12 +95,12 @@ import "luxe: world" for Block } //ModifierRuntimeCompiler -//`modifiers/trail/trail > runtime` block types +//`trail: modifier/trail > runtime` block types class BlockModifierRuntime { field { "trail" } - source { "modifiers/trail/trail > runtime" } + source { "trail: modifier/trail > runtime" } construct new(block) { _block = block @@ -112,7 +112,7 @@ import "luxe: world" for Block _block = Block.create() _inst_type = instance_type _inst = _inst_type.new(_block, 0) - Block.set_type(_block, "modifiers/trail/trail > runtime") + Block.set_type(_block, "trail: modifier/trail > runtime") } //new instance_type { @@ -151,7 +151,7 @@ import "luxe: world" for Block } //BlockModifierRuntime -//`modifiers/trail/trail > data` types +//`trail: modifier/trail > data` types class ModifierData { @@ -162,7 +162,7 @@ import "luxe: world" for Block _length = 0.2 _subdivisions_length = 10 _subdivisions_width = 5 - _material = "asset/flag" + _material = "trail: default_material/flag" } //new edge_length { _edge_length } @@ -188,7 +188,7 @@ import "luxe: world" for Block } //ModifierData -//`modifiers/trail/trail > data` compilers +//`trail: modifier/trail > data` compilers class ModifierDataCompiler { @@ -286,7 +286,7 @@ import "luxe: world" for Block var material = instance["material"] - if(material == null) material = "asset/flag" + if(material == null) material = "trail: default_material/flag" out.write_uint32((material && material != "") ? compiler.string.hash(material) : 0) @@ -303,7 +303,7 @@ import "luxe: world" for Block write_block(compiler, out) { //source id - out.write_uint32(compiler.string.hash("modifiers/trail/trail > data")) + out.write_uint32(compiler.string.hash("trail: modifier/trail > data")) //fields count out.write_int32(7) @@ -353,7 +353,7 @@ import "luxe: world" for Block // material out.write_uint32(compiler.string.hash("material")) out.write_uint32(2729592961) //type id32 - var material_default = "asset/flag" + var material_default = "trail: default_material/flag" out.write_uint32((material_default && material_default != "") ? compiler.string.hash(material_default) : 0) @@ -374,12 +374,12 @@ import "luxe: world" for Block } //ModifierDataCompiler -//`modifiers/trail/trail > data` block types +//`trail: modifier/trail > data` block types class BlockModifierData { field { "trail" } - source { "modifiers/trail/trail > data" } + source { "trail: modifier/trail > data" } construct new(block) { _block = block @@ -397,8 +397,8 @@ import "luxe: world" for Block Block.add(_block, "length", "number", 0.2) Block.add(_block, "subdivisions_length", "number", 10) Block.add(_block, "subdivisions_width", "number", 5) - Block.add(_block, "material", "id32", "asset/flag") - Block.set_type(_block, "modifiers/trail/trail > data") + Block.add(_block, "material", "id32", "trail: default_material/flag") + Block.set_type(_block, "trail: modifier/trail > data") } //new instance_type { @@ -451,7 +451,7 @@ import "luxe: world" for Block } //BlockModifierData -//`modifiers/trail/trail > world` types +//`trail: modifier/trail > world` types class ModifierWorld { @@ -460,7 +460,7 @@ import "luxe: world" for Block } //ModifierWorld -//`modifiers/trail/trail > world` compilers +//`trail: modifier/trail > world` compilers class ModifierWorldCompiler { @@ -519,7 +519,7 @@ import "luxe: world" for Block write_block(compiler, out) { //source id - out.write_uint32(compiler.string.hash("modifiers/trail/trail > world")) + out.write_uint32(compiler.string.hash("trail: modifier/trail > world")) //fields count out.write_int32(0) @@ -541,12 +541,12 @@ import "luxe: world" for Block } //ModifierWorldCompiler -//`modifiers/trail/trail > world` block types +//`trail: modifier/trail > world` block types class BlockModifierWorld { field { "trail" } - source { "modifiers/trail/trail > world" } + source { "trail: modifier/trail > world" } construct new(block) { _block = block @@ -558,7 +558,7 @@ import "luxe: world" for Block _block = Block.create() _inst_type = instance_type _inst = _inst_type.new(_block, 0) - Block.set_type(_block, "modifiers/trail/trail > world") + Block.set_type(_block, "trail: modifier/trail > world") } //new instance_type { diff --git a/modifiers/trail/trail.wren b/api/modifier/trail.wren similarity index 99% rename from modifiers/trail/trail.wren rename to api/modifier/trail.wren index d74e868..1c5548b 100644 --- a/modifiers/trail/trail.wren +++ b/api/modifier/trail.wren @@ -5,12 +5,12 @@ import "luxe: color" for Color import "luxe: render" for Geometry, Primitive, IndexType, Render import "luxe: assets" for Assets, Strings import "luxe: bytes" for Uint16, Floats - -import "queue" for Queue - -import "modifiers/trail/trail.modifier" for ModifierData import "luxe: math" for Math +import "trail: _queue" for Queue + +import "trail: modifier/trail.modifier" for ModifierData + //User facing API //This is what the user of your modifier will interact with class Trail { @@ -153,6 +153,7 @@ class TrailSystem is ModifierSystem { init(world) { _world = world _draw = Draw.create(World.render_set(world)) + var edge_debug = PathStyle.new() edge_debug.color = [1,1,1,1] edge_debug.thickness = 2 @@ -203,7 +204,7 @@ class TrailSystem is ModifierSystem { Render.vertex_buffer_replace(inst_data.color_buffer, color_data, color_data.length)*/ //...but for now... - var data = get(entity) + var data = get(entity) detach(entity, data) attach(entity, data) } @@ -213,6 +214,7 @@ class TrailSystem is ModifierSystem { } attach(entity, data: ModifierData) { + var material_id = Strings.get(data.material) var material = Assets.material(material_id) diff --git a/asset/flag.material.lx b/asset/flag.material.lx deleted file mode 100644 index 23bcbbb..0000000 --- a/asset/flag.material.lx +++ /dev/null @@ -1,8 +0,0 @@ -material = { - basis = "asset/clamped_sprite" - inputs = { - sprite.image = "asset/flag" - sprite.color = [1 1 1 1] - sprite.uv = [0 0 1 1] - } -} \ No newline at end of file diff --git a/asset/clamped_sprite.material_basis.lx b/assets/default_material/clamped_sprite.material_basis.lx similarity index 100% rename from asset/clamped_sprite.material_basis.lx rename to assets/default_material/clamped_sprite.material_basis.lx diff --git a/asset/flag.image.lx b/assets/default_material/flag.image.lx similarity index 50% rename from asset/flag.image.lx rename to assets/default_material/flag.image.lx index b7f5709..c76b4f2 100644 --- a/asset/flag.image.lx +++ b/assets/default_material/flag.image.lx @@ -1,4 +1,4 @@ image = { - source = "asset/flag.png" + source = "trail: default_material/flag.png" generate_mipmaps_at_load = false } \ No newline at end of file diff --git a/assets/default_material/flag.material.lx b/assets/default_material/flag.material.lx new file mode 100644 index 0000000..e975209 --- /dev/null +++ b/assets/default_material/flag.material.lx @@ -0,0 +1,8 @@ +material = { + basis = "trail: default_material/clamped_sprite" + inputs = { + sprite.image = "trail: default_material/flag" + sprite.color = [1 1 1 1] + sprite.uv = [0 0 1 1] + } +} \ No newline at end of file diff --git a/asset/flag.png b/assets/default_material/flag.png similarity index 100% rename from asset/flag.png rename to assets/default_material/flag.png diff --git a/modifiers/trail/trail.modifier.lx b/assets/modifier/trail.modifier.lx similarity index 78% rename from modifiers/trail/trail.modifier.lx rename to assets/modifier/trail.modifier.lx index f81ad58..dc39602 100644 --- a/modifiers/trail/trail.modifier.lx +++ b/assets/modifier/trail.modifier.lx @@ -1,6 +1,6 @@ modifier = { - script = "modifiers/trail/trail" - description = "Trail go brrr." + script = "trail: trail" + description = "Dynamic trails." field = "trail" display = "Trail" //the display in the editor class = "Trail" //The code generated name for the modifier API @@ -13,7 +13,7 @@ modifier = { { name="length" type="number" default=.2 } { name="subdivisions_length" type="number" default=10 } { name="subdivisions_width" type="number" default=5 } - { name="material" type="id32" editor="material" default="asset/flag"} + { name="material" type="id32" editor="material" default="trail: default_material/flag"} ] } } \ No newline at end of file diff --git a/module.lx b/module.lx new file mode 100644 index 0000000..28892b9 --- /dev/null +++ b/module.lx @@ -0,0 +1,4 @@ +name = "trail" +owner = "Ronja" +version = "dev" +description = "Simple trails. Just add a trail modifier to your moving component." diff --git a/game.wren b/samples/sample/game.wren similarity index 93% rename from game.wren rename to samples/sample/game.wren index 2b7cefa..d80e62e 100644 --- a/game.wren +++ b/samples/sample/game.wren @@ -7,7 +7,7 @@ import "luxe: draw" for Draw import "luxe: io" for IO import "outline/app" for App -import "modifiers/trail/trail" for Trail +import "trail: modifier/trail" for Trail class Game is Ready { @@ -46,7 +46,7 @@ class Game is Ready { } if(Input.key_state_released(Key.key_1)) { - var subs = Trail.get_subdivisions_length(_blade) + 1 + var subs = Trail.get_subdivisions_length(_blade) + 5 Trail.set_subdivisions_length(_blade, subs) } diff --git a/outline/app.wren b/samples/sample/outline/app.wren similarity index 100% rename from outline/app.wren rename to samples/sample/outline/app.wren diff --git a/outline/inputs.input.lx b/samples/sample/outline/inputs.input.lx similarity index 100% rename from outline/inputs.input.lx rename to samples/sample/outline/inputs.input.lx diff --git a/outline/renderer.wren b/samples/sample/outline/renderer.wren similarity index 100% rename from outline/renderer.wren rename to samples/sample/outline/renderer.wren diff --git a/outline/settings.settings.lx b/samples/sample/outline/settings.settings.lx similarity index 100% rename from outline/settings.settings.lx rename to samples/sample/outline/settings.settings.lx diff --git a/project.luxe b/samples/sample/project.luxe similarity index 90% rename from project.luxe rename to samples/sample/project.luxe index ededc55..ae60a15 100644 --- a/project.luxe +++ b/samples/sample/project.luxe @@ -5,7 +5,7 @@ class Project is Entry { construct entry(target) { name = "Trail Test" - version = "0.0.0" + version = "1.0.0" renderer = "outline/renderer" settings = "outline/settings" diff --git a/project.modules.lx b/samples/sample/project.modules.lx similarity index 70% rename from project.modules.lx rename to samples/sample/project.modules.lx index 2ce9e6b..2b25c1b 100644 --- a/project.modules.lx +++ b/samples/sample/project.modules.lx @@ -1,3 +1,4 @@ modules = { luxe = "dev" + trail = "dev" } //modules