Posted 20 January 2014 - 09:17 PM
So, I'm creating a paint-like program, the one that comes with the game doesn't work well for me.
My problem is, my drawing function is kinda slow in large windows, there isn't much for me to do about that really. My problem is that the event queue get's clogged up when I have too much mouse_drag events. You see, my update function is like that:
(This is inside a while loop)
-Gets event
-Handles event
-Draw window
-Repeat
When the event queue get's clogged up the program runs "in the past". My only solution to make the thing smoother is to check 3 times for events in one update. But the problem is that the program gets stuck if there is no event, then the program only updates when there is 3 events in the queue. My solution to this would be to check if there is more than one event in the queue and then handle them all.
I've found this:
http://www.computercraft.info/forums2/index.php?/topic/13900-oseventcount-the-number-of-events-in-the-queue/
To be fair, I don't know why it wasn't added before. There might be a way to get around this, but why not just have this simple solution to make it work?
I've programmed in Lua before, I'm just kinda new to CC.
My problem is, my drawing function is kinda slow in large windows, there isn't much for me to do about that really. My problem is that the event queue get's clogged up when I have too much mouse_drag events. You see, my update function is like that:
(This is inside a while loop)
-Gets event
-Handles event
-Draw window
-Repeat
When the event queue get's clogged up the program runs "in the past". My only solution to make the thing smoother is to check 3 times for events in one update. But the problem is that the program gets stuck if there is no event, then the program only updates when there is 3 events in the queue. My solution to this would be to check if there is more than one event in the queue and then handle them all.
I've found this:
http://www.computercraft.info/forums2/index.php?/topic/13900-oseventcount-the-number-of-events-in-the-queue/
To be fair, I don't know why it wasn't added before. There might be a way to get around this, but why not just have this simple solution to make it work?
I've programmed in Lua before, I'm just kinda new to CC.