Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Gambiarra/gambiarra.py
diff options
context:
space:
mode:
Diffstat (limited to 'Gambiarra/gambiarra.py')
-rw-r--r--Gambiarra/gambiarra.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/Gambiarra/gambiarra.py b/Gambiarra/gambiarra.py
index 41dbbf8..0daeee2 100644
--- a/Gambiarra/gambiarra.py
+++ b/Gambiarra/gambiarra.py
@@ -21,8 +21,8 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import sys
-import os.path
-
+import os
+import gtk
import pygame
from Gambiarra.command import Play, Help, Quit
@@ -51,14 +51,19 @@ class Game(object):
congrats_snd = None
def __init__(self, play_sounds=True):
- pygame.init()
self.play_sounds = play_sounds
+ self.running = True
+ self.playing = False
+ self._showed_help = False
+ self.count = 0
+
+ def load_all(self):
+ pygame.init()
if self.play_sounds:
pygame.mixer.init()
- self.screen = pygame.display.set_mode((1200, 900)) #omitindo flags
+ #self.screen = pygame.display.set_mode((1200, 900))
+ self.screen = pygame.display.get_surface()
pygame.display.flip()
- self.running = True
- self.playing = False
pygame.display.set_caption("Gambiarra")
self.clock = pygame.time.Clock()
self.levels = Levels.init_levels()
@@ -68,14 +73,16 @@ class Game(object):
if self.play_sounds:
snd_file = os.path.join("data", "snd", "Congrats.wav")
self.congrats_snd = pygame.mixer.Sound(snd_file)
- self._showed_help = False
- self.count = 0
def run(self):
+ self.load_all()
#inicia o loop
self.main_loop()
def event_handler(self):
+ #GTK events
+ while gtk.events_pending():
+ gtk.main_iteration()
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONDOWN:
self.mouse_event( pygame.mouse.get_pos() )
@@ -163,6 +170,9 @@ class Game(object):
pygame.display.flip()
while True:
+ #GTK events
+ while gtk.events_pending():
+ gtk.main_iteration()
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONDOWN:
return