Re: [pygame] new game

2009-02-10 Thread Fiona Burrows



Yanom Mobis wrote:
hmmm is there anything where people can download without having to 
have hg/svn/cvs/git installed? even mercurial doesn't do this.




Google Code will let you add downloadable files.

Just a shame it's SVN. I prefer git and Github.

Github have a little feature called Github pages ( 
http://github.com/blog/272-github-pages ) that will let you create a 
mini website in your repo, you could just throw a file in there, link 
it, and it would work fine as a download. :)


Re: [pygame] Pure SDL C library branching

2009-02-10 Thread Marcus von Appen
On, Tue Feb 10, 2009, Rene Dudfield wrote:

 I think having one big library, with sub libraries in it is a good
 idea?  Rather than having to maintain each separately (eg, a scrap
 one, a blit one, etc etc).

No. The list contains just the single parts of the library. It would
result in a single library (libFrugulatePygame.xxx ...) and multiple
header files.

Regards
Marcus


pgpmlVQnh7UDC.pgp
Description: PGP signature


Re: [pygame] Pure SDL C library branching

2009-02-10 Thread Marcus von Appen
On, Tue Feb 10, 2009, Pete Shinners wrote:

 Sounds like a nice idea. I would follow the SDL addon naming  of 
 SDL_something. I would go with something like SDL_pgame (?) and follow 
 the api naming conventions of the SDL addons as well.

The current pgreloaded internals use a pyg_xxx naming convention:

int pyg_surface_fill_blend (...)
int pyg_surface_save (...)
int pyg_scrap_init (...)
...

That can be easily changed for both, the C library as well as
pgreloaded's internals to keep them consistent.

Personally I dislike the 'some SDL library name part'_javalike naming,
but will follow the mass's opinion about that :-). We just have to keep
both in sync, so changes can be quickly incorporated in the one or other
library.

Regards
Marcus


pgplom7S6PWtK.pgp
Description: PGP signature


[pygame] recap: refresh rate and timing issues

2009-02-10 Thread Matthias Treder
Hi guys.
There was a thread about this issue in 2007, with no obvious solution.
I got the same problem so I hope somebody knows a way out (if any).
The point is I want to know exactly when a flip is occuring. Naive
code could look like this :

 do some drawing here 
pygame.display.flip()
timestamp = pygame.time.get_ticks()

With double buffering, the flip waits for the next screen refresh, but
the program is not blocking and waiting for the flip (which is quite
reasonable), it just goes on. This means, however, that get_ticks()
will probably return before the actual flip happened. With my screen
(60 Hz), there is thus an unpredictable error of 0 - 16.6 ms.
Is there any way to get to know when the flip happened, or at least to
reduce this error below 10ms or so?

Thanks.
Matthias


Re: [pygame] Pure SDL C library branching

2009-02-10 Thread René Dudfield
well, pyg_ seems like a good one :)

Separate libraries seem better for modularity, and is more how they
are done currently.  eg.  So you don't need to use the scrap stuff if
you don't want.  libpyg_scrap.so etc ?



On Tue, Feb 10, 2009 at 8:03 PM, Marcus von Appen m...@sysfault.org wrote:
 On, Tue Feb 10, 2009, Pete Shinners wrote:

 Sounds like a nice idea. I would follow the SDL addon naming  of
 SDL_something. I would go with something like SDL_pgame (?) and follow
 the api naming conventions of the SDL addons as well.

 The current pgreloaded internals use a pyg_xxx naming convention:

 int pyg_surface_fill_blend (...)
 int pyg_surface_save (...)
 int pyg_scrap_init (...)
 ...

 That can be easily changed for both, the C library as well as
 pgreloaded's internals to keep them consistent.

 Personally I dislike the 'some SDL library name part'_javalike naming,
 but will follow the mass's opinion about that :-). We just have to keep
 both in sync, so changes can be quickly incorporated in the one or other
 library.

 Regards
 Marcus



[pygame] Re: Python path problem in vista?

2009-02-10 Thread Thiago Chaves
Can anyone in the list also reply if they do NOT get problems running
programs with skellington-compliant structure on Vista? So far I've
got only one person informing of problems executing the program and
I'd like to hear if that's widespread or not.

-Thiago

