Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristhofer Travieso <cristhofert97@gmail.com>2012-10-03 21:13:57 (GMT)
committer Cristhofer Travieso <cristhofert97@gmail.com>2012-10-03 21:13:57 (GMT)
commit7ee8058d85f3d38c6cdff0f0320505f3d8a6c616 (patch)
tree72424b09b12874974f769dd415d5d7fd2a070f2f
parent236da2e52e2f70eec5d4a04cdb40648fc5048a87 (diff)
Add backgroud
Signed-off-by: Cristhofer Travieso <cristhofert97@gmail.com>
-rw-r--r--game.py4
-rw-r--r--glucosa.py7
-rw-r--r--images/backgroud.pngbin0 -> 4096 bytes
3 files changed, 10 insertions, 1 deletions
diff --git a/game.py b/game.py
index 1855f65..27c79ac 100644
--- a/game.py
+++ b/game.py
@@ -7,7 +7,9 @@ class AntFarm(glucosa.GameArea):
def __init__(self):
glucosa.GameArea.__init__(self)
-
+
+ self.backgroud = glucosa.Image('images/backgroud.png')
+
image = glucosa.Image('images/aceituna.png')
sprite = glucosa.Sprite(image, 100, 100, 18, 18, scale=2)
self.add_sprite(sprite)
diff --git a/glucosa.py b/glucosa.py
index 711c5ef..1ac2414 100644
--- a/glucosa.py
+++ b/glucosa.py
@@ -759,6 +759,8 @@ class GameArea(gtk.DrawingArea):
self.sprites = []
self._timeout = None
+ self.backgroud = None
+
self.connect("expose-event", self._on_draw)
self.set_events( gtk.gdk.BUTTON_PRESS_MASK
@@ -799,6 +801,11 @@ class GameArea(gtk.DrawingArea):
window_size = self.get_window().get_size()
fill(context, (50,50,50), window_size)
+ # Dibuja el fondo
+ if not self.backgroud == None:
+ self.backgroud.blit(context, 0, 0, scale=1, rotation=0, anchor_x=0,
+ anchor_y=0, flip=False)
+
# Se encarga de dibujar los sprites
for sprite in self.sprites:
sprite.draw(context)
diff --git a/images/backgroud.png b/images/backgroud.png
new file mode 100644
index 0000000..441ebec
--- /dev/null
+++ b/images/backgroud.png
Binary files differ