Window Updater
#1
Posted 26 June 2016 - 11:37 AM
my OS api handles the taskbar and desktop update, every 0.05 secs this updates the taskbar and desktop nicely, this api also runs the programs started from the taskbar menu and then it all get's transfered to the program it selves this program uses an another api i called it 'frame' it is used to create the basic frame and also handles the exit event to it closes. But the problem is when the desktop and taskbar redraws (desk.redraw() , task.redraw() these are also windows but not using my 'frame' api) , you guessed it , it redraws the desktop and taskbar but the current window disappears.
Can anyone help me with this?
#2
Posted 26 June 2016 - 01:42 PM
If you really need to redraw them at any point, then simply redraw the current window over the top of them when you're done.
#3
Posted 26 June 2016 - 01:53 PM
Bomb Bloke, on 26 June 2016 - 01:42 PM, said:
If you really need to redraw them at any point, then simply redraw the current window over the top of them when you're done.
#4
Posted 26 June 2016 - 02:14 PM
#6
Posted 26 June 2016 - 04:26 PM
#7
Posted 26 June 2016 - 04:53 PM
Lyqyd, on 26 June 2016 - 04:26 PM, said:
if i'm not mistaking yielding and such is from the coroutine API but i'm using parallel
#8
Posted 26 June 2016 - 08:37 PM
laica10, on 26 June 2016 - 04:53 PM, said:
Lyqyd, on 26 June 2016 - 04:26 PM, said:
if i'm not mistaking yielding and such is from the coroutine API but i'm using parallel
Parallel is a wrapper for coroutine, it simply makes it easier to use coroutines instead of having to manage all of the thread's and their states by yourself. Yielding can trigger from a plethora of things such as os.pullEvent(), coroutine.yield(), sleep(), and many other things, however it all boils doing to coroutine.yield(). All of these functions reference coroutine.yield at the end of the day.
#9
Posted 27 June 2016 - 12:55 AM
To elaborate on what Incinirate was saying, os.pullEvent() is a wrapper for coroutine.yield(). When you go to pull an event, your computer's coroutine yields, and ComputerCraft later resumes it again when a relevant event occurs.
Any function that delays, such as sleep(), is simply calling os.pullEvent() for you and waiting for a certain event, such as "timer". That is to say, if you call sleep(), rednet.receive(), turtle.forward(), anything that has a "wait" associated with it, then you are by extension making your coroutine yield.
#10
Posted 27 June 2016 - 08:23 AM
Bomb Bloke, on 27 June 2016 - 12:55 AM, said:
To elaborate on what Incinirate was saying, os.pullEvent() is a wrapper for coroutine.yield(). When you go to pull an event, your computer's coroutine yields, and ComputerCraft later resumes it again when a relevant event occurs.
Any function that delays, such as sleep(), is simply calling os.pullEvent() for you and waiting for a certain event, such as "timer". That is to say, if you call sleep(), rednet.receive(), turtle.forward(), anything that has a "wait" associated with it, then you are by extension making your coroutine yield.
That's great but aren't we a little off topic here ?
My original question was how to update (redraw) a couple of windows and still keeping other windows drawn, because if you'd redraw the desktop environment all other windows would dissapear.
Edited by laica10, 27 June 2016 - 08:24 AM.
#11
Posted 27 June 2016 - 08:54 AM
If you don't like either of those answers, then there's always other options (though they only get worse); the next would be to create your own window API, one which allows partial redraws.
#12
Posted 27 June 2016 - 10:00 AM
Bomb Bloke, on 27 June 2016 - 08:54 AM, said:
If you don't like either of those answers, then there's always other options (though they only get worse); the next would be to create your own window API, one which allows partial redraws.
How would you guys do it if tou had 2 windows in desktop environment (taskbar & desktop) and there are multiple windows dragable. How would you guys do this because if you move a window , the background has to get redrawn right?? otherwise the window will have it's mark there.
#13
Posted 27 June 2016 - 10:51 AM
You can even eliminate flicker by drawing the desktop and application windows through a single "master" window (that is to say, make that one the parent of each of the others); make it invisible while you redraw, then set it back to visible when the buffer contains what you're wanting.
Here's the thread for LyqydOS, by the way. As Lyqyd pointed out, you might pick up some tricks by reading through its source.
#14
Posted 27 June 2016 - 11:52 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users