projects: update some short descriptions
[nit.git] / lib / scene2d.nit
index 18a5d13..2fadd09 100644 (file)
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# 2D management of game elements
+# Framework for 2D management of game elements
 #
 # TODO: collision framework (with quad tree?)
 module scene2d
@@ -23,7 +23,7 @@ abstract class LiveObject
        fun update do end
 
        # Controls whether `update' and `draw' are automatically called by `LiveGroup'
-       var exists writable = true
+       var exists = true is writable
 
        # Redefine this method to asks how to draw on a view
        fun draw(view: View) is abstract
@@ -37,27 +37,34 @@ class Sprite
        super LiveObject
 
        # x coordinate of the center point
-       var x: Int writable = 0
+       var x: Int = 0 is writable
 
        # y coordinate of the center point
-       var y: Int writable = 0
+       var y: Int = 0 is writable
 
        # width of the sprite
-       var width: Int writable = 100
+       var width: Int = 100 is writable
 
        # height of the sprite
-       var height: Int writable = 100
+       var height: Int = 100 is writable
 
+       # X coordinate of left side.
        fun left: Int do return x - width/2
+
+       # X coordinate of right side.
        fun right: Int do return x + width/2
+
+       # Y coordinate of top.
        fun top: Int do return y - height/2
+
+       # Y coordinate of bottom.
        fun bottom: Int do return y + height/2
 
        # x velocity (applied by `update')
-       var vx: Int writable = 0
+       var vx: Int = 0 is writable
 
        # y velocity (applied by `update')
-       var vy: Int writable = 0
+       var vy: Int = 0 is writable
 
        redef fun update
        do
@@ -102,10 +109,6 @@ class LiveGroup[E: LiveObject]
        super LiveObject
        super List[E]
 
-       init
-       do
-       end
-
        # Recursively update each live objects that `exists'
        redef fun update
        do
@@ -151,8 +154,8 @@ interface View
        # This method must be implemented for each specific view.
        # A traditional way of implementation is to use a double-dispatch mechanism
        #
-       # Exemple:
        #     class MyView
+       #         super View
        #         redef fun draw_sprite(s) do s.draw_on_myview(self)
        #     end
        #     redef class Sprite