On Sun, Feb 8, 2009 at 10:02 PM, Thiago Chaves shundr...@gmail.com wrote:
 Hi,

 recently I was informed that my most recent project is not running
 properly in Vista. I'm using the skellington structure suggested by
 Pyweek administration and I'm wondering if that's somehow related.

 File structure for the project (as far as it is relevant to this post):
 ssof/run_game.py
 ssof/lib/main.py

 run_game.py's contents:

 
 #! /usr/bin/env python

 import sys
 import os


 try:
__file__
 except NameError:
pass
 else:
libdir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))
sys.path.insert(0, libdir)

 import main
 main.main()
 ___

 User feedback:

 Alright then,
 Open fully-updated Windows Vista. Open IDLE. Python version number is
 2.5.2. Open run_game.py. Hit F5 (runs the script).
 Traceback (most recent call last):
 File C:\Users\Andy
 Hanson\Desktop\ssof-2009-01-31-fixed\ssof_alpha4\run_game.py, line
 15, in module
 import main
 ImportError: No module named main

 This is certainly a very simple problem!

 

 Any thoughts? What am I doing wrong here?

 (I'm attaching run_game.py just in case the formatting gets messed up)

 -Thiago



Re: [pygame] Pure SDL C library branching

2009-02-10 Thread Marcus von Appen
On, Tue Feb 10, 2009, Rene Dudfield wrote:

 well, pyg_ seems like a good one :)
 
 Separate libraries seem better for modularity, and is more how they
 are done currently.  eg.  So you don't need to use the scrap stuff if
 you don't want.  libpyg_scrap.so etc ?
 

We could split it that way. Or even make two different build tasks. One
containing all parts in a single library, one creating multiple
libraries, a separate one for each purpose.

Regards
Marcus


pgpfYNnEtyoc1.pgp
Description: PGP signature


Re: [pygame] Re: Python path problem in vista?

2009-02-10 Thread Patrick Mullen
I get that error if I run from IDLE... But if I run it any other way
there is no problem.  IDLE is screwing up the __file__.  Don't know
why IDLE thinks it's OK to do that, but there it is.

On Tue, Feb 10, 2009 at 2:48 AM, Thiago Chaves shundr...@gmail.com wrote:
 Can anyone in the list also reply if they do NOT get problems running
 programs with skellington-compliant structure on Vista? So far I've
 got only one person informing of problems executing the program and
 I'd like to hear if that's widespread or not.

 -Thiago

 On Sun, Feb 8, 2009 at 10:02 PM, Thiago Chaves shundr...@gmail.com wrote:
 Hi,

 recently I was informed that my most recent project is not running
 properly in Vista. I'm using the skellington structure suggested by
 Pyweek administration and I'm wondering if that's somehow related.

 File structure for the project (as far as it is relevant to this post):
 ssof/run_game.py
 ssof/lib/main.py

 run_game.py's contents:

 
 #! /usr/bin/env python

 import sys
 import os


 try:
__file__
 except NameError:
pass
 else:
