×

Discussion Board

Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 58
  1. #31
    Registered User
    Join Date
    Jul 2007
    Posts
    2

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    Verified repeatable on 5800, results exactly as above ;-(
    btw, any fix/workaround would be fantastic...
    Have a hdpc front-end in progress in pygame on *nix with python2.5, would love to run it on the phone ;-)

    btw GameDude, does pygame receive screen touch events or do i need to use more platform specific hooks to use the touchscreen?

  2. #32
    Regular Contributor
    Join Date
    Jan 2007
    Location
    Oulu, Finland
    Posts
    147

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    > btw GameDude, does pygame receive screen touch events or do i need to use more platform specific hooks to use the touchscreen?

    Touch screen is supported. They are generated as mouse events.

    > any fix/workaround would be fantastic...

    I think I found a fix for the problem, but I need to do some testing. In the meanwhile you can also try to replace the data\pygame\pygame_main.py with your own version.

  3. #33
    Regular Contributor
    Join Date
    Jan 2007
    Location
    Oulu, Finland
    Posts
    147

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    A new release built against 1.9.5. is available.

    - Hopefully fixed the launcher for 5800.
    -- Unnecessary Surface buffer was created for every frame
    -- Increased heap size to 100k,4MB
    -- Improved slide animation by removing the fade effect.
    - Removed the warning about color.py and camera.py
    - Comes with a zipped, byte-compiled and doc stripped pygame library. At least feels faster than before. Should be faster still though.

  4. #34
    Super Contributor
    Join Date
    Dec 2004
    Posts
    643

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    Whoo, looks very cool. Love the subtle launcher transitions.

    Maybe we could even add pygame mode as a packaging option into a future release of our packaging tool. That way you could simply write your pygame code, select "package as pygame app" and presto, a standalone pygame app!

  5. #35
    Super Contributor
    Join Date
    Dec 2004
    Posts
    643

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    The module repository is already extensible. I'm wondering how much effort it would be to add support for arbitrary third party supplied application shells...

  6. #36
    Regular Contributor
    Join Date
    Jan 2007
    Location
    Oulu, Finland
    Posts
    147

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    Quote Originally Posted by jplauril View Post
    Whoo, looks very cool. Love the subtle launcher transitions.

    Maybe we could even add pygame mode as a packaging option into a future release of our packaging tool. That way you could simply write your pygame code, select "package as pygame app" and presto, a standalone pygame app!
    That would be cool I already made a feature request to Garage: https://garage.maemo.org/tracker/ind...=854&atid=3204

    I'm planning to make the pygame runtime and the launcher separate packages. And if supported, I'd prefer to create the launcher's installer with the packaging tool. The launcher should have all the pygame and PyS60 modules so it could be used for quick scripts.

    The pygame modules are currently statically linked, but since the packaging tool does the renaming magic, I'll revert back to PYDs and provide those as a library for the packaging tool + the pygame.exe. If the custom executables are supported that is
    Last edited by GameDude; 2009-05-27 at 18:07.

  7. #37
    Super Contributor
    Join Date
    Dec 2004
    Posts
    643

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    The packaging tool already supports several alternatives for the launcher exe. The only missing bit is that it's not possible to add more of those as easily as you can add modules to the repo.

  8. #38
    Nokia Developer Expert
    Join Date
    Oct 2005
    Posts
    3

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    Quote Originally Posted by GameDude View Post
    A new release built against 1.9.5. is available.

    - Hopefully fixed the launcher for 5800.
    -- Unnecessary Surface buffer was created for every frame
    -- Increased heap size to 100k,4MB
    -- Improved slide animation by removing the fade effect.
    - Removed the warning about color.py and camera.py
    - Comes with a zipped, byte-compiled and doc stripped pygame library. At least feels faster than before. Should be faster still though.
    I still get an "out of memory" with my 5800 =/. Hope you find a solution!

    Regards,
    -Jarmo

  9. #39
    Regular Contributor
    Join Date
    Jan 2007
    Location
    Oulu, Finland
    Posts
    147

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    *sigh*. I have to admit I'm out of ideas then. I don't have 5800 myself so it is quite hard for me to try to fix it and it works just fine on my phone. Quite frustrating actually. You need 20 devices to be able to get right even something as simple as this.

    Contributions are needed here( or buy me one of those fancy 5800. )

    Has anybody else out there tested with 5800?

    Could you send the exception trace? or is it the same as before?

  10. #40
    Nokia Developer Expert
    Join Date
    Oct 2005
    Posts
    3

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    This is what I get with the 5800:
    Code:
    c:\resource\python25\python25.zip\site.py:86: RuntimeWarning: import cdrom: No module named cdrom
    (ImportError: No module named cdrom)
      return _original_import(name, globals, locals, fromlist, level)
    c:\resource\python25\python25.zip\site.py:86: RuntimeWarning: import joystick: No module named joystick
    (ImportError: No module named joystick)
      return _original_import(name, globals, locals, fromlist, level)
    c:\resource\python25\python25.zip\site.py:86: RuntimeWarning: import mouse: No module named mouse
    (ImportError: No module named mouse)
      return _original_import(name, globals, locals, fromlist, level)
    Traceback (most recent call last):
      File "\data\pygame\pygame_main.py", line 62, in <module>
        m = imp.load_module("__main__", fp, pathname, stuff)
      File "\data\pygame\launcher\pygame_launcher.py", line 1241, in <module>
        start()
      File "\data\pygame\launcher\pygame_launcher.py", line 1188, in start
        path_to_app = a.run()
      File "\data\pygame\launcher\pygame_launcher.py", line 958, in run
        eventhandler(event)
      File "\data\pygame\launcher\pygame_launcher.py", line 1170, in handleEvent
        handled = self.focused.handleEvent(event)
      File "\data\pygame\launcher\pygame_launcher.py", line 733, in handleEvent
        self.doSelect()
      File "\data\pygame\launcher\pygame_launcher.py", line 620, in doSelect
        callback(*args)
      File "\data\pygame\launcher\pygame_launcher.py", line 1077, in mhApplications
        self.__handle_transition_animation(self.focused, menu, effect=0)
      File "\data\pygame\launcher\pygame_launcher.py", line 1018, in __handle_transition_animation
        bg2 = BackgroundTransparent(self.sysdata)
      File "\data\pygame\launcher\pygame_launcher.py", line 343, in __init__
        BackgroundBase.__init__(self, sysdata)
      File "\data\pygame\launcher\pygame_launcher.py", line 338, in __init__
        self.surface = pygame.Surface(screen_size, )
    error: Out of memory
    With N97 it becomes even more interesting. If I try to open "Applications" using touch, it crashes right away:
    Code:
    c:\resource\python25\python25.zip\site.py:86: RuntimeWarning: import cdrom: No module named cdrom
    (ImportError: No module named cdrom)
      return _original_import(name, globals, locals, fromlist, level)
    c:\resource\python25\python25.zip\site.py:86: RuntimeWarning: import joystick: No module named joystick
    (ImportError: No module named joystick)
      return _original_import(name, globals, locals, fromlist, level)
    c:\resource\python25\python25.zip\site.py:86: RuntimeWarning: import mouse: No module named mouse
    (ImportError: No module named mouse)
      return _original_import(name, globals, locals, fromlist, level)
    Traceback (most recent call last):
      File "\data\pygame\pygame_main.py", line 62, in <module>
        m = imp.load_module("__main__", fp, pathname, stuff)
      File "\data\pygame\launcher\pygame_launcher.py", line 1241, in <module>
        start()
      File "\data\pygame\launcher\pygame_launcher.py", line 1188, in start
        path_to_app = a.run()
      File "\data\pygame\launcher\pygame_launcher.py", line 958, in run
        eventhandler(event)
      File "\data\pygame\launcher\pygame_launcher.py", line 1170, in handleEvent
        handled = self.focused.handleEvent(event)
      File "\data\pygame\launcher\pygame_launcher.py", line 733, in handleEvent
        self.doSelect()
      File "\data\pygame\launcher\pygame_launcher.py", line 620, in doSelect
        callback(*args)
      File "\data\pygame\launcher\pygame_launcher.py", line 1077, in mhApplications
        self.__handle_transition_animation(self.focused, menu, effect=0)
      File "\data\pygame\launcher\pygame_launcher.py", line 1035, in __handle_transition_animation
        ], 0.5)
      File "\data\pygame\launcher\pygame_launcher.py", line 204, in do
        self.render_callback(s)
      File "\data\pygame\launcher\pygame_launcher.py", line 1023, in render_callback
        menu1.update()
      File "\data\pygame\launcher\pygame_launcher.py", line 749, in update
        self.updateItems()
      File "\data\pygame\launcher\pygame_launcher.py", line 811, in updateItems
        surf = self._create_list_bg(size)
      File "\data\pygame\launcher\pygame_launcher.py", line 756, in _create_list_bg
        surf = pygame.Surface(size, )
    error: Out of memory
    However, using the arrow/select keys I can open "Applications" successfully, but when I try to start the snake it crashes:
    Code:
    c:\resource\python25\python25.zip\site.py:86: RuntimeWarning: import cdrom: No module named cdrom
    (ImportError: No module named cdrom)
      return _original_import(name, globals, locals, fromlist, level)
    c:\resource\python25\python25.zip\site.py:86: RuntimeWarning: import joystick: No module named joystick
    (ImportError: No module named joystick)
      return _original_import(name, globals, locals, fromlist, level)
    c:\resource\python25\python25.zip\site.py:86: RuntimeWarning: import mouse: No module named mouse
    (ImportError: No module named mouse)
      return _original_import(name, globals, locals, fromlist, level)
    Traceback (most recent call last):
      File "\data\pygame\pygame_main.py", line 62, in <module>
        m = imp.load_module("__main__", fp, pathname, stuff)
      File "\data\pygame\launcher\pygame_launcher.py", line 1241, in <module>
        start()
      File "\data\pygame\launcher\pygame_launcher.py", line 1188, in start
        path_to_app = a.run()
      File "\data\pygame\launcher\pygame_launcher.py", line 958, in run
        eventhandler(event)
      File "\data\pygame\launcher\pygame_launcher.py", line 1170, in handleEvent
        handled = self.focused.handleEvent(event)
      File "\data\pygame\launcher\pygame_launcher.py", line 710, in handleEvent
        self.doSelect()
      File "\data\pygame\launcher\pygame_launcher.py", line 620, in doSelect
        callback(*args)
      File "\data\pygame\launcher\pygame_launcher.py", line 1007, in mhLaunchApplication
        e.do((effect, e.tweenEaseInBack), 0.75)
      File "\data\pygame\launcher\pygame_launcher.py", line 208, in do
        _surf, x, y = effect( self.screen, s, self.surf2, v )
      File "\data\pygame\launcher\pygame_launcher.py", line 163, in effectZoomOut
        s = pygame.transform.scale(surfold, (w, h))
    error: Out of memory

  11. #41
    Registered User
    Join Date
    Apr 2009
    Posts
    5

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    Same problem for me with 5800 PyS60 1.9.6

  12. #42
    Registered User
    Join Date
    Dec 2008
    Posts
    4

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    Hi,

    to reduce the memory... pygame.transform.scale can use a destination surface.

    You can create a subsurface from the surface you want to put the scaled data onto, at the size of the surface.

    Then you can use that subsurface as the dst surface in pygame.transform.scale.

    Untested code:

    def effectZoomOut(self, surf, surfold, surfnew, v):
    """ This creates an effect where the surface is scaled and moved
    so that it looks like the surface moves to the distance.
    """
    r = surf.get_rect()
    w, h = int(r.width * (1 - v)), int(r.height * (1 - v))
    x, y = int(r.width / 2 * (v)), int(r.height / 2 * (v))
    subsurf = surf.subsurface((x, y, w, h))

    surf.blit(surfnew,(0,0))

    s = pygame.transform.scale(surfold, (w, h), subsurf)

    return surf, 0,0

    That should allocate less memory, and also require one less blit.

    Another way to reduce memory could be to only import, and init the modules needed? I'm not sure if this is happening already?
    eg. if only using the display module, just init that, rather than pygame.init() just use pygame.display.init()


    cheers,

  13. #43
    Regular Contributor
    Join Date
    Jan 2007
    Location
    Oulu, Finland
    Posts
    147

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    Hi,
    the code worked fine if we are scaling to smaller, but the used tween first zooms in and then zooms out. This caused trouble when the requested subsurface was larger than the original. I added checks for that and use subsurface of the source surface for the scaling if the size is larger. The effect looks the same as before without extra buffer. Thanks for the tip

    This won't fix 5800 though The real problem is in __handle_transition_animation where I create 2 full temporary surfaces for the animation. I suppose I need to rethink those animations.

    Code:
    def effectZoomOut(self, surf, surfold, surfnew, v):
        """
        This creates an effect where the surface is scaled and moved 
        so that it looks like the surface moves to the distance.
        
        @param surf: The surface containing the result of the effect.
        @param surfold: The surface to be zoomed.
        @param surfnew: The next surface acting as a background.
        @param v: The tween value. Position of the animation.
        """
        
        r = surf.get_rect()
        
        # Define size of the scaling
        w, h = int(r.width * (1 - v)), int(r.height * (1 - v))
        x, y = int(r.width / 2 * (v)), int(r.height / 2 * (v))
        
        _x = max(0,x)
        _y = max(0,y)
        _w = min(r.width,w)
        _h = min(r.height,h)
        target_subsurf = surf.subsurface((_x, _y, _w, _h))
        
        # Scale full or only partial if scaling larger
        use_subsurf = (v < 0)
        if use_subsurf:
            # Full size - exceeding size and scale that instead of full surface
            if w > r.width:
                w -= ( w - r.width ) * 2
            if h > r.height:
                h -= ( h - r.height) * 2
            if x < 0:
                x *= -1
            if y < 0:
                y *= -1
            
            source_subsurf = surfold.subsurface( ( x, y, w, h) )
        else:
            source_subsurf = surfold
            
        # The new surface is the background
        surf.blit(surfnew,(0,0))
        
        s = pygame.transform.scale(source_subsurf, (_w, _h), target_subsurf)
       
        return surf, 0,0

  14. #44
    Regular Contributor
    Join Date
    Jan 2007
    Location
    Oulu, Finland
    Posts
    147

    Re: [Announce] pygame for S60 for PyS60 1.9.x

    Ok, I think it works now( again ). I was able to remove all full screen temporary surfaces and still keep the animations. It's probably faster as well and only display and font subsystems are initialized as illume suggested. That alone reduced memory usage ~2Mb at least on PC. I didn't realize it would be that much.

    5800 or N97 was not immediately available at RDA service so, if somebody wants to try it out, get updated launcher from SVN

    You can expect new pygame release soon after next PyS60 version comes out.
    Last edited by GameDude; 2009-07-19 at 20:18.

  15. #45
    Regular Contributor
    Join Date
    Jan 2007
    Location
    Oulu, Finland
    Posts
    147

    [Announce] pygame 1.9.0 for S60 for PyS60 1.9.7

    Final Pygame 1.9.0 release for PyS60 1.9.7 is now available

    Fixed issues:
    3. Out of memory crashes with launcher

    Known issues:
    1. Launcher crashes when installed to memory card and trying to start application
    2. PyS60 version to sis package filename

    If you have any problems, please post your comments here, to the code-google's issue tracker or to pygame's mailing list.

Similar Threads

  1. Replies: 50
    Last Post: 2009-11-17, 19:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×