Package motherhamster :: Module displayGL :: Class Display

Class Display



pygame window with openGL

Instance Methods
 
__init__(self)
 
get_num_packs(self)
 
get_pack_image(self, index)
 
get_pack_info(self, index)
 
pack_image(self, image)
Packs an image into an OpenGL texture
 
rect(self, corner0, corner1, color=(1.0, 1.0, 1.0, 1.0))
Draws a rectangle from corner0 to corner1 in the specified color.
 
line(self, point_list, color=(1.0, 1.0, 1.0, 1.0))
Display a line in the specified color.
 
polygon(self, position, polygon, angle=0, scale=1.0, color=(1.0, 1.0, 1.0, 1.0))
Draw the outline of a polygon as lines
 
circle(self, position, radius, color=(1.0, 1.0, 1.0, 1.0), filled=False)
Draw a circle.
 
render_patch(self, patch, image=None, color=(1.0, 1.0, 1.0, 1.0), subdiv=20)
renders a bezier patch, which may or may not have an image mapped.
 
render_motion(self, image, position_list, angle=0.0, scale=1.0, color=(1.0, 1.0, 1.0, 1.0), blur_start=0.4, blur_end=0.02, max_steps=15)
renders a motion trail, intended to be called after a normal render call position_list must be a list of vec2d's scale and angle may be lists as well blur_start and blur_end define what alpha levels to use
 
render(self, image, position, angle=0.0, scale=1.0, color=(1.0, 1.0, 1.0, 1.0), src_rect=None)
Draw an image to the specified position with optional scale and angle and cropping source rectangle
 
set_mode(self, width, height, fullscreen=False)
Change the screen resolution and fullscreen/windowed state
 
erase(self, color=(0, 0, 0))
 
flip(self)
Method Details

rect(self, corner0, corner1, color=(1.0, 1.0, 1.0, 1.0))

 
Draws a rectangle from corner0 to corner1 in the specified color. The corners are supplied as vectors

line(self, point_list, color=(1.0, 1.0, 1.0, 1.0))

 
Display a line in the specified color. The line is supplied as a list of vectors representing points on the line.

circle(self, position, radius, color=(1.0, 1.0, 1.0, 1.0), filled=False)

 
Draw a circle. Specify center position as a vector, radius in pixels. Can optionally be drawn solid

render_patch(self, patch, image=None, color=(1.0, 1.0, 1.0, 1.0), subdiv=20)

 
renders a bezier patch, which may or may not have an image mapped. patch should be a grid of control points for a 2d bezier path. patch can be of any x & y dimension, but should be a list of equal-length rows the patch is rendered with linear approximations, sudiv is the number of points