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 ?
On 9 fév, 08:05, Philippe <[email protected]> wrote:
> It works well.
> I will probably write a Sprite class that implement a mask if needed.
> thank you!
>
> On Feb 9, 12:12 am, Richard Jones <[email protected]> wrote:
>
>
>
>
>
>
>
> > Without resorting to shaders or very complex scene composition that's
> > the only way to do it.
>
> > Richard
>
> > On 9 February 2012 03:16, Philippe <[email protected]> wrote:
>
> > > Is this the best way to do it ?
>
> > > class MySprite(Sprite):
>
> > > def __init__(self):
> > > super(MySprite, self ).__init__('my_sprite.png')
> > > self.gap = 100
>
> > > def draw(self):
> > > pyglet.gl.glScissor(self.x-self.width/2, self.y-self.height/2,
> > > self.width - self.gap, self.height)
> > > pyglet.gl.glEnable(pyglet.gl.GL_SCISSOR_TEST)
> > > super(MySprite, self ).draw()
> > > pyglet.gl.glDisable(pyglet.gl.GL_SCISSOR_TEST)
>
> > > On 7 fév, 10:04, Philippe <[email protected]> wrote:
> > >> Hello,
>
> > >> Is there a way to clip a cocos2d Sprite ? (or mask, same thing, but
> > >> different word).
>
> > >> thank you,
> > >> Philippe
>
> > > --
> > > 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
> > > athttp://groups.google.com/group/cocos-discuss?hl=en.
--
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.