该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include #include #include #include
#include
using namespace std;
#defineA_MOVE_LEFT SIGRTMIN+1#define D_MOVE_RIGHTSIGRTMIN+2#define W_MOVE_ARROWSIGRTMIN+3#define S_MOVE_BACKSIGRTMIN+4
void func( int sig );int getPressKey();
void* gameLogic( void* );
int main(){cout<
int getPressKey(){system( "stty raw echo" );int c = getchar();system( "stty cooked echo" );return c;}
void func( int sig ){if( sig == A_MOVE_LEFT )cout<
void* gameLogic( void* ){signal( A_MOVE_LEFT , func );signal( D_MOVE_RIGHT , func );signal( W_MOVE_ARROW , func );signal( S_MOVE_BACK , func );signal( SIGINT , func );while( true ){sleep( 3 );//cout<