[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pgreloaded 2.0.0-alpha5 released




Hi Marcus,
Hi Gregor,
...
It seems to me that there is a certain lack of examples and ported
games to pygame2. Perhaps because porting seems to be quite tedious.

It's absolutely not tedious, but there is a decent lack of resources and
time. pygame2 is currently developed by one person (me), who has a funny
and incomplete time sharing model for free time to spend :-D.
Would your time sharing model allow for an easy and "asolutely not tedious" converting the appended script in a "quasi state of the art" way? It could serve me as a model or pattern for trying to convert one
of my games, just as a first step to dive into pygame2.
>  (2) I was not able to play an *.ogg
>  (3) If "someSound.ogg" is loaded, retrieving someSound.len lets the
>      program crash
Some questions to ask here: Which platform are you on (Win32, Linux,
..., 32 or 64 bit) and which library versions are you using (SDL,
SDL_mixer, libogg). If on Windows, are you using the prebuilt
installers, did you compile it yourself (using the prebuilt lib
package)?
Im working on Win32 (WindowsXP, ServicePack 2). I just downloaded the msi-installer
pygame2-2.0.0a5.win32-py3.1.msi
and installed it. I didn't install any additional libraries. Should I have done so?

I've an installation of Python 3.1.2 and pygame1.9.1 for Python 3.1. Don't know if
pygame2 shares libraries with python 1.9.1

I understand that one of the main goals of the development of pygame2 is to have a
more modular structure to facilitate the creation of executables.

What other important advantages over python 1.x are the objectives of the redesign?

Regards,
Gregor

In the end I refused to port the label stuff in the playSound program :-(

Understandable. The SDL_mixer part was not very well tested for now, so
your current efforts will be a huge help (although it caused a lot of
trouble for you, sorry for that :-)

Morover I observed, that pixelarray.py crashed after the 4th mouseclick
without saying why. I only was asked if I wanted a respective message
to be sent to microsoft. I declined :-)

Dang, you should have sent it to them. I can really need a helping hand :-).
So after a first impression pygame2 still seems to be rather immature.

Absolutely. It just made its step from alpha to beta.
I think you should insert quite a few beta releases before releasing
the first release candidate.

In my understanding/terms, in pygame (and thus pygame2), rc was/is the
same as beta. Maybe it should be relabeled from rc to ebta to avoid
confusion.
Plus, this will not be a "3 RCs and that's it". I expect to have some
more releases before all obvious bugs and issues are edged out, so
there's no need  to worry about a too early, unstable final release.

Regards
Marcus
SCREEN_SIZE = (800, 600)

import math
import random
import pygame

class Ball(pygame.sprite.Sprite):

    def __init__(self, screen, pos):
        pygame.sprite.Sprite.__init__(self)
        self.pos = pos
        self.r = random.randint(10, 25)
        self.image = pygame.Surface((2*self.r, 2*self.r)).convert()
        self.image.set_colorkey((0, 0, 0))
        pygame.draw.circle(self.image, 
                (random.randint(0,255), random.randint(0,255), random.randint(0,255)),
                (self.r, self.r), self.r)
        self.rect = self.image.get_rect()
        phi = 2 * math.pi * random.random()
        v = random.randint(290, 305)#(50, 400)
        self.vx = v * math.cos(phi)
        self.vy = v * math.sin(phi)

    def update(self, t):
        x, y = self.pos
        x += t * self.vx
        y += t * self.vy
        if x + self.r > SCREEN_SIZE[0]:
            x = x - 2 * (x + self.r - SCREEN_SIZE[0])
            self.vx = - self.vx
        elif x < self.r:
            x = 2 * self.r - x
            self.vx = - self.vx
        if y + self.r > SCREEN_SIZE[1]:
            y = y - 2 * (y + self.r - SCREEN_SIZE[1])
            self.vy = - self.vy
        elif y < self.r:
            y = 2 * self.r - y
            self.vy = - self.vy
        self.rect.center = self.pos = (x, y)
        

def main():
    pygame.init()

    screen = pygame.display.set_mode(SCREEN_SIZE)
    pygame.display.set_caption("move some circles")
    background = pygame.Surface(SCREEN_SIZE).convert()
    background.fill((128, 128, 128))
    screen.blit(background, (0, 0))

    balls = pygame.sprite.Group()
    for i in range(12):
        balls.add(Ball(screen, (random.randint(20,SCREEN_SIZE[0]-25),
                                random.randint(20,SCREEN_SIZE[1]-25))))

    clock = pygame.time.Clock()
    running = True

    while running:
        t = clock.tick(60)

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
            # add balls by left-clicking
            # remove balls by right-clicking
            if event.type == pygame.MOUSEBUTTONDOWN:
                if event.button == 1:
                    balls.add(Ball(screen, event.pos))
                elif event.button == 3:
                    sprites = balls.sprites()
                    if sprites:
                        balls.remove(sprites[0])

        balls.clear(screen, background)
        balls.update(t / 1000)
        balls.draw(screen)

        pygame.display.flip()

if __name__ == "__main__":
    main()