libdir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))
sys.path.insert(0, libdir)

 import main
 main.main()
 ___

 User feedback:

 Alright then,
 Open fully-updated Windows Vista. Open IDLE. Python version number is
 2.5.2. Open run_game.py. Hit F5 (runs the script).
 Traceback (most recent call last):
 File C:\Users\Andy
 Hanson\Desktop\ssof-2009-01-31-fixed\ssof_alpha4\run_game.py, line
 15, in module
 import main
 ImportError: No module named main

 This is certainly a very simple problem!

 

 Any thoughts? What am I doing wrong here?

 (I'm attaching run_game.py just in case the formatting gets messed up)

 -Thiago




Re: [pygame] Re: Python path problem in vista?

2009-02-10 Thread Brian Fisher
I can reproduce the problem (on vista), but it looks like an idle problem,
not really a vista problem

when running the script, __file__ is C:\Python25\Lib\idlelib\idle.pyw

so libdir becomes C:\Python25\Lib\idlelib\lib



On Tue, Feb 10, 2009 at 2:48 AM, Thiago Chaves shundr...@gmail.com wrote:

 Can anyone in the list also reply if they do NOT get problems running
 programs with skellington-compliant structure on Vista? So far I've
 got only one person informing of problems executing the program and
 I'd like to hear if that's widespread or not.

 -Thiago

 On Sun, Feb 8, 2009 at 10:02 PM, Thiago Chaves shundr...@gmail.com
 wrote:
  Hi,
 
  recently I was informed that my most recent project is not running
  properly in Vista. I'm using the skellington structure suggested by
  Pyweek administration and I'm wondering if that's somehow related.
 
  File structure for the project (as far as it is relevant to this post):
  ssof/run_game.py
  ssof/lib/main.py
 
  run_game.py's contents:
 
  
  #! /usr/bin/env python
 
  import sys
  import os
 
 
  try:
 __file__
  except NameError:
 pass
  else:
 libdir = os.path.abspath(os.path.join(os.path.dirname(__file__),
 'lib'))
 sys.path.insert(0, libdir)
 
  import main
  main.main()
  ___
 
  User feedback:
 
  Alright then,
  Open fully-updated Windows Vista. Open IDLE. Python version number is
  2.5.2. Open run_game.py. Hit F5 (runs the script).
  Traceback (most recent call last):
  File C:\Users\Andy
  Hanson\Desktop\ssof-2009-01-31-fixed\ssof_alpha4\run_game.py, line
  15, in module
  import main
  ImportError: No module named main
 
  This is certainly a very simple problem!
 
  
 
  Any thoughts? What am I doing wrong here?
 
  (I'm attaching run_game.py just in case the formatting gets messed up)
 
  -Thiago
 



Re: [pygame] Re: Python path problem in vista?

2009-02-10 Thread RB[0]
It is an IDLE problem - I ran into the same thing on Ubuntu and XP, IDLE
doesn't like the way they do it.
A simple fix is to just put this line in:
sys.path.insert(0, lib)
Instead of all that try/except nonsense. The above line works just as well,
and I have never had a problem with it failing anywhere.
I have actually used that stuff in my teams entry for pyweek ever sense the
skellington was released :)

HTH :)

