예제 #1
0
파일: ri_sim.c 프로젝트: HIPERFIT/mlkit
void draw_histogram(int from_idx, int to_idx) {
  int i, y;
  char tmp_text[200];

  // Draw everything if scaling has changed.
  if (old_scaling != scaling) {
    from_idx = 0;
    to_idx = region_stack_idx;
  }
    
  // Draw regions as horizontal lines.
  for (i=from_idx;i<=to_idx;i=i+1) {
    y = 160-(int)(90.0*region_stat[i]/scaling);
    if (y<70) {
	StrPrintF(tmp_text, "scaling with y=%i, region_sta[i]=%lu and scaling %lu",y, region_stat[i],(UInt32)scaling);
	panic(tmp_text);
    }
    if (i == max_reg_idx)
      WinDrawLine (i*2, y, i*2, 159);
    else
      WinDrawGrayLine (i*2, y, i*2, 159);
    WinEraseLine(i*2, 70, i*2, y-1);
  }
  if (old_max_reg_idx != max_reg_idx) {
    // Draw old max idx
    y = 160-(90*region_stat[old_max_reg_idx]/scaling);
    WinDrawGrayLine (old_max_reg_idx*2, y, old_max_reg_idx*2, 159);
    WinEraseLine(old_max_reg_idx*2, 70, old_max_reg_idx*2, y-1);
    // Draw new max idx
    y = 160-(90*region_stat[max_reg_idx]/scaling);
    WinDrawLine (max_reg_idx*2, y, max_reg_idx*2, 159);
    WinEraseLine(max_reg_idx*2, 70, max_reg_idx*2, y-1);
  }
}
예제 #2
0
파일: draw.c 프로젝트: 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 ) */

}
예제 #3
0
파일: xfer.c 프로젝트: jemyzhang/DiddleBug
/*
** DrawXferDoneButton
*/
void DrawXferDoneButton(DynamicButtonType* btn) {
  WinHandle oldH = WinSetDrawWindow(btn->content.bmpW);
  Int16 bitmapID = 0;
  const IndexedColorType oldCol = WinSetBackColor(0); /* otherwise the pixels will not count as "off" */

  if (((p.flags&PFLAGS_XFER_GOTO) || xferGotoIsAlways) && !(xferGotoIsNever))
    bitmapID = XferDoneGotoBitmap;
  else
    bitmapID = XferDoneBitmap;
  DrawBitmap(bitmapID, 0, 0);
  
  if (p.flags&PFLAGS_XFER_DELETE)
    WinEraseLine(12, 2, 12, 10);
  if ((d.xfer.complete || xferCompleteIsAlways) && !(xferCompleteIsNever))
    WinEraseLine(10, 7, 15, 7);
  if (d.linker_available && p.flags & PFLAGS_XFER_BACKLINK)
    WinEraseLine(9, 2, 9, 10);

  /* Restore old draw window & state */
  WinSetDrawWindow(oldH);
  WinSetBackColor(oldCol);
}
예제 #4
0
파일: draw.c 프로젝트: docwhat/cwimp
void CrossCube(Int die)
{
  Int yoff, xoff;
  
  yoff = CubesTop + (CubeSize + CubeShift) * die;
  xoff = CubesLeft;

  if( die == 0 ) {
    WinEraseLine( 3  +xoff, 4  +yoff,
                  15 +xoff, 16 +yoff);
    WinEraseLine( 3  +xoff, 3  +yoff,
                  16 +xoff, 16 +yoff);
    WinEraseLine( 4  +xoff, 3  +yoff,
                  16 +xoff, 15 +yoff);
  
    WinEraseLine( 3  +xoff, 15 +yoff,
                  15 +xoff, 3  +yoff);
    WinEraseLine( 3  +xoff, 16 +yoff,
                  16 +xoff, 3  +yoff);
    WinEraseLine( 4  +xoff, 16 +yoff,
                  16 +xoff, 4  +yoff);
  } else {

    WinDrawLine( 3  +xoff, 4  +yoff,
                 15 +xoff, 16 +yoff);
    WinDrawLine( 3  +xoff, 3  +yoff,
                 16 +xoff, 16 +yoff);
    WinDrawLine( 4  +xoff, 3  +yoff,
                 16 +xoff, 15 +yoff);
  
    WinDrawLine( 3  +xoff, 15 +yoff,
                 15 +xoff, 3  +yoff);
    WinDrawLine( 3  +xoff, 16 +yoff,
                 16 +xoff, 3  +yoff);
    WinDrawLine( 4  +xoff, 16 +yoff,
                 16 +xoff, 4  +yoff);
  }

}
예제 #5
0
void WinEraseLineF(Coord x1, Coord y1, Coord x2, Coord y2)
{
   WinEraseLine(x1,y1,x2,y2);
}
예제 #6
0
void eraseRectangleSafe(int sx, int sy, int w, int h) // x,y,width,height
{
   int y,x;
   for(y=sy,x=sx;y<sy+h;y++)
       WinEraseLine(x,y,x+w,y);
}