Example #1
0
void checkKeepEupEGame(int shape) // called on every user beep
{
   // flash shape
   flashShape(shape,&WinEraseLineF);
   playFreq(sndCmdFrqOn,keepEupENotes[shape],500); // freq,maxdur

   if (shape == keepEupEShapeList[keepEupEShapeListUserIndex])
      keepEupEShapeListUserIndex++;
   else {
      // TBD: play bad tone
      playLoseTone();
      displayLoseDialog(shape);
      // unflash shape
      flashShape(shape,&WinDrawLineF);
      startKeepEupEGame();
   }
   if (keepEupEShapeListUserIndex >= keepEupEShapeListLast){
      // unflash
      SysTaskDelay((200 * SysTicksPerSecond())/1000);
      flashShape(shape,&WinDrawLineF);
      // pause to break user play from playback
      SysTaskDelay((500 * SysTicksPerSecond())/1000);
      // TBD maybe beep indicating end of playback, start of another
      playKeepEupEGame();
      // add new shape etc...
   }
}
Example #2
0
void checkdialToneGame(int shape) // called on every user beep
{
   playFreq(sndCmdFrqOn,dialToneNotes[shape],500); // freq,maxdur

   playLoseTone();

   SysTaskDelay((200 * SysTicksPerSecond())/1000);
   // pause to break user play from playback
   SysTaskDelay((500 * SysTicksPerSecond())/1000);
   // TBD maybe beep indicating end of playback, start of another
}
Example #3
0
File: draw.c Project: docwhat/cwimp
/* DrawCube -- Draws the cube at the correct place
 * Args:
 *     Byte  die   -- Cube to be rolled and drawn.
 * Returns: None
 */
void DrawCube(Byte die)
{
    int tmpID;
    int y;

    y = CubesTop + (CubeSize + CubeShift) * die;

    // Select correct Bitmap
    if ( die == 0 ) {
        tmpID = bmpBCube[ stor.cube[die].value - 1 ];
    } else {
        tmpID = bmpWCube[ stor.cube[die].value - 1 ];
    }

    if ( stor.cube[die].value == 0 ) {
        tmpID = bmpBlank;
    } else {
        DrawBitmap( bmpBlank, CubesLeft, y );  // Put up the blank tile
#if 0
        SysTaskDelay( 0.15*sysTicksPerSecond); // Delay for cinematic effect
#endif
    }

    DrawBitmap( tmpID, CubesLeft, y );

}
Example #4
0
static void playKeepEupEGame(void)
{
   // add new shape
   keepEupEShapeList[keepEupEShapeListLast] = SysRandom(0) % MAXKEEPEUPESHAPES;
   keepEupEShapeListLast++;

   // check for win
   if (keepEupEShapeListLast>=MAXKEEPEUPES){
      displayWinDialog();
      startKeepEupEGame();
   }
   else{
      int s;
      // play sounds + flash shapes (with delay)
      for(s=0;s<keepEupEShapeListLast;s++){
         flashShape(keepEupEShapeList[s],&WinEraseLineF);
         playFreq(sndCmdFreqDurationAmp/*sndCmdFrqOn*/, // I don't think it does block?, ohhh .. obviously not if sound off!
            keepEupENotes[keepEupEShapeList[s]],300); // TBD: make 300 decrease to go faster

         flashShape(keepEupEShapeList[s],&WinDrawLineF);
         // pause to break each shape apart (in case same shape important)
         SysTaskDelay((200 * SysTicksPerSecond())/1000);

      }
      // put user back to zero
      keepEupEShapeListUserIndex=0;
   }
}
Example #5
0
void RunCount(UInt32 start_tik)
{
    UInt32 tik,dtik;
    run=1;
    while(run==1) {
	tik = TimGetTicks();
	dtik = tik - start_tik;
	drawCount(dtik);

	// call this periodically to hold off auto off  
	if (stopWatchPrefs.disableAutoOff) EvtResetAutoOffTimer();

	// delay one tenth of a sec (.09 acksherly to be sly)
	SysTaskDelay((90 * SysTicksPerSecond())/1000);
	// within loop call SysHandleEvent to
	//  give system opportunity to break in? 
	// /opt/palmdev/sdk-5/include/Core/UI/Event.h
	{ 
	    UInt16 err;
	    EventType e;
	    EvtGetEvent(&e, 0);
	    if (! SysHandleEvent (&e))
		if (! MenuHandleEvent (NULL, &e, &err))
		    if (! ApplicationHandleEvent (&e))
			FrmDispatchEvent (&e);
	}
    }

}
Example #6
0
File: draw.c Project: docwhat/cwimp
/*
 * This function is based on the DrawIntro and DrawBlinds
 * functions in Vexed, a Cool GPL Palm Game by
 * "James McCombe" <*****@*****.**>
 * http://spacetube.tsx.org
 */
