Computer Science Canada Animations and Image handling help! |
Author: | Nathan4102 [ Tue Mar 19, 2013 3:16 pm ] | ||
Post subject: | Animations and Image handling help! | ||
What is it you are trying to achieve? An animation without wiping previously printed images. What is the problem you are having? In my animation procedure, I use cls to clear the screen inbetween frames, but that wipes all my other images that I've printed. Describe what you have tried to solve this problem I have tried looking for an alternative for cls that only clears a certain image (The image we are animating) but I haven't found one. I also have a very messy solution, explained below. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) The code for the program is below. Note that the code is very messy, I'll clean it up later. The program does animations in proc ImageInAndOut, but it uses cls to clear the screen in between frames, which wipes other images. This occurs in proc NextSlide, when the animated point is coming across the screen, it wipes the title, WhatIsCPUImage. A messy solution would be to use an array of booleans and a large amount of if statements in my animation procedure, which would check where we are in the program, and display the appropriate images while animating, like I have it doing with the background image at the moment, but thats very messy, and there must be a better way. Thanks so much for whoever helps me! ![]()
Please specify what version of Turing you are using 4.1 |
Author: | Tony [ Tue Mar 19, 2013 3:20 pm ] |
Post subject: | RE:Animations and Image handling help! |
cls is as good as Draw.FillBox(0,0,maxx,maxy,background_colour) If you want to "clear" less area, you can draw a smaller box. Works for some cases, but it's typically simpler to just redraw everything. Read this recent thread on the details, it had the same question -- http://compsci.ca/v3/viewtopic.php?t=33353 |
Author: | Nathan4102 [ Tue Mar 19, 2013 3:41 pm ] | ||
Post subject: | Re: Animations and Image handling help! | ||
Wow, thats awesome, thanks! The only thing is though, that my background isn't just a plain color, its actually an image. Is there any alternative to changing my background to a solid color? This is my new code:
This is what the screen looks like after animations now: http://i0.simplest-image-hosting.net/picture/untitled307.png |
Author: | evildaddy911 [ Tue Mar 19, 2013 5:55 pm ] |
Post subject: | RE:Animations and Image handling help! |
one way would be to draw the background image instead of a rectangle, EDIT: looking at the pictures, go with the first option |