1. pygame
  2. pygame
  3. pygame


pygame  committed 9cbfcba

cursor and movie updates

  • Participants
  • Parent commits 8ff8a2a
  • Branches default

Comments (0)

Files changed (7)


View file
  • Ignore whitespace
 # BREAK = change breaks existing code
 # BUG	= fixed a bug that was (or could have been) crashing
+September 2, 2002
+	add Movie.render_frame, thanks James Mazer
+	cursors.load_xbm skips comments, thanks Herve
 August 20, 2002
 	fix rectstyle arguments

File docs/index.html

View file
  • Ignore whitespace
 <a href=ref/Movie.html#has_video>Movie.has_video</a> - query if movie stream has video<br>
 <a href=ref/Movie.html#pause>Movie.pause</a> - pause/resume movie playback<br>
 <a href=ref/Movie.html#play>Movie.play</a> - start movie playback<br>
+<a href=ref/Movie.html#render_frame>Movie.render_frame</a> - Render a specfic numbered frame.<br>
 <a href=ref/Movie.html#rewind>Movie.rewind</a> - set playback position to the beginning of the movie<br>
 <a href=ref/Movie.html#set_display>Movie.set_display</a> - change the video output surface<br>
 <a href=ref/Movie.html#set_volume>Movie.set_volume</a> - change volume for sound<br>

File docs/ref/Movie.html

View file
  • Ignore whitespace
 start movie playback</td></tr>
+<tr><td><a href=#render_frame>render_frame</a></td><td> -
+Render a specfic numbered frame.</td></tr>
 <tr><td><a href=#rewind>rewind</a></td><td> -
 set playback position to the beginning of the movie</td></tr>
 number of times the movie loops while playing.
+<a name=render_frame><font size=+2><b>render_frame
+</b></font><br><font size=+1><tt>
+Movie.render_frame(framenum) -> int
+Returns the current frame number.
 <a name=rewind><font size=+2><b>rewind
 </b></font><br><font size=+1><tt>
 Movie.rewind() -> None

File lib/cursors.py

View file
  • Ignore whitespace
     if type(mask) is type(''): mask = open(mask)
     curs = curs.readlines()
     mask = mask.readlines()
+    #avoid comments
+    for line in range(len(curs)):
+        if curs[line].startswith("#define"):
+            curs = curs[line:]
+            break
+    for line in range(len(mask)):
+    	if mask[line].startswith("#define"):
+            mask = mask[line:]
+            break
     #load width,height
     width = int(curs[0].split()[-1])
     height = int(curs[1].split()[-1])

File readme.html

View file
  • Ignore whitespace
     Niki Spahiev, Gordon Tyler, Nathaniel Pryce, 
     Dave Wallace, John Popplewell, Michael Urman,
     Andrew Straw, Michael Hudson, Ole Martin Bjoerndalen,
-    Herv� Cauwelier</li>
+    Herv� Cauwelier, James Mazer</li>
 <li>And our bug hunters above and beyond:
     Angus, Guillaume Proux, Frank Raiser,
     Austin Henry, Kaweh Kazemi, Arturo Aldama,
 <li>quake-like console with python interpreter</li>
 <li>game lobby. client, simple server, and protocol</li>
 <li>surfarrays should be able to do RGBA along with RGB</li>
+<li>draw with transparancy</li>
+<li>draw large sets of primitives with a single call</li>

File readme.txt

View file
  • Ignore whitespace
      * quake-like console with python interpreter
      * game lobby. client, simple server, and protocol
      * surfarrays should be able to do RGBA along with RGB
+     * draw with transparancy
+     * draw large sets of primitives with a single call

File src/movie.c

View file
  • Ignore whitespace
+    /*DOC*/ static char doc_movie_render_frame[] =
+    /*DOC*/    "Movie.render_frame(framenum) -> int\n"
+    /*DOC*/    "Render a specfic numbered frame.\n"    
+    /*DOC*/    "\n"                                
+    /*DOC*/    "Returns the current frame number.\n"                  
+    /*DOC*/ ;                    
+static PyObject* movie_render_frame(PyObject* self, PyObject* args)
+        SMPEG* movie = PyMovie_AsSMPEG(self);
+        SMPEG_Info info;                     
+        int framenum;   
+        if(!PyArg_ParseTuple(args, "i", &framenum))
+                return NULL;                       
+        SMPEG_renderFrame(movie, framenum);
+        SMPEG_getinfo(movie, &info);       
+        Py_END_ALLOW_THREADS        
+        return PyInt_FromLong(info.current_frame);
 static PyMethodDef movie_builtins[] =
 	{ "play", movie_play, 1, doc_movie_play },
 	{ "get_time", movie_get_time, 1, doc_movie_get_time },
 	{ "get_length", movie_get_length, 1, doc_movie_get_length },
 	{ "get_busy", movie_get_busy, 1, doc_movie_get_busy },
+        { "render_frame", movie_render_frame, 1, doc_movie_render_frame},
 	{ NULL, NULL }
     /*DOC*/    "and play your movie. Finally calling pygame.mixer.init()\n"
     /*DOC*/    "again when finished with the Movie.\n"
     /*DOC*/    "\n"
+    /*DOC*/    "NOTE: When disabling the mixer so a movie may play audio,\n"
+    /*DOC*/    "you must disable the audio before calling pygame.movie.Movie\n"
+    /*DOC*/    "or the movie will not realise that it may access the audio.\n"
+    /*DOC*/    "Before reinitialising the mixer, You must remove all\n"
+    /*DOC*/    "references to the movie before calling pygame.mixer.init()\n"
+    /*DOC*/    "or the init will fail, leading to errors when you attempt to\n"
+    /*DOC*/    "use the mixer.\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "eg.\n"
+    /*DOC*/    "pygame.mixer.quit()\n"
+    /*DOC*/    "movie=pygame.movie.Movie(\"my.mpg\")\n"
+    /*DOC*/    "movie.play()\n"
+    /*DOC*/    "# process events until movie finished here\n"
+    /*DOC*/    "movie.stop()\n"
+    /*DOC*/    "movie=None # if you don't do this bit the init will fail\n"
+    /*DOC*/    "pygame.mixer.init()\n"
     /*DOC*/ ;
 static PyTypeObject PyMovie_Type =