Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - buffer/background problem

buffer/background problem

Postby Mikael on Sat Jan 10, 2004 9:38 pm

When the following app is run on the Emulator or Simulator it works perfectly, but when I try it on my Clie, the object looks as if it is moving underneath the background - instead of on top of it. Am I going wrong somewhere with the buffers?

//Test

library "PToolboxLib"

int ran, x_move, y_move;
int x_pos, y_pos;
int leftOn, rightOn;//animate left and right legs
int done;//animation finished

setup() {
//x,y positions
x_pos = 75;
y_pos = 132;
}

main() {
int i, north=false;//direction of movement

if(!OpenBmpDb("testBmp.prc")) {
alert("Failed to find testBmp.prc!");
return;
}

SetDepth(8);
graph_on();

//Setup buffers
SetDrawBuf(1);
SetDrawBuf(2);
ClearBuf();
FastBmp(0,0,3000);//background
SetDrawBuf(0);//get ready to copy
CopyBuf(0,2);//copy background to buf 0
setup();//x,y values
SetDrawBuf(1); //get ready to draw
ClearBuf();

i=200;
ran = random(1)+1;

leftOn=true;//start with left leg forward

switch(ran) {
case 1: y_move=-1; north=true; break; //move up
}
while(i--) {
done=false;
x_pos = x_pos + x_move;
y_pos = y_pos + y_move;

if(x_pos<5){//keep object on-screen
x_pos=5;
}
if(x_pos>132){
x_pos=132;
}
if(y_pos<4){
y_pos=4;
}
if(y_pos>132){
y_pos=132;
}

//Copy background to main display
CopyBuf(1,2);
//Draw
sleep(10);

if(north==true && leftOn==true && done==false){
TransBmp(x_pos,y_pos,1,1);//move cat's left leg
leftOn=false; rightOn=done=true;
}
if(north==true && rightOn==true && done==false){
rightOn=false; leftOn=done=true;
TransBmp(x_pos,y_pos,2,2);//moves cat's right leg
}
sleep(10);
CopyBuf(0,1); //copy buf 1 to screen for display

}//end while
north=false;
event(1);
graph_off();
SetDepth(0);
}

Thanks in advance,

Mikael
Mikael
 
Posts: 156
Joined: Sun Apr 13, 2003 9:19 am
Location: Denmark

Postby jstadolnik on Sun Jan 11, 2004 12:21 am

Are your masking bitmaps used with TransBmp() all black on white? If not you'll produce a "swimming under" effect.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby Mikael on Sun Jan 11, 2004 8:26 am

No, I'm using a colour background. That's a shame. Is there any way to achieve the same effect with colour? I've tried with FastBmp(), but it is more jerky and seems to run more slowly. I was hoping to at least have a colour background in the finished game to brighten things up a bit.

Thanks Joe,

Mikael
Mikael
 
Posts: 156
Joined: Sun Apr 13, 2003 9:19 am
Location: Denmark

Postby cable_guy_67 on Sun Jan 11, 2004 2:55 pm

Mikael, I believe he was referring the the mask being black and white (2 color). From the PtoolBox docs:
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">int TransBmp(int x, int y, int overlay_index, int mask_index)

"Transparent Bitmap". This function allows the user to mask out a "hole" in the screen and then overlay a bitmap into that "hole". The mask is simply another bitmap resource with all black which defines the "hole". The overlay_index refers to the index of the bitmap to fill in the "hole". The mask_index refers to the index of the bitmap which defines the "hole". See FastBmp() functional description for how indexing with bitmap resource databases works.

If the mask_index is set to -1, no mask will laid down and the overlay bitmap will be placed on top any existing pixels, possibly altering the bitmaps appearance.
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

Mark
cable_guy_67
 
Posts: 92
Joined: Mon Mar 31, 2003 2:28 am
Location: USA

Postby Mikael on Sun Jan 11, 2004 4:52 pm

Sorry, I'm with you now guys. I've just changed to mask to 2 bit and it works fine.

Many thanks,

Mikael :)
Mikael
 
Posts: 156
Joined: Sun Apr 13, 2003 9:19 am
Location: Denmark

Postby cable_guy_67 on Sun Jan 11, 2004 6:47 pm

Glad to help. Just keep those docs handy, PtoolBox has lots of very specific direction in there. ;)

Mark
cable_guy_67
 
Posts: 92
Joined: Mon Mar 31, 2003 2:28 am
Location: USA


Return to PocketC for Palm OS KB

Who is online

Users browsing this forum: No registered users and 1 guest

cron