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 - Regarding "hookhard(1)" to intercept hard keys

Regarding "hookhard(1)" to intercept hard keys

Postby naichang on Thu Jul 18, 2002 4:50 pm

Hi,

I was trying a program using "hookhard" build-in function to intercept an hard key (such as address button, etc.) pressed.
But, when I pressed "to do" button after executed the program, I got an "Virtual Machine Error" alert and it says "Addr:123 stack ref out of range."

The program is listed as follows,

//fly
//moves ship around screen
//Andy Harris, 04/08/01

#include "shipLib.h"
#include "events.h"

deltaV();
moveShip();

int dir = NORTH;
int x=70;
int y=70;
int dx, dy;

main(){
int evt;
int keepGoing=TRUE;


setupShip();
graph_on();
clearg();
title("Fly Ship");

hookhard(1);

while (keepGoing == TRUE){
evt = event(50);
switch(evt){
case EVT_BTN_ADD:
dir--;
if (dir < NORTH){
dir = NORTHWEST;
} //end if
break;
case EVT_BTN_TODO:
dir++;
if (dir > NORTHWEST){
dir = NORTH;
} // end if
break;
case EVT_BTN_MEMO:
keepGoing = FALSE;
case EVT_PAGE_DN:
deltaV();
} // end switch

moveShip();

} // end while

} // end main

deltaV(){

//change the velocity
switch (dir){
case NORTH:
dy--;
break;
case NORTHEAST:
dx++;
dy--;
break;
case EAST:
dx++;
break;
case SOUTHEAST:
dy++;
dx++;
break;
case SOUTH:
dy++;
break;
case SOUTHWEST:
dy++;
dx--;
break;
case WEST:
dx--;
break;
case NORTHWEST:
dy--;
dx--;
break;
} // end dir switch

} // end deltaV

moveShip(){

x = x + dx;
y = y + dy;

//check bounds
if (x > 160){
x = 0;
} // end if

if (x < 0){
x = 160;
} // end if

if (y > 160){
y = 0;
} // end if

if (y < 0){
y = 160;
} // end if

//erase prev. Ship
clearg();
//draw the ship
bitmap(x, y, ship[dir]);

} // end moveship


Someone could help me?
Thanks

Justin Liu
naichang
 
Posts: 3
Joined: Thu Jul 18, 2002 4:36 pm
Location: Canada

Return to PocketC for Palm OS KB

Who is online

Users browsing this forum: No registered users and 1 guest

cron