Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/MAFH2/TermBox.py
diff options
context:
space:
mode:
authorJustin Lewis <jtl1728@rit.edu>2010-02-14 06:47:49 (GMT)
committer Justin Lewis <jtl1728@rit.edu>2010-02-14 06:47:49 (GMT)
commit955763a03a97bf333fd6056a1bff8215de515a41 (patch)
treec596661ad03bc431decc54817f5631b0b02f453f /MAFH2/TermBox.py
parent0695a8569601df13d5bb1adc4252279576bb07ad (diff)
Simplified engine by adding new class to extend
Diffstat (limited to 'MAFH2/TermBox.py')
-rw-r--r--MAFH2/TermBox.py21
1 files changed, 5 insertions, 16 deletions
diff --git a/MAFH2/TermBox.py b/MAFH2/TermBox.py
index 7eb9471..c9d09f8 100644
--- a/MAFH2/TermBox.py
+++ b/MAFH2/TermBox.py
@@ -1,29 +1,18 @@
import pygame
+from GameEngine import GameEngineElement
+class TermBox(GameEngineElement):
+ def __init__(self, x,y,width,height,lines):
+ GameEngineElement.__init__(self, has_draw=True, has_event=False)
-class TermBox:
- def __init__(self, ge, x,y,width,height,lines):
- self.ge = ge
self.max_lines = lines
-
self.x = x
self.y = y
self.width = width
self.height = height
self.font = pygame.font.Font(None, 32)
-
self.__lines = []
- self.__inEngine = False
- self.add_to_engine()
- def add_to_engine(self):
- if not self.__inEngine:
- self.__inEngine = True
- self.ge.add_draw_callback( self.draw )
-
- def remove_from_engine(self):
- if self.__inEngine:
- self.__inEngine = False
- self.ge.remove_draw_callback( self.draw )
+ self.add_to_engine()
def add_line(self, line):
self.__lines.append( line )