Hi everybody!
I'm trying to draw a tiled ground, but I want it to be a circle of radius r. So, I first drew a square with sides of 2*r of length, and then I applied a stencil of a circle of radius r with the same center of the square, and everything worked very well.
My problem is this: what can I do if I want, let's say, a circular sector of the circle with inside the tiled ground, what can I do?
With stencils, if I add a triangle in the stencil function (with already the circle), I get the union of the shapes, but what if I want the intersection of them?
Is that possibile with stencils? Or maybe I have to study the canvases to achieve this?
Thanks for the help!
[SOLVED] Using intersection of stencils
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- msilvestro
- Prole
- Posts: 29
- Joined: Tue Feb 25, 2014 11:15 pm
- Location: Italy
- Contact:
[SOLVED] Using intersection of stencils
- Attachments
-
stencil.love
- (3.01 KiB) Downloaded 57 times
Last edited by msilvestro on Wed Mar 05, 2014 10:44 pm, edited 1 time in total.
Re: Using intersection of stencils
Did you try setting a stencil while drawing a stencil?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
- msilvestro
- Prole
- Posts: 29
- Joined: Tue Feb 25, 2014 11:15 pm
- Location: Italy
- Contact:
Re: Using intersection of stencils
Do you mean something like this?Nixola wrote:Did you try setting a stencil while drawing a stencil?
Code: Select all
triangle = function()
love.graphics.polygon("fill", xc, yc, 0, 600, 300, 0)
end
groundCircle = function()
love.graphics.setStencil(triangle)
love.graphics.circle("fill", xc, yc, r, 100)
love.graphics.setStencil()
end
Re: Using intersection of stencils
You can draw a circular sector with love.graphics.arc. And if you need a more complicated shape you can always make a polygon of the shape and use this as a stencil.
Check out my blog on gamedev
- msilvestro
- Prole
- Posts: 29
- Joined: Tue Feb 25, 2014 11:15 pm
- Location: Italy
- Contact:
Re: Using intersection of stencils
Oh thanks, I didn't remembered there was such a function!micha wrote:You can draw a circular sector with love.graphics.arc. And if you need a more complicated shape you can always make a polygon of the shape and use this as a stencil.
![I'M SO HAPPY I COULD SHIT A RAINBOW RIGHT NOW :awesome:](./images/smilies/ms-awesome.png)
Who is online
Users browsing this forum: No registered users and 3 guests