tixiv
16 years ago
5 changed files with 49 additions and 2 deletions
@ -0,0 +1,6 @@ |
|||
#include "joystick.h" |
|||
|
|||
// fake function since our keybord doesn't need any initialisation
|
|||
void joy_init() |
|||
{ |
|||
} |
@ -0,0 +1,15 @@ |
|||
#ifndef JOYSTICK_H_ |
|||
#define JOYSTICK_H_ |
|||
|
|||
unsigned char fakeport; |
|||
|
|||
#define JOYISFIRE (0x01 & fakeport) |
|||
#define JOYISLEFT (0x02 & fakeport) |
|||
#define JOYISRIGHT (0x04 & fakeport) |
|||
#define JOYISDOWN (0x08 & fakeport) |
|||
#define JOYISUP (0x10 & fakeport) |
|||
|
|||
unsigned char waitForFire; |
|||
|
|||
|
|||
#endif /*JOYSTICK_H_*/ |
@ -0,0 +1,26 @@ |
|||
#include <stdlib.h> |
|||
#include <sys/time.h> |
|||
#include <sys/types.h> |
|||
#include <unistd.h> |
|||
#include <setjmp.h> |
|||
#include "joystick.h" |
|||
|
|||
#ifdef _WIN32 |
|||
# include <windows.h> |
|||
#endif |
|||
|
|||
extern jmp_buf newmode_jmpbuf; |
|||
|
|||
void wait(unsigned int ms) { |
|||
if (waitForFire) { |
|||
if (JOYISFIRE) { |
|||
longjmp(newmode_jmpbuf, 43); |
|||
} |
|||
} |
|||
|
|||
#ifdef _WIN32 |
|||
Sleep(ms); |
|||
#else |
|||
usleep(ms*1000); |
|||
#endif |
|||
} |
Loading…
Reference in new issue