Commits

Anonymous committed 000b709

time.get_ticks() returns 0 before init()

  • Participants
  • Parent commits ca48dc7

Comments (0)

Files changed (14)

 
 
 INTRO
-
+-----
 Pygame is a cross-platfrom library designed to make it easy to write
 multimedia software, such as games, in Python.
 
-Pygame depends on SDL >= 1.1.7 and Python >= 2.0. It also is optionally
+Pygame depends on SDL >= 1.1.7 and Python >= 1.5.2. It also is optionally
 dependent on SDL_ttf, SDL_image, SDL_mixer, and Numeric.
 
 
 
 
 INSTALLATION
+------------
+Full installation instructions are found in docs/fullinstall.txt
+There are many binaries available for different platforms. Check
+the pygame website for downloads. Also, use appropriate installers
+for platforms like Debian and FreeBSD for automatic installation.
 
-Full installation instructions are found in docs/fullinstall.txt
-
-Compilation/Installation is handled by the python distutils. Just
-run "python setup.py" to perform the installation. This will make a
-worthwhile attempt at configuring the compiler variables and getting
+Compilation/Installation from source is handled by the python distutils.
+Just run "python setup.py" to perform the installation. This will make
+a worthwhile attempt at configuring the compiler variables and getting
 everything installed.
 
 Distutils has a lot of installation options. To get started with them
 
 
 HELP
-
+----
 The best way to learn how to use pygame is to check out the example files
 the "examples" subdirectory. All modules, functions, and objects in the
 pygame package contain helpful docstrings. Full HTML reference and 
 
 
 TODO
-
+----
 At some point it would be nice to add support for more external
 python libraries, here are some ideas...
  - more collision detection stuff: pixel2pixel, point2poly, etc
 
 
 CREDITS
-
+-------
 Thanks to everyone who made this possible, including:
 
 - David Clark for RPMs and all around help
 - Maxim Sobolev for FreeBSD port maintenance
 - Bob Ippolito for the MacOS porting
 - Jan Ekhol, Ray Kelm, and Peter Nicolai for initial reviews
-- Our list of valiant bugfixers:
+- Our list of valiant bug fixers:
 	Niki Spahiev, Gordon Tyler,
 	Dave Wallace, and John Popplewell
 - And our dutiful bug hunters:
 	Angus, Guillaume Proux, Frank Raiser,
-	Austin Henry, and Kaweh Kazemi
+	Austin Henry, Kaweh Kazemi, Arturo Aldama
 
 Cheers to TheCorruptor for his incredible work on the pygame logo.
 
 
 
 LIBRARIES
