Sorry, if that's a dumb question, but what is GLUT? 

As far as I know, the minimal implementation for the window and a clickable 
Thing is similar to the following: 

# First we need PyGlet,  window and image for the faces. 
from pyglet import window,  image

# And the pyglet events 
from pyglet.window import event

# and the mouse events. 
from pyglet.window import mouse

# And we want to be able to wait a bit (and save processor time). 
from time import sleep 

class Window(pyglet.Window): 
        def __init__(things=[], *args, **kwds): 
                super(Window, self).__init__(fullscreen=True)
                self.things = things #: The list of things which appear on the 
screen

        def action(): 
                """Do whatever the class should do in each loop"""
                pass

        def event_loop(): 
                self.dispatch_events()
                self.clear()
                self.action()
                self.flip()
                # wait for 3ms which is quite unnoticeable but massively 
reduces CPU load
                sleep(0.003)

        def on_mouse_release(self,  x,  y,  button,  modifiers):
                """Check, if a mouse-click hit a card. If yes, perform the 
clicked() 
action."""
                for i in self.things: 
                        if i.is_inside(x, y): 
                                i.clicked()
                

class Thing(object): 
        def __init__(image_path, *args, **kwds): 
                # super is necessary here to make multiple inheritance possible 
for 
subclasses. 
                super(Thing, self).__init__(*args, **kwds)
                self.image = image.load(image_path) #: the image to show
        
        def is_inside(area, x, y,  width=0,  height=0):
            """Check if the given coordinates (optionally: A part of the given 
area) 
is inside. 
    
If the given coordinates or some part of the object given by the coordinates 
and width and height are in the area, return true."""
                # Do so. For an example, please check the attached files. 
                pass

        def clicked(): 
                """Perform whatever action should be done when the icon thing 
was 
clicked."""
                print i, "was clicked." 
                

For the mouse gestures, you might also need some mouse-tracking code since 
this code only covers clickable Things. 

Best wishes, 
Arne

El Thursday, 21 de February de 2008 20:14:23 infinite8s escribió:
> Hello,
>
> What is the minimal pyglet window implementation required for a full
> screen app with no keyboard (only mouse gestures)? Is it possible to
> have pyglet sit ontop of GLUT? I've been looking at Cocoa code for the
> UIKit on the iphone (particularly from the clutter UI library) and I
> think it might be possible to port pyglet to the iphone by creating c
> functions that call the Cocoa objective C code then creating callbacks
> that tie into pyglet event handling.
>
> Basically, what are the minimum functions/classes that I would need to
> implement? Thanks.
>
> NMA
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group. To post to this group, send email to
> [email protected] To unsubscribe from this group, send email to
> [EMAIL PROTECTED] For more options, visit this
> group at http://groups.google.com/group/pyglet-users?hl=en
> -~----------~----~----~----~------~----~------~--~---



-- 
Unpolitisch sein
Heißt politisch sein
Ohne es zu merken. 
- Arne Babenhauserheide ( http://draketo.de )
-- Weblog: http://blog.draketo.de

-- Mein öffentlicher Schlüssel (PGP/GnuPG): 
http://draketo.de/inhalt/ich/pubkey.txt

Attachment: babglet.py
Description: application/python

Attachment: gui_base.py
Description: application/python

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to