Questions around love.run
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Questions around love.run
In what order does the engine call the callbacks? update before draw, presumably, but what about mousepressed, focus, etc.? When are these triggered? What if the main thread is in the middle of executing a function? What if the main thread is in the middle of accessing data that is also accessed from the callback?
Last edited by Xii on Sun Aug 16, 2020 10:31 pm, edited 2 times in total.
Re: Order of callbacks?
A similar question was answered.
Callbacks
Update
Draw
So, what ever you do (clicked on the mouse, move it, focus in/out) the data you intend to change there will generally be done first before updating the game. But now that we're at it. I also want to know a more precise order
Is it Window Events->Inputs->Update or is it something else?
Callbacks
Update
Draw
So, what ever you do (clicked on the mouse, move it, focus in/out) the data you intend to change there will generally be done first before updating the game. But now that we're at it. I also want to know a more precise order
Is it Window Events->Inputs->Update or is it something else?
Re: Order of callbacks?
There's probably no difference between "Window events" and "Input". Common sense says user input is processed in the window's message loop just as any other event.
Edit: on a second thought, I'm not sure I understand the question. Maybe you can clarify what you mean?
Edit: on a second thought, I'm not sure I understand the question. Maybe you can clarify what you mean?
Re: Order of callbacks?
Supposed these happened:
1. I clicked on the "Maximize" button. - Does this count as "mousepressed"?
2. Window is Maximized.
I no longer included events like "love.event.quit" because I realized that you usually call them programatically.
Re: Order of callbacks?
Clicking on window borders, titles. and buttons does not generate mouse events. Alt+F4 does not generate key events either (except the keypressed event for the alt key ofc), even if you don't allow the window to close.
Re: Order of callbacks?
Thanks! I'm indicating my question as solved. (I got too used to the "Like" system of Facebook that I didn't see the need to respond to answered questions. My bad. )
Re: Order of callbacks?
Ah yes, I think the whole process is outlined on the wiki at love.run. You can, in fact, specify a custom main loop and order of calls. I like that.
Tangent question: love.graphics.present says it "will halt the program until ready" (when vsync is on). Does it halt all threads in the program or just the main one?
Tangent question: love.graphics.present says it "will halt the program until ready" (when vsync is on). Does it halt all threads in the program or just the main one?
Re: Order of callbacks?
That's more like a completely unrelated question.Xii wrote: ↑Fri Aug 14, 2020 6:22 pm Tangent question: love.graphics.present says it "will halt the program until ready" (when vsync is on). Does it halt all threads in the program or just the main one?
Only the main thread is concerned with rendering, and only the main thread should call present. Other threads don't/can't wait for vsync.
- zorg
- Party member
- Posts: 3444
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Order of callbacks?
Only the main one.
Me and my stuff True 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.
Re: Questions around love.run
love.graphics.present says it "will halt the program until ready if necessary" (emphasis mine).
Supposing that vsync is on, and love.update + love.draw took more time than the screen's refresh rate allows (that is, we missed the vsync), does love.graphics.present halt the program? (until the next vsync)
In what situations will it consider it "necessary" to do so?
Supposing that vsync is on, and love.update + love.draw took more time than the screen's refresh rate allows (that is, we missed the vsync), does love.graphics.present halt the program? (until the next vsync)
In what situations will it consider it "necessary" to do so?
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 208 guests