Using Love's engine in different way

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
Garan
Prole
Posts: 17
Joined: Tue May 01, 2012 2:37 am

Using Love's engine in different way

Post by Garan »

I've grown extremely appreciative of the graphics library that Love has. I was wondering if it were possible to use the engine with just the graphics library (and then just be able to call a graphics update when I need it without overcomplicated program flow). I feel rather limited by how it's structured (with the three different sectioned functions) and would rather be able to structure it in my own way.
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: Using Love's engine in different way

Post by Azhukar »

Garan wrote:I've grown extremely appreciative of the graphics library that Love has. I was wondering if it were possible to use the engine with just the graphics library (and then just be able to call a graphics update when I need it without overcomplicated program flow). I feel rather limited by how it's structured (with the three different sectioned functions) and would rather be able to structure it in my own way.
Take a look at https://love2d.org/wiki/love.run , love.graphics.clear and love.graphics.present.

Use https://love2d.org/wiki/conf.lua to disable other modules.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Using Love's engine in different way

Post by Lafolie »

You can define your own love.run to easily achieve this. I'm not sure why you'd want to do that though, especially if you're using Löve for game development. The way it works right now is quite semantic and logical.

Could you share with us your ideal way that it should be handled? (e.g. your own love.run function)
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
User avatar
Garan
Prole
Posts: 17
Joined: Tue May 01, 2012 2:37 am

Re: Using Love's engine in different way

Post by Garan »

I am trying to make something turn-based. I figured that it would be much easier if I could control when I refresh the screen (this would also make things like menus easier to display). Also, can I alter love.draw to be able to be overloaded (or at least be called with another parameter)?
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Using Love's engine in different way

Post by Boolsheet »

Keep in mind that you are at the mercy of the OS window manager if you don't redraw frequently. It's not a problem if the window stays on top of everything, but if another window temporarily obscures it, the window manager may assume that you're going to redraw the part that was covered. If you don't, it may contain garbage. Some operating systems push an event for this, but that's not exposed in LÖVE (or SDL). The behaviour is also different for every OS.

You can handle it properly by using a Canvas as your screen. You only have to clear and redraw the Canvas if there was a change, but can draw it to the screen continuously so the window stays updated.

There's no such thing as overloading in Lua (all functions are anonymous) but yes, if you use your own modified love.run, you can pass to love.draw whatever you want.
Shallow indentations.
Post Reply

Who is online

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