Exemple #1
0
/*
 * Name      : void main()
 *
 * Parameters: None.
 *
 * Returns   : void
 *
 * Purpose   : The mainline of the interaction demo.
 */
int main() 
{
    /*
     * Open the main viewing window.
     */
    vOpenWindow();

    /*
     * Perform main event loop.
     */
    vEventLoop();
    return 1;
}
Exemple #2
0
/*
OK w95
 */
void mainEventLoop() {

   short     sVal, sXCurrent, sYCurrent;
   long      lDevice;
	int		i=0;
	int 	state = FALSE;
    short attached = 1;
    short value;
    int dev;
    int pupval;

  // make_all();
	//init_menu();

   nCurrentDir = DIR_NONE;

   czclear(0x404040, getgdesc(GD_ZMAX));

   while (TRUE) {

      if (qtest()) {
         lDevice = qread(&sVal);

         switch (lDevice) {

			case INPUTCHANGE:
				#ifdef DOFF
					printf(" %d, %d, %d\n", Win_ids[0], Win_ids[1], sVal);
				#endif
				if ( sVal != 0 )
					Input_win = sVal;
				else
					Input_win = -1;
				break;

            case REDRAW:
				if ( sVal == Win_ids[1] && Win_ids[1] != -1 )
					vDrawHelpScene();
				else if ( sVal == Win_ids[0] )
				{
               		reshapeviewport();
               		getsize(&nWinWidth, &nWinHeight);
               		getorigin(&nXWinOrigin, &nYWinOrigin);
				}
               break;

            case RIGHTMOUSE:
               pupval = dopup(mainmenu);
               break;
  
			case SPACEKEY:
				state = TRUE;
				i++;
				if ( i == 4 )
					subEventLoop();
				break;

			case RKEY:
				if ( Last_Actions[FIRE] == TRUE )
					vEventLoop(&vDrawTitle);
				break;

         case QKEY:
				if ( Input_win == Win_ids[1] ) 
				{
					winclose(Input_win);
					Win_ids[1] != -1;
				}
				else if ( Input_win == Win_ids[0] )
				{
					winclose(Win_ids[0]);
					if ( Win_ids[1] != -1 )
						winclose(Win_ids[1]);
	               exit(0);
				}
               break;

            default:
               break;
         }
      }
		getdev(DR_NUM_BUT, Devs, Last_Actions);

	  	vDrawTitle(state);
   }
}
Exemple #3
0
/*
 half OK w95
 */
void subEventLoop() 
{
   short     sVal, sXCurrent, sYCurrent;
   long      lDevice;
	float tmp;

   nCurrentDir = DIR_NONE;
   czclear(0x404040, getgdesc(GD_ZMAX));

   strcpy(Message, ReadyMesg);
   vDrawScene();
   qreset();
   while (TRUE) {

      if (qtest()) {
         lDevice = qread(&sVal);

         switch (lDevice)
			{

			case INPUTCHANGE:
				#ifdef DOFF
					printf(" %d, %d, %d\n", Win_ids[0], Win_ids[1], sVal);
				#endif
				if ( sVal != 0 )
					Input_win = sVal;
				else
					Input_win = -1;
				break;

            case REDRAW:
				if ( sVal == Win_ids[1] && Win_ids[1] != -1 )
					vDrawHelpScene();
				else if ( sVal == Win_ids[0] )
				{
					winset(Win_ids[0]);
               		reshapeviewport();
               		getsize(&nWinWidth, &nWinHeight);
               		getorigin(&nXWinOrigin, &nYWinOrigin);
					tmp = Speed;
					Speed = 0.0;
               		vDrawScene();
					Speed = tmp;
				}
            break;

         case RIGHTMOUSE:
               dopup(mainmenu);
               break;
  
			case SPACEKEY:
				if ( EMode == FALSE )
				{
					p1EventLoop();
					strcpy(Message, "");
				}
				if ( EMode == TRUE )    /* game over */
				{
					vDrawOverScene();
				}
				break;

			case RKEY:
				if ( Last_Actions[FIRE] == TRUE )
					vEventLoop((&vDrawScene));
				break;

         case QKEY:
				if ( Input_win == Win_ids[1] ) 
				{
					winclose(Input_win);
					Win_ids[1] != -1;
				}
				else if ( Input_win == Win_ids[0] )
				{
					winclose(Win_ids[0]);
					if ( Win_ids[1] != -1 )
						winclose(Win_ids[1]);
	               exit(0);
				}
				break;

             default:
               break;
         }
      }
	  else
		getdev(DR_NUM_BUT, Devs, Last_Actions);

   }
}