Page 1 of 1

Redraw screen in a single frame

PostPosted: Mon Sep 08, 2008 2:14 pm
by asmodeus
What's about a function that redraws the screen? For example you are using a for or while loop, which takes many seconds, you could show the player the status by drawing a canvas and redraw the screen. In that case the player / creator can see that it is working.

Re: Redraw screen in a single frame

PostPosted: Tue Sep 09, 2008 3:56 pm
by Bee-Ant
You can easily test it by variable and textNumber right???
or...why should you use canvas for this???

Re: Redraw screen in a single frame

PostPosted: Wed Sep 10, 2008 10:03 am
by asmodeus
Bee-Ant wrote:You can easily test it by variable and textNumber right???
or...why should you use canvas for this???

There is a progress, for example loading an external file into the game. It may take time but to let the player show the status, you can draw a bar with a canvas. You can't draw with another actor. You usually read files in a single script, in a loop. When drawing in a loop, it won't be shown there until the script in finished and the player only sees the full bar.

Do you understand what I mean?

Re: Redraw screen in a single frame

PostPosted: Sat Sep 13, 2008 12:23 pm
by Bee-Ant
Oh...something like "loading" progress...
It will show you about the current progress status (commonly in percentage)
Hmmm...I dunno how to put this stuff of canvas. I'm not canvas user

Re: Redraw screen in a single frame

PostPosted: Sat Oct 04, 2008 12:18 am
by feral
You can do this, but you need to break up your "loop", and keep an index of where you are up to, then break out of that script to redraw the screen , then return back to the loop where you left off...

eg: if you are loading a large bitmap the one of the first 54 characters will tell you the size of the file..

so now you can ( in pseudo code)

store a global variable called index=0; //or wherever to start loading file/drawing large bitmap etc
store a global variable called size
and another called percentage=.1; //.1 =10 percent

then open the file, and get the size of the bitmap... for example lets say 500k

now in the loading routine
Code: Select all
if (notloaded==true)
for (i=index;i<percentage*size) //do to 10 percent of size (from 0 to 50k)

{
//loading code here
}
index = i  //current position ( if needed when you came back to this loop)  now at 50k ( if size was 500k)

percent=percent +.1  //add another 10 percent
if (percent=>1)
(
notloaded =false
)


now in your view routine, or an actor for your fileprogress bar

Code: Select all
if (notloaded==true)
{
//update progress bar here
)


then you can return to the file loading until complete
eg:
Code: Select all
for (i=index;i<percentage*size) //do another 10 percent of size (this time from from 50 to 100k)


or something like that :)

feral (sorry haven't been around much)

Re: Redraw screen in a single frame

PostPosted: Sun Oct 05, 2008 7:41 am
by smallville
this would be useful, because my games NEED LOADSCREENS! in one of my games, when you start it
it freezes itself for about 4 seconds as if it was loading the game...i tried to add a screen to it saying "loading.."
and putting a timer on it but, that didn't work my vote is for YES!

Re: Redraw screen in a single frame

PostPosted: Tue Oct 07, 2008 8:58 am
by Bee-Ant
Wow cool...
Oh yah, what if in normal actor??? :mrgreen: