Re: [pygame] Good code for text wrapping?

2008-09-15 Thread Douglas Bagnall
Ah no, sorry. I didn't see the font/width part.

d

2008/9/16 Douglas Bagnall <[EMAIL PROTECTED]>:
>> The cookbook has this entry, but it doesn't work with new lines.
>> http://www.pygame.org/wiki/TextWrapping
>>
>> Anyone have any code like this that supports new lines?
>
> Batteries are included:
>
> http://docs.python.org/lib/module-textwrap.html
>
> does that help?
>
> Douglas
>


Re: [pygame] Good code for text wrapping?

2008-09-15 Thread Douglas Bagnall
> The cookbook has this entry, but it doesn't work with new lines.
> http://www.pygame.org/wiki/TextWrapping
>
> Anyone have any code like this that supports new lines?

Batteries are included:

http://docs.python.org/lib/module-textwrap.html

does that help?

Douglas


[pygame] Good code for text wrapping?

2008-09-15 Thread René Dudfield
hello,


The cookbook has this entry, but it doesn't work with new lines.
http://www.pygame.org/wiki/TextWrapping

Anyone have any code like this that supports new lines?


cheers,


Re: [pygame] shadow demo

2008-09-15 Thread Ian Mallett
On Mon, Sep 15, 2008 at 6:16 PM, René Dudfield <[EMAIL PROTECTED]> wrote:

> This is because the shadow mapping in that code is happening in the
> frame buffer.  If you move it to an off-screen buffer(FBO, or
> pbuffer), then you can increase the resolution.  Of course FBOs, and
> pbuffers aren't available on all cards, so the framebuffer method as a
> fallback is still needed.

I will certainly look into this, thanks!

I just added the near and far planes too, so now if you know where the
object is, and its bounding sphere, you can easily get the dimensions of the
light's viewport.  The quality right now with resolution 512 is close to
subpixel even up close for the demos I showed.  The next version of the
library will include this standard, of course.

Ian


Re: [pygame] shadow demo

2008-09-15 Thread René Dudfield
oh, I guess you haven't uploaded your changes yet?  Looking forward to
comparing the difference :)

cu,

On Tue, Sep 16, 2008 at 11:15 AM, Ian Mallett <[EMAIL PROTECTED]> wrote:
> Just a word on shadow quality (previously bad).  I added some nice texture
> antialiasing, and added to the tutorial to show how to set the light angle
> to effectively use the range.
> Ian
>


Re: [pygame] shadow demo

2008-09-15 Thread René Dudfield
Ah, nice one :)

Yeah, if you're careful about light placement, then shadow mapping can
look a lot nicer.  Since you can avoid the cases where it doesn't look
so good.

cu,

On Tue, Sep 16, 2008 at 11:15 AM, Ian Mallett <[EMAIL PROTECTED]> wrote:
> Just a word on shadow quality (previously bad).  I added some nice texture
> antialiasing, and added to the tutorial to show how to set the light angle
> to effectively use the range.
> Ian
>


Re: [pygame] shadow demo

2008-09-15 Thread René Dudfield
On Mon, Sep 15, 2008 at 10:58 AM, Ian Mallett <[EMAIL PROTECTED]> wrote:
>> Have you done rendering to texture for increased shadow map
>> resolution?  That would really give it a nice quality boost.
>
> That's what shadow mapping does.  Unfortunately, there is a strange
> limitation which causes artifacts if the textures_resolution >
> min([screenwidth, screenheight]).  I'll ask GameDev.net soon I hope.

This is because the shadow mapping in that code is happening in the
frame buffer.  If you move it to an off-screen buffer(FBO, or
pbuffer), then you can increase the resolution.  Of course FBOs, and
pbuffers aren't available on all cards, so the framebuffer method as a
fallback is still needed.


cu,


Re: [pygame] shadow demo

2008-09-15 Thread Ian Mallett
Just a word on shadow quality (previously bad).  I added some nice texture
antialiasing, and added to the tutorial to show how to set the light angle
to effectively use the range.
Ian


[pygame] Reminder: PyGameSF meetup Tuesday September 16th 7pm @ Metreon San Francisco

2008-09-15 Thread Harry Tormey
Hi All, 
Just a reminder that this months PyGameSF meet up is on Tuesday 
September 16th from 7pm at the Metreon food court in San Francisco. This

month's presentations are: 

- Amar Chaudhary "Python, OpenSound Control and Open Sound World."   

About: This talk will demonstrate Open Sound World (OSW), a dynamic, 
scalable environment for audio and music processing, and the ability to
control 
OSW via Python and OpenSound Control.  This system can be used for
building 
musical instruments or effects for use in live performance, as well as
"live 
coding."