-
+---------
 Pygame is obviously strongly dependent on SDL and Python. It also
 links to and embeds several other smaller libraries. The font module
 relies on SDL_tff, which is dependent on freetype. The mixer (and
 
 
 LINKS
-
+-----
 Pygame Website : http://www.pygame.org
 Python Website : http://www.python.org
 SDL Website    : http://www.libsdl.org
 
 
 LICENSE
-
+-------
 This library is distributed under GNU LGPL version 2.1, which can be
 found in the file  "doc/LGPL".	I reserve the right to place future
 versions of this library under a different license.
 # BREAK = change breaks existing code
 # BUG	= fixed a bug that was (or could have been) crashing
 
+November 2, 2001
+	pygame.time.get_ticks() returns 0 before pygame.init()
+
 October 22, 2001
 	small fix for filled ellipses/circles
 
 <a href=ref/pygame_display.html#toggle_fullscreen>pygame.display.toggle_fullscreen</a> - switch the display fullscreen mode<br>
 <a href=ref/pygame_display.html#update>pygame.display.update</a> - update an area of the display<br>
 <a href=ref/pygame_draw.html#circle>pygame.draw.circle</a> - draw a circle on a surface<br>
-<a href=ref/pygame_draw.html#circle>pygame.draw.circle</a> - draw a circle on a surface<br>
-<a href=ref/pygame_draw.html#ellipse>pygame.draw.ellipse</a> - draw an ellipse on a surface<br>
 <a href=ref/pygame_draw.html#ellipse>pygame.draw.ellipse</a> - draw an ellipse on a surface<br>
 <a href=ref/pygame_draw.html#line>pygame.draw.line</a> - draw a line on a surface<br>
-<a href=ref/pygame_draw.html#line>pygame.draw.line</a> - draw a line on a surface<br>
-<a href=ref/pygame_draw.html#lines>pygame.draw.lines</a> - draw multiple connected lines on a surface<br>
 <a href=ref/pygame_draw.html#lines>pygame.draw.lines</a> - draw multiple connected lines on a surface<br>
 <a href=ref/pygame_draw.html#polygon>pygame.draw.polygon</a> - draws a polygon on a surface<br>
-<a href=ref/pygame_draw.html#polygon>pygame.draw.polygon</a> - draws a polygon on a surface<br>
 <a href=ref/pygame_draw.html#rect>pygame.draw.rect</a> - draws a polygon on a surface<br>
-<a href=ref/pygame_draw.html#rect>pygame.draw.rect</a> - draws a rectangle on a surface<br>
 <a href=ref/pygame_event.html#Event>pygame.event.Event</a> - create new event object<br>
 <a href=ref/pygame_event.html#event_name>pygame.event.event_name</a> - name for event type<br>
 <a href=ref/pygame_event.html#get>pygame.event.get</a> - get all of an event type from the queue<br>
 <a href=ref/pygame_surfarray.html#pixels3d>pygame.surfarray.pixels3d</a> - get a 3d reference array to a surface<br>
 <a href=ref/pygame_surfarray.html#pixels_alpha>pygame.surfarray.pixels_alpha</a> - get a reference array to a surface alpha data<br>
 <a href=ref/pygame_time.html#delay>pygame.time.delay</a> - delay for a number of milliseconds<br>
-<a href=ref/pygame_time.html#get_ticks>pygame.time.get_ticks</a> - milliseconds since startup<br>
+<a href=ref/pygame_time.html#get_ticks>pygame.time.get_ticks</a> - milliseconds since initialization<br>
 <a href=ref/pygame_time.html#set_timer>pygame.time.set_timer</a> - control timer events<br>
 <a href=ref/pygame_transform.html#flip>pygame.transform.flip</a> - flips a surface on either axis<br>
 <a href=ref/pygame_transform.html#rotate>pygame.transform.rotate</a> - rotate a Surface<br>
 CD.quit() -> None
 </tt></font><ul>
 After you are completely finished with a cdrom device, you
-can use this <a href=pygame_cdrom.html#quit>quit()</a> function to free access to the drive.
+can use this <a href=pygame.html#quit>quit()</a> function to free access to the drive.
 This will be cleaned up automatically when the cdrom module is.
 uninitialized. It is safe to call this function on an uninitialized CD.
 </ul><br>&nbsp;<br>

docs/ref/Joystick.html

 Joystick.quit() -> None
 </tt></font><ul>
 After you are completely finished with a joystick device, you
-can use this <a href=pygame_cdrom.html#quit>quit()</a> function to free access to the drive.
+can use this <a href=pygame.html#quit>quit()</a> function to free access to the drive.
 This will be cleaned up automatically when the joystick module is.
 uninitialized. It is safe to call this function on an uninitialized Joystick.
 </ul><br>&nbsp;<br>

docs/ref/pygame.html

 <h2 align=center>pygame</h2>
 Contains the core routines that are used by the rest of the
 pygame modules. It's routines are merged directly into the pygame
-namespace. This mainly includes the auto-initialization <a href=pygame_cdrom.html#init>init()</a> and
-<a href=pygame_cdrom.html#quit>quit()</a> routines.
+namespace. This mainly includes the auto-initialization <a href=#init>init()</a> and
+<a href=#quit>quit()</a> routines.
 <br>&nbsp;<br>
 There is a small module named 'locals' that also gets merged into
 this namespace. This contains all the constants needed by pygame.
 that failed to initialize.
 <br>&nbsp;<br>
 You can always initialize the modules you want by hand. The
-modules that need it have an <a href=pygame_cdrom.html#init>init()</a> and <a href=pygame_cdrom.html#quit>quit()</a> routine built in,
+modules that need it have an <u>init()</u> and <a href=#quit>quit()</a> routine built in,
 which you can call directly. They also have a <a href=pygame_cdrom.html#get_init>get_init()</a> routine
 which you can use to doublecheck the initialization. Note that
-the manual <a href=pygame_cdrom.html#init>init()</a> routines will raise an exception on error. Be
+the manual <u>init()</u> routines will raise an exception on error. Be
 aware that most platforms require the display module to be
-initialized before others. This <a href=pygame_cdrom.html#init>init()</a> will handle that for you,
+initialized before others. This <u>init()</u> will handle that for you,
 but if you initialize by hand, be aware of this constraint.
 <br>&nbsp;<br>
-As with the manual <a href=pygame_cdrom.html#init>init()</a> routines. It is safe to call this
+As with the manual <u>init()</u> routines. It is safe to call this
 init() as often as you like. If you have imported pygame modules
 since the.
 </ul><br>&nbsp;<br>
 pygame.quit() -> none
 </tt></font><ul>
 Uninitialize all pygame modules that have been initialized. Even
-if you initialized the module by hand, this <a href=pygame_cdrom.html#quit>quit()</a> will
+if you initialized the module by hand, this <u>quit()</u> will
 uninitialize it for you.
 <br>&nbsp;<br>
 All the pygame modules are uninitialized automatically when your

docs/ref/pygame_cdrom.html

 This function needs a cdrom device number to work on. All
 cdrom drives on the system are enumerated for use as a CD
 object. To access most of the CD functions, you'll need to
-<a href=#init>init()</a> the CD. (note that the cdrom module will already
+<a href=pygame.html#init>init()</a> the CD. (note that the cdrom module will already
 be initialized). When multiple CD objects are created for the
 same CDROM device, the state and values for those CD objects
 will be shared.

