Computer Science Canada [Tutorial] the drawcheck procedure! |
Author: | Mazer [ Wed Jun 11, 2003 7:19 am ] | ||||
Post subject: | [Tutorial] the drawcheck procedure! | ||||
I'd like to start this tutorial by quoting Homer Simpson (the character, not the guy with the marijuana leaf for an avatar ): "Patent pending, patent pending, patent pending." ok, there ya go let's start this. the whole idea behind using the drawcheck procedure is because if you don't and you draw with many processes, chances are you'll get some butt ugly-- make that butt fugly-- results. mainly a whole bunch of flickering. this happens, i suppose, because you are clearing the entire screen after a delay in your main loop that is different from the delay in your process. this means that you could end up drawing something in your process that'll end up on the screen for perhaps 10ms before getting cleared away. that may suck quite a bit. take this for example:
yuck, right? so how do we solve this? well, i suppose we could stop using processes altogether. but no, when i made evasive maneuvers, i had a shitload of processes going and i didn't really want to change it around to use procs instead. so i invented the drawcheck procedure (at least i think i did... i don't recall seeing anything like it before i made it). which works pretty much like this: - make a boolean variable to show if it's okay to draw in a process - set the variable to false right before you View.Update inside your main loop (or put it before you draw in your main loop if you don't have much to draw) - set the variable to true right after you clear the screen. - make all processes wait until it's ok to draw before they actually draw anything.
so it's like this: - the process wants to draw the oval - it calls drawcheck and goes into a loop, constantly checking if drawokay is true - stuff happens in your main loop. if there is enough time between now and when you use View.Update, drawokay is true and if there isn't much time (or if View.Update has already been used), it's set to false - once drawokay is true, the loop is exited, the procedure is complete, and it's back into the process - the process draws to the screen NOTE: the drawcheck concept was invented and copyrighted by Nick Coutsos. Any use of it without the express written consent of the author is very FROWNED UPON. Because let's face it, if someone uses my idea without asking, what can I do about it. Besides, why wouldn't I let you use it?! well, that's about it i guess. questions and comments should of course be posted here. i hope this helps you out. |
Author: | Andy [ Fri Jun 13, 2003 5:02 pm ] |
Post subject: | |
is mr tod ur idol or smoething nick? |
Author: | Mazer [ Sat Jun 14, 2003 9:03 am ] |
Post subject: | |
um... who the fuck is mr. tod? |
Author: | Andy [ Sat Jun 14, 2003 4:09 pm ] |
Post subject: | |
whoa nick, watch the language... pg 13... and mr.tod is our school's history teacher who gets 50% of his resources from the simpsons... |
Author: | PaddyLong [ Sat Jun 14, 2003 4:17 pm ] |
Post subject: | |
dodge_tomahawk wrote: mr.tod is our school's history teacher who gets 50% of his resources from the simpsons...
a sound source of information. |
Author: | Andy [ Sat Jun 14, 2003 4:47 pm ] |
Post subject: | |
its a good show, and u can learn alot about history and politics from it |
Author: | Mazer [ Sat Jun 14, 2003 8:51 pm ] |
Post subject: | |
oh, mr. todd! ah... well, i wouldn't know, because bad things happen to me: i had hamdon for history last year but damn, mr. todd is cool. i went to him for help on studying for my history exam last year and he knew that hamdon was worthless as a teacher so he really helped me out. |
Author: | Andy [ Sun Jun 15, 2003 3:14 pm ] |
Post subject: | |
ya but he's lazy tho, we handed in an assignment in november, and we still didn't get it back |
Author: | PaddyLong [ Sun Jun 15, 2003 3:32 pm ] |
Post subject: | |
lol the funniest was in grade 10 our english teacher looked in the drawer of a filing cabinet and found all these unmarked assignments we did in grade 9 (grade 9 and 10 teachers were different...) |
Author: | Andy [ Sun Jun 15, 2003 7:03 pm ] |
Post subject: | |
ya the assignments were asigned in the 1920s unit and now we're in 1970s, i was like "SIR its been 50 freaking years!!! i want my paper back" |