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 » Sun Sep 20, 2020 5:09 pm

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: 1666
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Creating Custom Drawables?

Post by ivan » Sun Sep 20, 2020 5:14 pm

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 » Sun Sep 20, 2020 5:25 pm

Mh alright...
Thank you anyway!

RNavega
Citizen
Posts: 59
Joined: Sun Aug 16, 2020 1:28 pm

Re: Creating Custom Drawables?

Post by RNavega » Sun Sep 20, 2020 9:22 pm

Hi, what exactly are you trying to do, visually?

User avatar
zorg
Party member
Posts: 3044
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Creating Custom Drawables?

Post by zorg » Mon Sep 21, 2020 3:17 am

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: 1666
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Creating Custom Drawables?

Post by ivan » Mon Sep 21, 2020 4:39 am

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

Post Reply

Who is online

Users browsing this forum: No registered users and 48 guests