Beginnings of a simple scene API. Inspired opened-hand's Clutter

This commit is contained in:
Marco Pesenti Gritti
2006-07-22 11:54:27 +02:00
parent 2aa23cfa42
commit a02313d85a
12 changed files with 89 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
class Actor:
def __init__(self):
self._x = 0
self._y = 0
self._width = -1
self._height = -1
def set_position(self, x, y):
self._x = x
self._y = y
def set_size(self, width, height):
self._width = width
self._height = height
def render(self, window):
pass
+15
View File
@@ -0,0 +1,15 @@
from sugar.scene.Actor import Actor
class Group(Actor):
def __init__(self):
self._actors = []
def add(self, actor):
self._actors.append(actor)
def remove(self, actor):
self._actors.remove(actor)
def render(self, drawable):
for actor in self._actors:
actor.render(drawable)
+13
View File
@@ -0,0 +1,13 @@
import gtk
from sugar.scene.Actor import Actor
class PixbufActor(Actor):
def __init__(self, pixbuf):
Actor.__init__(self)
self._pixbuf = pixbuf
def render(self, drawable):
gc = gtk.gdk.GC(drawable)
drawable.draw_pixbuf(gc, self._pixbuf, 0, 0, self._x, self._y)
+5
View File
@@ -0,0 +1,5 @@
from sugar.scene.Group import Group
class Stage(Group):
def __init__(self):
Group.__init__(self)
View File