i wrote a crude pong in L5. maybe i still need a better title for this library of Processing API in Lua with Love2d. (any suggestions?)
(music by Hildegard Von Bingen of course)
ok, i'm stopping for the night. the next things to do are to add typography functions, full mouse functions, and color modes, then I think that will be most of the API complete. I will still need to do bug testing.
Tonight I ran up against a problem I couldn't quite solve. I am using @Alexjgriffith suggestion to modify love2d's love.run() game loop and modified the default loop to not clear the screen between draw calls. Unfortunately, when drawing graphics from events (such as keyPressed(), keyTyped() ) the screen flickers, I think because of double drawing. I tried half a dozen different solutions but never quite found a satisfactory one unfortunately.
added frameRate() function.
while working on all this, had a bit of a think. i believe my flickering screen problem is a result of me hacking Love2d to work more like processing/p5. in the processing model, the approach is a synchronous model. draw runs once per frame. if too much processing happens, it slows down/frame rate drops. love2d takes the approach of drawing as many times as needed per game loop. logic is separated out into update(), while drawing is rendered in a separate thread, so game logic doesn't block rendering and realtime logic can be processed. In love2d, the emphasis is on realtime game processes.:
@exquisitecorp afaik, unless i’ve misunderstood your post - love2d does not run update and draw on separate threads. in its vanilla configuration, update is run first, draw second. they're both run in the same (blocking) single thread.
i can confirm that via experience - framerate absolutely can tank due to too many update calls. i had some nasty bad code that was checking 100,000,000 coordinates per frame and brought fps to its knees 😅
@vga256 ah ok, thank you for clarifying that.
oh and i've made good progress! fingers crossed, but everything seems to be rendering across draw and events. now i can't seem to get setup to render correctly, but hopefully only a matter of time. need to do more testing but feeling better.
@exquisitecorp woohoo. glad to hear it!
always a drag when progress gets hung up on a single annoying bug