On Tue, Feb 10, 2009 at 11:40 AM, Brian Fisher br...@hamsterrepublic.comwrote:

 I can reproduce the problem (on vista), but it looks like an idle problem,
 not really a vista problem

 when running the script, __file__ is C:\Python25\Lib\idlelib\idle.pyw

 so libdir becomes C:\Python25\Lib\idlelib\lib




 On Tue, Feb 10, 2009 at 2:48 AM, Thiago Chaves shundr...@gmail.comwrote:

 Can anyone in the list also reply if they do NOT get problems running
 programs with skellington-compliant structure on Vista? So far I've
 got only one person informing of problems executing the program and
 I'd like to hear if that's widespread or not.

 -Thiago

 On Sun, Feb 8, 2009 at 10:02 PM, Thiago Chaves shundr...@gmail.com
 wrote:
  Hi,
 
  recently I was informed that my most recent project is not running
  properly in Vista. I'm using the skellington structure suggested by
  Pyweek administration and I'm wondering if that's somehow related.
 
  File structure for the project (as far as it is relevant to this post):
  ssof/run_game.py
  ssof/lib/main.py
 
  run_game.py's contents:
 
  
  #! /usr/bin/env python
 
  import sys
  import os
 
 
  try:
 __file__
  except NameError:
 pass
  else:
 libdir = os.path.abspath(os.path.join(os.path.dirname(__file__),
 'lib'))
 sys.path.insert(0, libdir)
 
  import main
  main.main()
  ___
 
  User feedback:
 
  Alright then,
  Open fully-updated Windows Vista. Open IDLE. Python version number is
  2.5.2. Open run_game.py. Hit F5 (runs the script).
  Traceback (most recent call last):
  File C:\Users\Andy
  Hanson\Desktop\ssof-2009-01-31-fixed\ssof_alpha4\run_game.py, line
  15, in module
  import main
  ImportError: No module named main
 
  This is certainly a very simple problem!
 
  
 
  Any thoughts? What am I doing wrong here?
 
  (I'm attaching run_game.py just in case the formatting gets messed up)
 
  -Thiago
 





[pygame] Formal definitions for the BLEND operations

2009-02-10 Thread Lenard Lindstrom

Hi,

I am trying to write unit tests for the blit blend operations and am 
running into problems. There are no formal definitions as to what 
exactly a BLEND_ADD, BLEND_SUB and BLEND_MULT do. Sure they are add, 
subtract and multiply. But what happens with overflow and underflow. Do 
they truncate or just return maximum or minimum values. I will not look 
as the source for the answers because then I would just write the tests 
to pass rather than making tests that reflect the original intent of the 
operations.


Lenard

--
Lenard Lindstrom
le...@telus.net



Re: [pygame] Formal definitions for the BLEND operations

2009-02-10 Thread Brian Fisher
Pin to 0 and 255. Don't roll over.

Or is there something else?


On Tue, Feb 10, 2009 at 11:11 AM, Lenard Lindstrom le...@telus.net wrote:

 Hi,

 I am trying to write unit tests for the blit blend operations and am
 running into problems. There are no formal definitions as to what exactly a
 BLEND_ADD, BLEND_SUB and BLEND_MULT do. Sure they are add, subtract and
 multiply. But what happens with overflow and underflow. Do they truncate or
 just return maximum or minimum values. I will not look as the source for the
 answers because then I would just write the tests to pass rather than making
 tests that reflect the original intent of the operations.

 Lenard

 --
 Lenard Lindstrom
 le...@telus.net




Re: [pygame] Formal definitions for the BLEND operations

2009-02-10 Thread Lenard Lindstrom
Ok, that will work I can't comment on it as I don't know the intended 
uses for the arithmetic operations.


Lenard


Brian Fisher wrote:

Pin to 0 and 255. Don't roll over.

Or is there something else?


On Tue, Feb 10, 2009 at 11:11 AM, Lenard Lindstrom le...@telus.net 
mailto:le...@telus.net wrote:


Hi,

I am trying to write unit tests for the blit blend operations and
am running into problems. There are no formal definitions as to
what exactly a BLEND_ADD, BLEND_SUB and BLEND_MULT do. Sure they
are add, subtract and multiply. But what happens with overflow and
underflow. Do they truncate or just return maximum or minimum
values. I will not look as the source for the answers because then
I would just write the tests to pass rather than making tests that
reflect the original intent of the operations.





[pygame] move problems

2009-02-10 Thread Yanom Mobis

this code is in my main game loop

key = pygame.key.get_pressed() #create a key index

if K_UP in key: #check if the up arrow is pressed
redcar.speed = (0, -2)
else:
redcar.speed = (0, 0)

redcar.rect = redcar.rect.move(redcar.speed) #move redcar by speed

but pressing the up arrow doesn't move the sprite.


  



Re: [pygame] move problems

2009-02-10 Thread RB[0]
if key[K_UP] should work better :)

On Tue, Feb 10, 2009 at 6:47 PM, Yanom Mobis ya...@rocketmail.com wrote:


 this code is in my main game loop

 key = pygame.key.get_pressed() #create a key index

if K_UP in key: #check if the up arrow is pressed
redcar.speed = (0, -2)
else:
redcar.speed = (0, 0)

redcar.rect = redcar.rect.move(redcar.speed) #move redcar by speed

 but pressing the up arrow doesn't move the sprite.







Re: [pygame] move problems

2009-02-10 Thread maniaxx
hi,

K_UP has the value 273 and pygame.key.get_pressed() returns a tuple where the 
n'th value is 1 if the n'th key was pressed.
This should work:

if key[K_UP]:
.

 this code is in my main game loop

 key = pygame.key.get_pressed() #create a key index

 if K_UP in key: #check if the up arrow is pressed
 redcar.speed = (0, -2)
 else:
 redcar.speed = (0, 0)

 redcar.rect = redcar.rect.move(redcar.speed) #move redcar by speed

 but pressing the up arrow doesn't move the sprite.


Re: [pygame] surfaces2video?

2009-02-10 Thread Noah Kantrowitz


On Feb 9, 2009, at 3:48 AM, Matthias Treder wrote:


Is there any direct way to assemble a video (eg Quicktime) from a
sequence of single shots (ie surfaces)?
Put another way, is there a way to get surfaces into a format usable
by other extensions (PyMedia?) without saving them to the HD as images
first and then opening them again?

Cheers,
Matthias


ffmpeg and mencoder can both do this.

--Noah