-Keith Nemitz (http://www.mousechief.com/  )
'Making PyGames That Make 
Money' 

About: This talk will cover how to organize your production and tools, 
how to exploit market opportunities, and what the near future of small
game 
developer business and tools look like. 

 

-Demo of the PyGameSF team entry into pyweek: 

http://www.pyweek.org/e/CampInvisible/
 

Anyone from the bay who participated in pyweek is encouraged to come on
down, show what they did and head out for a few drinks after!

PyGameSF is an informal group meet up in San Francisco for Software 
engineers interested in python, OpenGL, audio, pygame, SDL, 
programming and generally anything to do with multimedia development. 
The format of our meetings typically involve several people giving 
presentations on projects they are developing followed by 
group discussion and feedback. 

If anyone else would like to give a micro presentation, show demos or 
just talk about what they are doing or generally give examples of  any 
relevant software they are working on please feel free to head along. 

To subscribe to the pygamesf mailing list simply email 
pygame-sf+subscribe at unworkable.org 



Re: [pygame] [pygame ] Having trouble with RenderUpdate

2008-09-15 Thread Andy Brown
Some comments:

You should realize that a Sprite is the combination of a Rect + a
Surface.  So you don't need to keep a .posicao attribute.  The
position of the sprite is just the topleft corner of its .rect.

 class Arrow(pygame.sprite.Sprite):
def __init__(self,a=0,b=0):
   pygame.sprite.Sprite.__init__(self)
   self.image=pygame.image.load("Arrow.png")
   self.rect=self.image.get_rect()
   self.rect.topleft = [a,b]

 def start(self):
   "blits arrow in the screen in position and update"
   R_up.clean(screen,current_background_image)
   a=R_up.draw(screen)
   pygame.display.update(a)



>
> Hugo Arts wrote:
>>
>> using self.rect = image.get_rect() gets you a rect with the correct size.
>> you can use self.rect.topleft = (100, 200) to set the position, that will
>> save you some lines.
>>  saw this second e-mail only after replying to the first one. sorry.
>>
>> On Mon, Sep 15, 2008 at 9:16 AM, KKarasu <[EMAIL PROTECTED]
>> > wrote:
>>
>>Thanks Andy.
>>
>>I think i understood.the get rect always returned at (0,0) and
>>that was a problem.
>>so basicaly my code did was: create surface at 0,0 and move it to
>>posicao=[x,y] (yes posicao is position i used my own language
>>variables and forgot to translate, sorry)
>>then draw it with group.draw, updating the (0,0) surface,right?
>>what happened was this:
>>http://kkarasu.deviantart.com/art/second-title-screen-97971437
>>#tìs my devart site, it got the screen shot there
>>
>>So i need to keep track of where the surface is at a moment.
>>shall i create an artificial rect class?
>>
>>Example:
>>
>>class Arrow(pygame.sprite.Sprite):
>>#this is the possition of the sprite and size
>>self.x = 100
>>self.y=  200
>>self.height = 90
>>self.width = 70
>>self.rect= pygame.Rect(self.x,self.y,self.width,self.height)
>>
>>def DRAW(self):
>>   a=R_up.draw(screen) #this will use .draw in the
>>R_up== RenderUpdate group with arrow in it using suposedly the
>>self.rect to track position
>>   pygame.display.update(a)
>>
>>  #to move the arrow i just have to update the self.x and self.y
>>values and call self.rect again to update its values
>>
>>would this work? or theres a better option?
>>I thinking loud here, im gonna try it now.
>>
>>
>
>


Re: [pygame] [pygame ] Having trouble with RenderUpdate

2008-09-15 Thread KKarasu

Hi Hugo.

Yeah, what u said it was right mutch easier doing self.rect.topleft 
being self.rect= image.get_rect()

ok. so i`ve done that.
Thanks on that one, lol i was planing something way to complicated.

So it is solved thanks i realized i must call the group.clean to work 
right?


so now i have this:

class Arrow(pygame.sprite.Sprite):
def __init__(self,a=0,b=0):
   #iniciates position and image
   pygame.sprite.Sprite.__init__(self)
   self.image=pygame.image.load("Arrow.png")
   self.posicao=[a,b]
   self.rect=self.image.get_rect()
  
def start(self):

   "blits arrow in the screen in position and update"
   R_up.clean(screen,current_background_image)   
#clears the sprite
   self.rect.topleft=((self.posicao[0],self.posicao[1]))
#gets position
   
a=R_up.draw(screen)  
#blits to screen
   
pygame.display.update(a)
#updates the 2 rect, the former from clear and the new one



Thanks a lot guys.
I think i got it.
Is this how it is suposed to work right?
It works fine the arrow now, then i press up or down it moves acordingly 
and it delets the former.





Hugo Arts wrote:
using self.rect = image.get_rect() gets you a rect with the correct 
size. you can use self.rect.topleft = (100, 200) to set the position, 
that will save you some lines.
 
saw this second e-mail only after replying to the first one. sorry.


On Mon, Sep 15, 2008 at 9:16 AM, KKarasu <[EMAIL PROTECTED] 
> wrote:


Thanks Andy.

I think i understood.the get rect always returned at (0,0) and
that was a problem.
so basicaly my code did was: create surface at 0,0 and move it to
posicao=[x,y] (yes posicao is position i used my own language
variables and forgot to translate, sorry)
then draw it with group.draw, updating the (0,0) surface,right?
what happened was this:
http://kkarasu.deviantart.com/art/second-title-screen-97971437
#tìs my devart site, it got the screen shot there

So i need to keep track of where the surface is at a moment.
shall i create an artificial rect class?

Example:

class Arrow(pygame.sprite.Sprite):
#this is the possition of the sprite and size
self.x = 100
self.y=  200
self.height = 90
self.width = 70
self.rect= pygame.Rect(self.x,self.y,self.width,self.height)

def DRAW(self):
   a=R_up.draw(screen) #this will use .draw in the
R_up== RenderUpdate group with arrow in it using suposedly the
self.rect to track position
   pygame.display.update(a)

  #to move the arrow i just have to update the self.x and self.y
values and call self.rect again to update its values

would this work? or theres a better option?
I thinking loud here, im gonna try it now.






Re: [pygame] [pygame ] Having trouble with RenderUpdate

2008-09-15 Thread Hugo Arts
using self.rect = image.get_rect() gets you a rect with the correct size.
you can use self.rect.topleft = (100, 200) to set the position, that will
save you some lines.

saw this second e-mail only after replying to the first one. sorry.

On Mon, Sep 15, 2008 at 9:16 AM, KKarasu <[EMAIL PROTECTED]> wrote:

> Thanks Andy.
>
> I think i understood.the get rect always returned at (0,0) and that was a
> problem.
> so basicaly my code did was: create surface at 0,0 and move it to
> posicao=[x,y] (yes posicao is position i used my own language variables and
> forgot to translate, sorry)
> then draw it with group.draw, updating the (0,0) surface,right?
> what happened was this:
> http://kkarasu.deviantart.com/art/second-title-screen-97971437 #tìs my
> devart site, it got the screen shot there
>
> So i need to keep track of where the surface is at a moment.
> shall i create an artificial rect class?
>
> Example:
>
> class Arrow(pygame.sprite.Sprite):
> #this is the possition of the sprite and size
> self.x = 100
> self.y=  200
> self.height = 90
> self.width = 70
> self.rect= pygame.Rect(self.x,self.y,self.width,self.height)
>
> def DRAW(self):
>a=R_up.draw(screen) #this will use .draw in the R_up==
> RenderUpdate group with arrow in it using suposedly the self.rect to track
> position
>pygame.display.update(a)
>
>   #to move the arrow i just have to update the self.x and self.y values and
> call self.rect again to update its values
>
> would this work? or theres a better option?
> I thinking loud here, im gonna try it now.
>


Re: [pygame] having problem swith RenderUpdate

2008-09-15 Thread Hugo Arts
What you're doing seems alright. how exactly doesn't it work? What is the
produced effect and how does it deviate from the desired effect?

I think it will be helpful to us to see a more detailed code listing.

On Sun, Sep 14, 2008 at 7:34 PM, KKarasu <[EMAIL PROTECTED]> wrote:

> Hi there!
>
> After reading a couple of tutorials i just don't get how to clear just the
> area the sprite changed.
>
> exemple: i have an arrow, i blit it on the screen with a group.draw, and i
> dont know how to just update the area that changed by this method. i could
> blit again the entire screen, but i just want that spot, that way i dont
> have to blother bliting a hole lot of other stuff.
>
> # this is just the method part the rest is uninportant
>
> def start(self):
>
>  self.rect=(self.image.get_rect()).move(self.posicao[0],self.posicao[1]) #
> this moves the object by messing with the rect
>
> a=R_up.draw(screen)  #this draws the group sprites  (R_up= thats
> RenderUpdate group)
> #iundestand that returns the changed areas so it says in the docs i should
> pass it to pygame.display.update
> #so thats what i do
>pygame.display.update(a)
>
>
> so it doesnt work.
> can anyone explainme how to do this?
>  
>
>
>


Re: [pygame] [pygame ] Having trouble with RenderUpdate

2008-09-15 Thread KKarasu

Thanks Andy.

I think i understood.the get rect always returned at (0,0) and that was 
a problem.
so basicaly my code did was: create surface at 0,0 and move it to 
posicao=[x,y] (yes posicao is position i used my own language variables 
and forgot to translate, sorry)

then draw it with group.draw, updating the (0,0) surface,right?
what happened was this: 
http://kkarasu.deviantart.com/art/second-title-screen-97971437 #tìs my 
devart site, it got the screen shot there


So i need to keep track of where the surface is at a moment.
shall i create an artificial rect class?

Example:

class Arrow(pygame.sprite.Sprite):
 #this is the possition of the sprite and size
 self.x = 100
 self.y=  200
 self.height = 90
 self.width = 70
 self.rect= pygame.Rect(self.x,self.y,self.width,self.height)

 def DRAW(self):
a=R_up.draw(screen) #this will use .draw in the 
R_up== RenderUpdate group with arrow in it using suposedly the self.rect 
to track position

pygame.display.update(a)

   #to move the arrow i just have to update the self.x and self.y 
values and call self.rect again to update its values


would this work? or theres a better option?
I thinking loud here, im gonna try it now.