From eb1ee4c210a53dbc08d2ee8ecae34674f3942816 Mon Sep 17 00:00:00 2001 From: bakpakin Date: Sun, 29 Mar 2015 15:50:42 +0800 Subject: [PATCH] Change repo name --- README.md | 27 ++++++++++++--------------- spec/{jojo_spec.lua => tiny_spec.lua} | 10 +++++----- jojo.lua => tiny.lua | 24 ++++++++++++------------ 3 files changed, 29 insertions(+), 32 deletions(-) rename spec/{jojo_spec.lua => tiny_spec.lua} (96%) rename jojo.lua => tiny.lua (97%) diff --git a/README.md b/README.md index 4ac1eab..815c152 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ -# Jojo # -Jojo is an Entity Component System for lua that's simple, flexible, and useful. +# tiny-ecs # +Tiny-ecs is an Entity Component System for lua that's simple, flexible, and useful. Because of lua's tabular nature, Entity Component Systems are a natural choice for simulating large and complex systems. For more explanation on Entity Component Systems, here is some [basic info](http://en.wikipedia.org/wiki/Entity_component_system "Wikipedia"). ## Use It ## -Copy paste jojo.lua into your source folder. +Copy paste tiny.lua into your source folder. ## Overview ## -Jojo has four important types: Worlds, Aspects, Systems, and Entities. +Tiny-ecs has four important types: Worlds, Aspects, Systems, and Entities. Entities, however, can be any lua table. ### Entities ### @@ -19,11 +19,11 @@ do logic on data. Henceforth, a key-value pair in an Entity will be referred to as a Component. ### Worlds ### -Worlds are the outermost containers in Jojo that contain both Systems +Worlds are the outermost containers in tiny-ecs that contain both Systems and Entities. In typical use, only one World is used at a time. ### Systems ### -Systems in Jojo describe how to update Entities. Systems select certain Entities +Systems in tiny-ecs describe how to update Entities. Systems select certain Entities using an aspect, and then only update those select Entities. Systems have three parts: a one-time update function, a per Entity update function, and an Aspect. The one-time update function is called once per World update, and the per Entity @@ -39,15 +39,11 @@ are equivalent to the union of all sub-Aspects. ## Example ## ```lua -local jojo = require("jojo") +local tiny = require("tiny") -local World = jojo.World -local Aspect = jojo.Aspect -local System = jojo.System +local personAspect = tiny.Aspect({"name", "mass", "phrase"}) -local personAspect = Aspect({"name", "mass", "phrase"}) - -local talkingSystem = System( +local talkingSystem = tiny.System( nil, function (p, delta) p.mass = p.mass + delta * 3 @@ -63,7 +59,7 @@ local joe = { hairColor = "brown" } -local world = World(talkingSystem, joe) +local world = tiny.World(talkingSystem, joe) for i = 1, 20 do world:update(1) @@ -71,7 +67,7 @@ end ``` ## Testing ## -Jojo uses [busted](http://olivinelabs.com/busted/) for testing. Install and run +Tiny-ecs uses [busted](http://olivinelabs.com/busted/) for testing. Install and run `busted` from the command line to test. ## TODO ## @@ -80,3 +76,4 @@ Jojo uses [busted](http://olivinelabs.com/busted/) for testing. Install and run * More testing * Performance testing / optimization * API outside of source code +* Add more complete examples diff --git a/spec/jojo_spec.lua b/spec/tiny_spec.lua similarity index 96% rename from spec/jojo_spec.lua rename to spec/tiny_spec.lua index 0286e00..e280029 100644 --- a/spec/jojo_spec.lua +++ b/spec/tiny_spec.lua @@ -1,8 +1,8 @@ -local jojo = require "jojo" +local tiny = require "tiny" -local World = jojo.World -local Aspect = jojo.Aspect -local System = jojo.System +local World = tiny.World +local Aspect = tiny.Aspect +local System = tiny.System -- Taken from answer at http://stackoverflow.com/questions/640642/how-do-you-copy-a-lua-table-by-value local function deep_copy(o, seen) @@ -50,7 +50,7 @@ local entityTemplate3 = { description = "The smallest entity." } -describe('Jojo:', function() +describe('tiny-ecs:', function() describe('Aspect:', function() diff --git a/jojo.lua b/tiny.lua similarity index 97% rename from jojo.lua rename to tiny.lua index c6922a5..99e1b4f 100644 --- a/jojo.lua +++ b/tiny.lua @@ -1,7 +1,7 @@ -local jojo = { - _VERSION = "0.1.0", - _URL = "https://github.com/bakpakin/Jojo", - _DESCRIPTION = "jojo - Entity Component System for lua." +local tiny = { + _VERSION = "0.2.0", + _URL = "https://github.com/bakpakin/tiny-ecs", + _DESCRIPTION = "tiny-ecs - Entity Component System for lua." } local tinsert = table.insert @@ -34,9 +34,9 @@ local World = class("World") local Aspect = class("Aspect") local System = class("System") -jojo.World = World -jojo.Aspect = Aspect -jojo.System = System +tiny.World = World +tiny.Aspect = Aspect +tiny.System = System ----- Aspect ----- @@ -156,9 +156,9 @@ end function Aspect:__tostring() if self[4] then - return "JojoAspect<>" + return "TinyAspect<>" else - return "JojoAspect