Documentation (new engine) - Rexxt/PyCGE GitHub Wiki
Functions
ConsoleGame.init(self, name="Untitled", w=80, h=25)
The game constructor accepts a name parameter, a w (width) and a h (height) parameter.
Usage example:
class GameClass(ConsoleGame):
# game here...
gameinstance = GameClass(name="My Game", w=100, h=30)
ConsoleGame.clear(self)
Clears the screen.
Usage example:
class GameClass(ConsoleGame):
def draw(self):
self.clear()
ConsoleGame.current_ms_time(self)
Returns the current time in milliseconds.
Usage example:
class GameClass(ConsoleGame):
def draw(self):
print(self.current_ms_time())
ConsoleGame.gettime(self)
Returns the game time in milliseconds.
Usage example:
class GameClass(ConsoleGame):
def draw(self):
print(self.gettime())
ConsoleGame.quit(self)
Ends the game and calls the event_quit(self)
function.
Usage example:
class GameClass(ConsoleGame):
def update(self, dt):
self.quit()
ConsoleGame.mainloop(self)
Starts the game.
Usage example:
class GameClass(ConsoleGame):
# game here...
gameinstance = GameClass()
gameinstance.mainloop()
Events
ConsoleGame.load(self):
Called on game load.
ConsoleGame.update(self, dt):
Called when the game updates.
ConsoleGame.draw(self):
Called just after the game updates.
ConsoleGame.event_quit(self):
Called on game quit.