docs/ref/pygame_draw.html

 draw a circle on a surface</td></tr>
 
 
-<tr><td><a href=#circle>circle</a></td><td> -
-draw a circle on a surface</td></tr>
-
-
-<tr><td><a href=#ellipse>ellipse</a></td><td> -
-draw an ellipse on a surface</td></tr>
-
-
 <tr><td><a href=#ellipse>ellipse</a></td><td> -
 draw an ellipse on a surface</td></tr>
 
 draw a line on a surface</td></tr>
 
 
-<tr><td><a href=#line>line</a></td><td> -
-draw a line on a surface</td></tr>
-
-
-<tr><td><a href=#lines>lines</a></td><td> -
-draw multiple connected lines on a surface</td></tr>
-
-
 <tr><td><a href=#lines>lines</a></td><td> -
 draw multiple connected lines on a surface</td></tr>
 
 draws a polygon on a surface</td></tr>
 
 
-<tr><td><a href=#polygon>polygon</a></td><td> -
-draws a polygon on a surface</td></tr>
-
-
-<tr><td><a href=#rect>rect</a></td><td> -
-draws a rectangle on a surface</td></tr>
-
-
 <tr><td><a href=#rect>rect</a></td><td> -
 draws a polygon on a surface</td></tr>
 
 Draws a circular shape on the Surface. The given position
 is the center of the circle, and radius is the size. The width
 argument is the thickness to draw the outer edge. If width is
-zero then the ellipse will be filled.
-<br>&nbsp;<br>
-The color argument can be either a RGB sequence or mapped color integer.
-<br>&nbsp;<br>
-This function will temporarily lock the surface.
-</ul><br>&nbsp;<br>
-
-<a name=circle><font size=+2><b>circle
-</b></font><br><font size=+1><tt>
-pygame.draw.circle(Surface, color, pos, radius, width) -> Rect
-</tt></font><ul>
-Draws a circular shape on the Surface. The given position
-is the center of the circle, and radius is the size. The width
-argument is the thickness to draw the outer edge. If width is
 zero then the circle will be filled.
 <br>&nbsp;<br>
 The color argument can be either a RGB sequence or mapped color integer.
 This function will temporarily lock the surface.
 </ul><br>&nbsp;<br>
 
