Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1162 → Rev 1349

/demos/trunk/astro/astro.c
3,9 → 3,6
*
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
*
* Authors : Paolo Gai <pj@hartik.sssup.it>
* (see authors.txt for full list of hartik's authors)
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
*
* http://www.sssup.it
13,25 → 10,6
* http://shark.sssup.it
*/
 
/*
* Copyright (C) 2000 Paolo Gai
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
#include "asteroid.h"
 
int nshot; /* number of shot active */
395,7 → 373,7
soft_task_def_usemath(ms);
pid = task_create("Astro", astro, &ms, NULL);
if (pid == NIL) {
grx_close();
FB26_close(FRAME_BUFFER_DEVICE);
perror("Could not create task <astro>");
sys_end();
} else
408,7 → 386,7
hard_task_def_usemath(mp);
pid = task_create("Taken", look, &mp, NULL);
if (pid == NIL) {
grx_close();
FB26_close(FRAME_BUFFER_DEVICE);
perror("Could not create task <Taken>");
sys_end();
} else
424,7 → 402,7
hard_task_def_usemath(mp);
pid_TL = task_create("TurnLeft", turn, &mp, NULL);
if (pid_TL == NIL) {
grx_close();
FB26_close(FRAME_BUFFER_DEVICE);
perror("Could not create task <Turn L>");
sys_end();
}
439,7 → 417,7
hard_task_def_usemath(mp);
pid_TR = task_create("TurnRight", turn, &mp, NULL);
if (pid_TR == NIL) {
grx_close();
FB26_close(FRAME_BUFFER_DEVICE);
perror("Could not create task <Turn R>");
sys_end();
}
454,7 → 432,7
hard_task_def_usemath(mp);
pid_SU = task_create("SpeedUP", speed, &mp, NULL);
if (pid_SU == NIL) {
grx_close();
FB26_close(FRAME_BUFFER_DEVICE);
perror("Could not create task <Speed UP>");
sys_end();
}
469,7 → 447,7
hard_task_def_usemath(mp);
pid_SD = task_create("SpeedDOWN", speed, &mp, NULL);
if (pid_SD == NIL) {
grx_close();
FB26_close(FRAME_BUFFER_DEVICE);
perror("Could not create task <Speed DOWN>");
sys_end();
}
484,7 → 462,7
hard_task_def_usemath(mp);
pid_SZ = task_create("SpeedZERO", speed, &mp, NULL);
if (pid_SZ == NIL) {
grx_close();
FB26_close(FRAME_BUFFER_DEVICE);
perror("Could not create task <Speed ZERO>");
sys_end();
}
496,7 → 474,7
hard_task_def_usemath(mp);
pid = task_create("MoveAstro", move, &mp, NULL);
if (pid == NIL) {
grx_close();
FB26_close(FRAME_BUFFER_DEVICE);
perror("Could not create task <MoveAstro>");
sys_end();
} else
513,7 → 491,7
hard_task_def_usemath(mp);
pid_FL = task_create("FlipAstro", turn, &mp, NULL);
if (pid_FL == NIL) {
grx_close();
FB26_close(FRAME_BUFFER_DEVICE);
perror("Could not create task <Flip Astro>");
sys_end();
}
549,43 → 527,51
k.flag = 0;
k.scan = KEY_SPC;
k.ascii = ' ';
keyb_hook(k,new_shot);
k.status = KEY_PRESSED;
keyb_hook(k,new_shot,FALSE);
 
k.flag = 0;
k.scan = KEY_O;
k.ascii = 'o';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_P;
k.ascii = 'p';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_S;
k.ascii = 's';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_Z;
k.ascii = 'z';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
#ifdef ASTRO_MOVE
k.flag = 0;
k.scan = KEY_A;
k.ascii = 'a';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_F;
k.ascii = 'f';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
#else
k.flag = 0;
k.scan = KEY_X;
k.ascii = 'x';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
#endif
}