~ubuntu-branches/ubuntu/gutsy/pygame/gutsy

« back to all changes in this revision

Viewing changes to docs/ref/pygame.html

  • Committer: Bazaar Package Importer
  • Author(s): Ed Boraas
  • Date: 2002-02-20 06:39:24 UTC
  • Revision ID: james.westby@ubuntu.com-20020220063924-amlzj7tqkeods4eq
Tags: upstream-1.4
ImportĀ upstreamĀ versionĀ 1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<title>pygame</title>
 
3
<body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111>
 
4
 
 
5
 
 
6
<table cellspacing=3 width=100%><tr><td bgcolor=#00000>
 
7
<table width=100%><tr><td bgcolor=c2fc20 align=center>
 
8
    <a href=http://www.pygame.org>
 
9
    <img src=../pygame_tiny.gif border=0 width=200 height=60></a><br>
 
10
    <b>pygame&nbsp;&nbsp;&nbsp;documentation</b>
 
11
</td><td bgcolor=6aee28 align=center valign=top width=100%>
 
12
 
 
13
        ||&nbsp;
 
14
        <a href=http://www.pygame.org>Home</a> &nbsp;||&nbsp;
 
15
        <a href=../index.html>Help Contents</a> &nbsp;||
 
16
        <br>&nbsp;<br>
 
17
 
 
18
|| <a href=pygame.html>pygame</a> || 
 
19
<a href=pygame_cdrom.html>cdrom</a> || 
 
20
<a href=pygame_constants.html>constants</a> || 
 
21
<a href=pygame_display.html>display</a> || 
 
22
<a href=pygame_draw.html>draw</a> || 
 
23
<a href=pygame_event.html>event</a> ||<br>
 
24
|| <a href=pygame_font.html>font</a> || 
 
25
<a href=pygame_image.html>image</a> || 
 
26
<a href=pygame_joystick.html>joystick</a> || 
 
27
<a href=pygame_key.html>key</a> || 
 
28
<a href=pygame_mixer.html>mixer</a> || 
 
29
<a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 
30
|| <a href=pygame_mouse.html>mouse</a> || 
 
31
<a href=pygame_movie.html>movie</a> || 
 
32
<a href=pygame_surfarray.html>surfarray</a> || 
 
33
<a href=pygame_time.html>time</a> || 
 
34
<a href=pygame_transform.html>transform</a> ||<br>
 
35
&nbsp;<br>|| <a href=CD.html>CD</a> || 
 
36
<a href=Channel.html>Channel</a> || 
 
37
<a href=Clock.html>Clock</a> || 
 
38
<a href=Font.html>Font</a> || 
 
39
<a href=Joystick.html>Joystick</a> || 
 
40
<a href=Movie.html>Movie</a> ||<br>
 
41
|| <a href=Rect.html>Rect</a> || 
 
42
<a href=Sound.html>Sound</a> || 
 
43
<a href=Surface.html>Surface</a> ||<br>
 
44
&nbsp;<br>|| <a href=pygame_cursors.html>cursors</a> || 
 
45
<a href=pygame_sprite.html>sprite</a> || 
 
46
<a href=pygame_version.html>version</a> ||<br>
 
47
 
 
48
 
 
49
</td></tr></table></td></tr></table>
 
50
<br>
 
51
<h2 align=center>pygame</h2>
 
52
Contains the core routines that are used by the rest of the
 
53
pygame modules. It's routines are merged directly into the pygame
 
54
namespace. This mainly includes the auto-initialization <a href=#init>init()</a> and
 
55
<a href=#quit>quit()</a> routines.
 
56
<br>&nbsp;<br>
 
57
There is a small module named 'locals' that also gets merged into
 
58
this namespace. This contains all the constants needed by pygame.
 
59
Object constructors also get placed into this namespace, you can
 
60
call functions like <a href=#Rect>Rect()</a> and <a href=#Surface>Surface()</a> to create objects of
 
61
that type. As a convenience, you can import the members of
 
62
pygame.locals directly into your module's namespace with 'from
 
63
pygame.locals import *'. Most of the pygame examples do this if
 
64
you'd like to take a look.
 
65
 
 
66
<hr>
 
67
 
 
68
<table>
 
69
<tr><td><a href=#Rect>Rect</a></td><td> -
 
70
create a new rectangle</td></tr>
 
71
 
 
72
 
 
73
<tr><td><a href=#Surface>Surface</a></td><td> -
 
74
create a new Surface</td></tr>
 
75
 
 
76
 
 
77
<tr><td><a href=#get_error>get_error</a></td><td> -
 
78
get current error message</td></tr>
 
79
 
 
80
 
 
81
<tr><td><a href=#init>init</a></td><td> -
 
82
autoinitialize all imported pygame modules</td></tr>
 
83
 
 
84
 
 
85
<tr><td><a href=#quit>quit</a></td><td> -
 
86
uninitialize all pygame modules</td></tr>
 
87
 
 
88
 
 
89
<tr><td><a href=#register_quit>register_quit</a></td><td> -
 
90
routine to call when pygame quits</td></tr>
 
91
 
 
92
 
 
93
</table>
 
