[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Battery Life
you could try this hack for X11...
cheers,
import pygame
import ctypes
import select
def get_fd():
w = pygame.display.get_wm_info()
w = w['display']
n = int(str(w)[23:-1], 16)
n = ctypes.cast(n+8, ctypes.POINTER(ctypes.c_int)).contents.value
n = ctypes.cast(n+8, ctypes.POINTER(ctypes.c_int)).contents.value
return n
def wait(fd, timeout=None):
select.select([fd], [], [], timeout)
On Tue, Jun 3, 2008 at 2:31 PM, The dob <petkanics@xxxxxxxxx> wrote:
> Hi. I'm having a battery problem.
>
> I'm running pygame on Maemo (linux on a mobile device). In my main
> game loop I am using pygame.event.wait() and sleeping all other
> running threads. To me this means that until there is an event, the
> process should not consume very much processor time. Unfortunately,
> the battery on the device still drains very quickly (about 4 hours
> when idle, as compared to 2 days while other applications are idle).
>
> Running 'top' does not indicate that the idle process is consuming
> very much processing power either.
>
> Has anybody dealt with a similar issue, or have any recommendations?
>
> Thanks,
> Doug
>