-<a name=ellipse><font size=+2><b>ellipse
-</b></font><br><font size=+1><tt>
-pygame.draw.ellipse(Surface, color, Rect, width) -> Rect
-</tt></font><ul>
-Draws an elliptical shape on the Surface. The given rectangle
-is the area that the circle will fill. The width argument is
-the thickness to draw the outer edge. If width is zero then
-the ellipse will be filled.
-<br>&nbsp;<br>
-The color argument can be either a RGB sequence or mapped color integer.
-<br>&nbsp;<br>
-This function will temporarily lock the surface.
-</ul><br>&nbsp;<br>
-
-<a name=line><font size=+2><b>line
-</b></font><br><font size=+1><tt>
-pygame.draw.line(Surface, color, startpos, endpos, width=1) -> Rect
-</tt></font><ul>
-Draws a line on a surface. This will respect the clipping
-rectangle. A bounding box of the effected area is returned
-as a rectangle.
-<br>&nbsp;<br>
-The color argument can be either a RGB sequence or mapped color integer.
-<br>&nbsp;<br>
-This function will temporarily lock the surface.
-</ul><br>&nbsp;<br>
-
 <a name=line><font size=+2><b>line
 </b></font><br><font size=+1><tt>
 pygame.draw.line(Surface, color, startpos, endpos, width=1) -> Rect
 This function will temporarily lock the surface.
 </ul><br>&nbsp;<br>
 
-<a name=lines><font size=+2><b>lines
-</b></font><br><font size=+1><tt>
-pygame.draw.lines(Surface, color, closed, point_array, width=1) -> Rect
-</tt></font><ul>
-Draws a sequence on a surface. You must pass at least two points
-in the sequence of points. The closed argument is a simple boolean
-and if true, a line will be draw between the first and last points.
-Note that specifying a linewidth wider than 1 does not fill in the
-gaps between the lines. Therefore wide lines and sharp corners won't
-be joined seamlessly.
-<br>&nbsp;<br>
-This will respect the clipping rectangle. A bounding box of the
-effected area is returned as a rectangle.
-<br>&nbsp;<br>
-The color argument can be either a RGB sequence or mapped color integer.
-<br>&nbsp;<br>
-This function will temporarily lock the surface.
-</ul><br>&nbsp;<br>
-
-<a name=polygon><font size=+2><b>polygon
-</b></font><br><font size=+1><tt>
-pygame.draw.polygon(Surface, color, pointslist, width) -> Rect
-</tt></font><ul>
-Draws a polygonal shape on the Surface. The given pointlist
-is the vertices of the polygon. The width argument is
-the thickness to draw the outer edge. If width is zero then
-the polygonal shape will be filled.
-<br>&nbsp;<br>
-The color argument can be either a RGB sequence or mapped color integer.
-<br>&nbsp;<br>
-This function will temporarily lock the surface.
-</ul><br>&nbsp;<br>
-
 <a name=polygon><font size=+2><b>polygon
 </b></font><br><font size=+1><tt>
 pygame.draw.polygon(Surface, color, pointslist, width) -> Rect
 can be hardware accelerated when the moons are in alignement.
 </ul><br>&nbsp;<br>
 
-<a name=rect><font size=+2><b>rect
-</b></font><br><font size=+1><tt>
-pygame.draw.rect(Surface, color, Rect, width) -> Rect
-</tt></font><ul>
-Draws a rectangular shape on the Surface. The given Rect
-is the area of the rectangle. The width argument is
-the thickness to draw the outer edge. If width is zero then
-the rectangle will be filled.
-<br>&nbsp;<br>
-The color argument can be either a RGB sequence or mapped color integer.
-<br>&nbsp;<br>
-This function will temporarily lock the surface.
-<br>&nbsp;<br>
-Keep in mind the <a href=Surface.html#fill>Surface.fill()</a> method works just as well
-for drawing filled rectangles. In fact the <a href=Surface.html#fill>Surface.fill()</a>
-can be hardware accelerated when the moons are in alignement.
-</ul><br>&nbsp;<br>
-
 
 <hr>
 </body></html>

