Creating Custom Drawables?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Ovidios
Prole
Posts: 29
Joined: Thu Dec 04, 2014 12:00 pm
Location: Berlin, Germay

Creating Custom Drawables?

Post by Ovidios »

Hey!

Is there a way, in a regular LÖVE game, to create a new "Drawable" object, i.e. one that can be drawn using love.graphics.draw?
If so, how would I go about doing that?

Thanks!
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Creating Custom Drawables?

Post by ivan »

Not without rebuilding Love2D. Drawable is a C++ thing so you can't create C++ object from Lua. FFI won't help you in this case.
In theory you could just replace the default love.graphics.draw function with your own but it's ugly and I wouldn't recommend it.
User avatar
Ovidios
Prole
Posts: 29
Joined: Thu Dec 04, 2014 12:00 pm
Location: Berlin, Germay

Re: Creating Custom Drawables?

Post by Ovidios »

Mh alright...
Thank you anyway!
RNavega
Party member
Posts: 355
Joined: Sun Aug 16, 2020 1:28 pm

Re: Creating Custom Drawables?

Post by RNavega »

Hi, what exactly are you trying to do, visually?
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Creating Custom Drawables?

Post by zorg »

If you want different shapes, then there are quite a few ways to make those (Polygons, Meshes); you don't need your own Drawable class.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Creating Custom Drawables?

Post by ivan »

On an unrelated note, it would be cool if "Body" was "Drawable" for debug purposes.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 2 guests