94
 
 
95
<hr>
 
96
 
 
97
<a name=Rect><font size=+2><b>Rect
 
98
</b></font><br><font size=+1><tt>
 
99
pygame.Rect(rectstyle) -> Rect
 
100
</tt></font><ul>
 
101
Creates a new rectangle object. The given
 
102
rectstyle represents one of the various ways of
 
103
representing rectangle data. This is usually a
 
104
sequence of x and y position for the topleft
 
105
corner, and the width and height.
 
106
<br>&nbsp;<br>
 
107
For some of the Rect methods there are two version.
 
108
For example, there is <a href=Rect.html#move>move()</a> and <a href=Rect.html#move_ip>move_ip()</a>. The methods
 
109
witht the '_ip' suffix on the name are the 'in-place'
 
110
version of those functions. They effect the actual
 
111
source object, instead of returning a new Rect object.
 
112
</ul><br>&nbsp;<br>
 
113
 
 
114
<a name=Surface><font size=+2><b>Surface
 
115
</b></font><br><font size=+1><tt>
 
116
pygame.Surface(size, [flags, [Surface|depth, [masks]]]) -> Surface
 
117
</tt></font><ul>
 
118
Creates a new surface object. Size is a 2-int-sequence containing
 
119
width and height. Depth is the number of bits used per pixel. If
 
120
omitted, depth will use the current display depth. Masks is a
 
121
four item sequence containing the bitmask for r,g,b, and a. If
 
122
omitted, masks will default to the usual values for the given
 
123
bitdepth. Flags is a mix of the following flags: SWSURFACE,
 
124
HWSURFACE, ASYNCBLIT, or SRCALPHA. (flags = 0 is the
 
125
same as SWSURFACE). Depth and masks can be substituted for
 
126
another surface object which will create the new surface with the
 
127
same format as the given one. When using default masks, alpha
 
128
will always be ignored unless you pass SRCALPHA as a flag.
 
129
For a plain software surface, 0 can be used for the flag. 
 
130
A plain hardware surface can just use 1 for the flag.
 
131
</ul><br>&nbsp;<br>
 
132
 
 
133
<a name=get_error><font size=+2><b>get_error
 
134
</b></font><br><font size=+1><tt>
 
135
pygame.get_error() -> errorstring
 
136
</tt></font><ul>
 
137
SDL maintains an internal current error message. This message is
 
138
usually given to you when an SDL related exception occurs, but
 
139
sometimes you may want to call this directly yourself.
 
140
</ul><br>&nbsp;<br>
 
141
 
 
142
<a name=init><font size=+2><b>init
 
143
</b></font><br><font size=+1><tt>
 
144
pygame.init() -> passed, failed
 
145
</tt></font><ul>
 
146
Initialize all imported pygame modules. Including pygame modules
 
147
that are not part of the base modules (like font and image).
 
148
<br>&nbsp;<br>
 
149
It does not raise exceptions, but instead silently counts which
 
150
modules have failed to init. The return argument contains a count
 
151
of the number of modules initialized, and the number of modules
 
152
that failed to initialize.
 
153
<br>&nbsp;<br>
 
154
You can always initialize the modules you want by hand. The
 
155
modules that need it have an <u>init()</u> and <a href=#quit>quit()</a> routine built in,
 
156
which you can call directly. They also have a <a href=pygame_cdrom.html#get_init>get_init()</a> routine
 
157
which you can use to doublecheck the initialization. Note that
 
158
the manual <u>init()</u> routines will raise an exception on error. Be
 
159
aware that most platforms require the display module to be
 
160
initialized before others. This <u>init()</u> will handle that for you,
 
161
but if you initialize by hand, be aware of this constraint.
 
162
<br>&nbsp;<br>
 
163
As with the manual <u>init()</u> routines. It is safe to call this
 
164
init() as often as you like. If you have imported pygame modules
 
165
since the.
 
166
</ul><br>&nbsp;<br>
 
167
 
 
168
<a name=quit><font size=+2><b>quit
 
169
</b></font><br><font size=+1><tt>
 
170
pygame.quit() -> none
 
171
</tt></font><ul>
 
172
Uninitialize all pygame modules that have been initialized. Even
 
173
if you initialized the module by hand, this <u>quit()</u> will
 
174
uninitialize it for you.
 
175
<br>&nbsp;<br>
 
176
All the pygame modules are uninitialized automatically when your
 
177
program exits, so you will usually not need this routine. If you
 
178
program plans to keep running after it is done with pygame, then
 
179
would be a good time to make this call.
 
180
</ul><br>&nbsp;<br>
 
181
 
 
182
<a name=register_quit><font size=+2><b>register_quit
 
183
</b></font><br><font size=+1><tt>
 
184
pygame.register_quit(callback) -> None
 
185
</tt></font><ul>
 
186
The given callback routine will be called when. pygame is
 
187
quitting. Quit callbacks are served on a 'last in, first out'
 
188
basis. Also be aware that your callback may be called more than
 
189
once.
 
190
</ul><br>&nbsp;<br>
 
191
 
 
192
 
 
193
<hr>
 
194
</body></html>