docs/ref/pygame_image.html

 <br>
 <h2 align=center>pygame.image</h2>
 This module contains functions to transfer images in and out
-of Surfaces. At the minimum the included <a href=pygame_mixer_music.html#load>load()</a> function will
+of Surfaces. At the minimum the included <a href=#load>load()</a> function will
 support BMP files. If SDL_image is properly installed when
 pygame is installed, it will support all the formats included
 with SDL_image. You can call the <a href=#get_extended>get_extended()</a> function to test

docs/ref/pygame_joystick.html

 This function needs a joystick device number to work on. All
 joystick devices on the system are enumerated for use as a Joystick
 object. To access most of the Joystick functions, you'll need to
-<a href=pygame_cdrom.html#init>init()</a> the Joystick. (note that the joystick module will already
+<a href=pygame.html#init>init()</a> the Joystick. (note that the joystick module will already
 be initialized). When multiple Joysticks objects are created for the
 same joystick device, the state and values for those Joystick objects
 will be shared.

docs/ref/pygame_mixer.html

 rates and datatypes for the sound playback. If you do need
 specific control over the playback rate, but don't want to bother
 with hand-initializing the modules, there is a function named
-<a href=#pre_init>pygame.mixer.pre_init()</a> which takes the same arguments as <a href=pygame_cdrom.html#init>init()</a>,
+<a href=#pre_init>pygame.mixer.pre_init()</a> which takes the same arguments as <a href=pygame.html#init>init()</a>,
 but only sets the new default values. You can call this before
 <a href=pygame.html#init>pygame.init()</a> and not have to worry about the pygame module
 initialization order.
 initialized at all). You can easily use the <a href=pygame.html#init>pygame.init()</a>
 function to cleanly initialize everything, but first use the
 <a href=#pre_init>pygame.mixer.pre_init()</a> function to change the default values for
-this <a href=pygame_cdrom.html#init>init()</a>.
+this <a href=pygame.html#init>init()</a>.
 </ul><br>&nbsp;<br>
 
 <a name=pause><font size=+2><b>pause

docs/ref/pygame_mixer_music.html

 <br>&nbsp;<br>
 The music module has many of the same types of functions as the
 Sound objects. The main difference is only one music object can
-be loaded at a time, with the <a href=#load>load()</a> function. Music
+be loaded at a time, with the <a href=pygame_image.html#load>load()</a> function. Music
 must be stored in an individual file on the system, it cannot be
 loaded from special file-like objects through python.
 

docs/ref/pygame_time.html

 
 
 <tr><td><a href=#get_ticks>get_ticks</a></td><td> -
-milliseconds since startup</td></tr>
+milliseconds since initialization</td></tr>
 
 
 <tr><td><a href=#set_timer>set_timer</a></td><td> -
 pygame.time.get_ticks() -> int
 </tt></font><ul>
 This is the time in milliseconds since the pygame.time was
-imported.
+imported. Always returns 0 before <a href=pygame.html#init>pygame.init()</a> is called.
 </ul><br>&nbsp;<br>
 
 <a name=set_timer><font size=+2><b>set_timer
 
     /*DOC*/ static char doc_get_ticks[] =
     /*DOC*/    "pygame.time.get_ticks() -> int\n"
-    /*DOC*/    "milliseconds since startup\n"
+    /*DOC*/    "milliseconds since initialization\n"
     /*DOC*/    "\n"
     /*DOC*/    "This is the time in milliseconds since the pygame.time was\n"
-    /*DOC*/    "imported.\n"
+    /*DOC*/    "imported. Always returns 0 before pygame.init() is called.\n"
     /*DOC*/ ;
 
 static PyObject* get_ticks(PyObject* self, PyObject* arg)
 	if(!PyArg_ParseTuple(arg, ""))
 		return NULL;
 
+	if(!SDL_WasInit(SDL_INIT_TIMER))
+		return PyInt_FromLong(0);
 	return PyInt_FromLong(SDL_GetTicks());
 }