tdl
index
c:\users\kyle\dropbox\python\python-tdl\tdl\__init__.py

 
Package Contents
       
event
tcod

 
Classes
       
exceptions.Exception(exceptions.BaseException)
TDLError
_MetaConsole(__builtin__.object)
Console
Window

 
class Console(_MetaConsole)
    The Console is the main class of the tdl library.
 
The console created by the init function is the root console and is the
consle that is rendered to the screen with flush.
 
Any console made from Console is an off-screen console that can be drawn
on and then blited to the root console.
 
 
Method resolution order:
Console
_MetaConsole
__builtin__.object

Methods defined here:
__del__(self)
If the main console is garbage collected then the window will be closed as well
__init__(self, width, height)
__repr__(self)
clear(self, fgcolor=(255, 255, 255), bgcolor=(0, 0, 0))
Clears the entire console.
getChar(self, x, y)
Return the character and colors of a cell as (ch, fg, bg)
 
The charecter is returned as a number.
each color is returned as a tuple

Methods inherited from _MetaConsole:
blit(self, source, x=0, y=0, width=None, height=None, srcx=0, srcy=0)
Blit another console or Window onto the current console.
 
By default it blits the entire source to the topleft corner.
 
If nothing is blited then TDLError is raised
drawChar(self, x, y, char=None, fgcolor=(255, 255, 255), bgcolor=(0, 0, 0))
Draws a single character.
 
char should be an integer, single character string, or None
you can set the char parameter as None if you only want to change
the colors of the tile.
 
For fgcolor and bgcolor you use a 3 item list or None.  None will
keep the current color at this position unchanged.
 
 
Having the x or y values outside of the console will raise an
AssertionError.
drawFrame(self, x, y, width, height, string=None, fgcolor=(255, 255, 255), bgcolor=(0, 0, 0))
Similar to drawRect but only draws the outline of the rectangle
drawRect(self, x, y, width, height, string=None, fgcolor=(255, 255, 255), bgcolor=(0, 0, 0))
Draws a rectangle starting from x and y and extending to width and
height.  If width or height are None then it will extend to the edge
of the console.  The rest are the same as drawChar.
drawStr(self, x, y, string, fgcolor=(255, 255, 255), bgcolor=(0, 0, 0))
Draws a string starting at x and y.  Optinally colored.
 
A string that goes past the right side will wrap around.  A string
wraping to below the console will raise a TDLError but will still be
written out.  This means you can safely ignore the errors with a
try... except block if you're fine with partily written strings.
 
\r and \n are drawn on the console as normal character tiles.  No
special encoding is done and any string will translate to the character
table as is.
 
fgcolor and bgcolor can be set to None to keep the colors unchanged.
getSize(self)
Return the size of the console as (width, height)
scroll(self, x, y)
Scroll the contents of the console in the direction of x,y.
 
Uncovered areas will be cleared.

Data descriptors inherited from _MetaConsole:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
height
width

 
class TDLError(exceptions.Exception)
    The catch all for most TDL specific errors.
 
 
Method resolution order:
TDLError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class Window(_MetaConsole)
    Window contains a small isolated part of a Console.
 
Drawing on the Window draws on the Console.
 
Making a Window and setting its width or height to None will extend it to
the edge of the console.
 
 
Method resolution order:
Window
_MetaConsole
__builtin__.object

Methods defined here:
__init__(self, console, x, y, width, height)
__repr__(self)
clear(self, fgcolor=(255, 255, 255), bgcolor=(0, 0, 0))
Clears the entire Window.
getChar(self, x, y)
Return the character and colors of a cell as (ch, fg, bg)

Data descriptors defined here:
console
parent
x
y

Methods inherited from _MetaConsole:
blit(self, source, x=0, y=0, width=None, height=None, srcx=0, srcy=0)
Blit another console or Window onto the current console.
 
By default it blits the entire source to the topleft corner.
 
If nothing is blited then TDLError is raised
drawChar(self, x, y, char=None, fgcolor=(255, 255, 255), bgcolor=(0, 0, 0))
Draws a single character.
 
char should be an integer, single character string, or None
you can set the char parameter as None if you only want to change
the colors of the tile.
 
For fgcolor and bgcolor you use a 3 item list or None.  None will
keep the current color at this position unchanged.
 
 
Having the x or y values outside of the console will raise an
AssertionError.
drawFrame(self, x, y, width, height, string=None, fgcolor=(255, 255, 255), bgcolor=(0, 0, 0))
Similar to drawRect but only draws the outline of the rectangle
drawRect(self, x, y, width, height, string=None, fgcolor=(255, 255, 255), bgcolor=(0, 0, 0))
Draws a rectangle starting from x and y and extending to width and
height.  If width or height are None then it will extend to the edge
of the console.  The rest are the same as drawChar.
drawStr(self, x, y, string, fgcolor=(255, 255, 255), bgcolor=(0, 0, 0))
Draws a string starting at x and y.  Optinally colored.
 
A string that goes past the right side will wrap around.  A string
wraping to below the console will raise a TDLError but will still be
written out.  This means you can safely ignore the errors with a
try... except block if you're fine with partily written strings.
 
\r and \n are drawn on the console as normal character tiles.  No
special encoding is done and any string will translate to the character
table as is.
 
fgcolor and bgcolor can be set to None to keep the colors unchanged.
getSize(self)
Return the size of the console as (width, height)
scroll(self, x, y)
Scroll the contents of the console in the direction of x,y.
 
Uncovered areas will be cleared.

Data descriptors inherited from _MetaConsole:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
height
width

 
Functions
       
flush()
Make all changes visible and update the screen.
forceResolution(width, height)
Change the fullscreen resoulution
getFPS()
Return the current frames per second of the running program.
getFullscreen()
Returns if the window is fullscreen
 
The user can't make the window fullscreen so you must use the
setFullscreen function
init(width, height, title='TDL', fullscreen=False, renderer='OPENGL')
Start the main console with the given width and height and return the
root console.
 
Remember to use tdl.flush() to make what's drawn visible on the console.
 
After the root console is garbage collected, the window made by this
function will close.
 
renderer can be one of 'GLSL', 'OPENGL', or 'SDL'
screenshot(file=None)
Capture the screen and place it in file.
 
file can be a file-like object or a filepath to save the screenshot
if file is none then file will be placed in the current folder with
the names: screenshot001.png, screenshot002.png, ...
setFPS(frameRate)
Set the frame rate.
 
You can set this to have no limit by using 0.
setFont(path, tileWidth, tileHeight, colomn=False, greyscale=False, altLayout=False)
Changes the font to be used for this session
This should be called before tdl.init
 
path - must be a string for where a bitmap file is found.
 
tileWidth, tileHeight - is the size of an individual tile.
 
colomn - defines if the characer order goes along the rows or colomns.  It
should be True if the codes are 0-15 in the first column.  And should be
False if the codes are 0-15 in the first row.
 
greyscale - creates an anti-aliased font from a greyscale bitmap.
Unnecessary when a font has an alpha channel for anti-aliasing.
 
altLayout - a alternative layout with space in the upper left corner.  The
colomn parameter is ignored if this is True, find examples of this layout
in the font/ directory included with the TDL source.
setFullscreen(fullscreen)
Sets the fullscreen state to the boolen value
setTitle(title)
Change the window title.

 
Data
        __all__ = ['tcod', 'TDLError', 'setTitle', 'Window', 'flush', 'Console', 'array', 'event', 'setFullscreen', 'getFullscreen', 'init', 'getFPS', 'screenshot', 'forceResolution', 'sys', 'setFPS', 'ctypes', 'weakref', 'setFont', 'os']