void
DrawIntro () {
  VoidHand Title_Handle;
  BitmapPtr Title;
  char text[40];
  SWord penx, peny;
  Boolean bstate;

  /* If a game is on, don't do the splash */
  if( stor.currplayer >= 0 ) return;

  // load bitmap resource and get handle
  Title_Handle = DmGet1Resource ('Tbmp', bmpTitle);
  // lock the bitmap resource into memory and get a pointer to it
  Title = MemHandleLock (Title_Handle);

  // draw the bitmap ( 160x160 )
  WinDrawBitmap (Title, 0, 0);

  /* Text Strings */
  StrPrintF (text, IntroVersionString, VERSION);
  WinDrawChars (text, StrLen (text), 5, 6);

  StrPrintF (text, IntroForPalmString, 153);
  WinDrawChars (text, StrLen (text), 52, 50);

  StrPrintF (text, IntroTapHereString, VERSION);
  WinDrawChars (text, StrLen (text), 45, 85);

  // unload the bitmap from memory (unlock)
  MemHandleUnlock (Title_Handle);

  // Loop till screen is tapped
  while (bstate)
    EvtGetPen (&penx, &peny, &bstate);
  while (!bstate)
    EvtGetPen (&penx, &peny, &bstate);

  /* If the user clicked in the drawing area, then
   * do a Draw Blinds and clear the PenQueue.
   */
  if( peny < 160 ) {
    // DrawBlinds
    int i, x;
    float delay;

    EvtFlushPenQueue();

    delay = .01 * SysTicksPerSecond();

    for (i = 0; i < 16; i++) {
      for (x = i; x < 160; x += 16) {
        WinEraseLine( 0,x, 159,x );
      }
      SysTaskDelay(delay);
    }
  } /* if( peny < 160 ) */

}
Example #7
0
void wxSleep(int nSecs)
{
    UInt16 ticks_sec;
    Int32 delay;
    ticks_sec = SysTicksPerSecond ();
    delay = nSecs * ticks_sec;
    if (delay > 0) {
        SysTaskDelay (delay);
    }
}
Example #8
0
void wxMicroSleep(unsigned long microseconds)
{
    UInt16 ticks_sec;
    Int32 delay;
    ticks_sec = SysTicksPerSecond ();
    delay = microseconds * ticks_sec / 1000000;
    if (delay > 0) {
        SysTaskDelay (delay);
    }
}
Example #9
0
static void playdialToneGame(void)
{
      int s;
      // play sounds + flash shapes (with delay)
      for(s=0;s<dialToneShapeListLast;s++){
         playFreq(sndCmdFreqDurationAmp/*sndCmdFrqOn*/, // I don't think it does block?, ohhh .. obviously not if sound off!
            dialToneNotes[dialToneShapeList[s]],300); // TBD: make 300 decrease to go faster

         // pause to break each shape apart (in case same shape important)
         SysTaskDelay((200 * SysTicksPerSecond())/1000);

      }
}
Example #10
0
void
diag (char *fmt, ...)
{
    va_list args;
    char    line[1024];
    va_start (args, fmt);

    vsprintf (line, fmt, args);
    va_end (args);
    WinPaintChars (line, strlen (line), 0, 0);
    DbgMessage (line);
    SysTaskDelay (sysTicksPerSecond/4);
}
Example #11
0
void OSystem_PalmBase::delayMillis(uint msecs) {
	Int32 delay = computeMsecs(msecs);

	if (delay > 0)
		SysTaskDelay(delay);
}
Example #12
0
static int doSleep(unsigned long msecs)
{
  if( SysTaskDelay( ((msecs*sysTicksPerSecond)/1000000)+1 )==0 ) return(0);
  else return(-1);
}
Example #13
0
static void
draw_chars(const char*s,int x,int y)
{if(facunde)WinDrawChars(s,StrLen(s),x,y);
 if(facunde>1)SysTaskDelay(50);
}