For everyone who wants to know how to print text in the console on a defined position:
Code:
class asciiMapView:
# A simple map view in ASCII art style.
def __init__( self, world ):
self.cmdPrefix = '\033['
self.cmdSeperator = ';'
self.cmdPostfixPosition = 'H'
self.cmdPostfixColor = 'm'
self.world = world
def printWidget( self, posX, posY ):
cmdPosition = '%s%i%s%i%s' % ( self.cmdPrefix, posX, self.cmdSeperator, posY, self.cmdPostfixPosition )
print '%sThis is a test for the text position.' % cmdPosition
mapView = asciiMapView( 'world' )
mapView.printWidget( 10, 10 )
The magic does the simple escape sequence: This technique should also work in other language with proper stdout support.
EDIT:
Here is a first impression for the ASCII interface I am currently working on. Sorry but at the moment it is very minimalistic. If someone is aware of graphics programming (in Python if possible) I would be more as happy about help.
Bookmarks