.visit() is perfect ! thanks again for your help. I will check later the advantage of using the scrollingManager.
On 13 fév, 22:30, claudio canepa <[email protected]> wrote: > On Mon, Feb 13, 2012 at 6:18 PM, claudio canepa <[email protected]> wrote: > > > On Mon, Feb 13, 2012 at 11:43 AM, Philippe <[email protected]>wrote: > > >> Hello again, > > >> Is there a way to make it (mask) works with cocos's Layer ? > >> something like > > >> class Layer1(Layer): > > >> is_event_handler = True > > >> def __init__(self, png): > >> super(Layer1, self ).__init__() > >> self.map = Sprite(png) > >> self.map.position = self.map.width/2, self.map.height/2 > >> self.add(self.map) > > >> def on_mouse_press(self, x, y, buttons, modifiers): > >> x, y = director.get_virtual_coordinates (x, y) > >> if self.map.contains(*self.parent.point_to_local((x, y))): > >> self.map.x += 10 > > >> def draw(self): > >> pyglet.gl.glScissor(10, 10, 300, 200) > >> pyglet.gl.glEnable(pyglet.gl.GL_SCISSOR_TEST) > >> super(Layer1, self ).draw() > >> pyglet.gl.glDisable(pyglet.gl.GL_SCISSOR_TEST) > > >> This does not work. > > >> Should I use another type of Layer ? > >> No way to make it work ? > > > I think you want to override .visit() and not .draw() > > > Look at both methods in cocosnode.py > > > -- > > claudio > > Also, ScrollingManager, a subclass of Layer, uses scissors to limit the > drawing (look for the parameter viewport). If you are going to do > scrolling, you can use the scissors included, or look at the code as > scissor example. > > -- > claudio -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" 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/cocos-discuss?hl=en.
