コード例 #1
0
ファイル: msdisplay.c プロジェクト: SWI-Prolog/packages-xpce
void
ws_draw_in_display(DisplayObj d, Graphical gr, BoolObj invert, BoolObj subtoo)
{ d_screen(d);
  if ( invert == ON ) r_invert_mode(ON);
  if ( subtoo == ON ) r_subwindow_mode(ON);
  RedrawArea(gr, gr->area);
  r_invert_mode(OFF);
  r_subwindow_mode(OFF);
  d_done();
}
コード例 #2
0
void Interface::Radar::Redraw(void)
{
    const Settings & conf = Settings::Get();

    if(!hide)
    {
	RedrawArea(Players::FriendColors());
	RedrawCursor();
    }
    else
    if(!conf.ExtGameHideInterface() || conf.ShowRadar())
	AGG::GetICN((conf.ExtGameEvilInterface() ? ICN::HEROLOGE : ICN::HEROLOGO), 0).Blit(x, y);

    // redraw border
    if(conf.ExtGameHideInterface() && conf.ShowRadar())
    {
	border.Redraw();
    }
}
コード例 #3
0
ファイル: CaseConversion.c プロジェクト: amiga-mui/texteditor
/// MangleCharacters()
static void MangleCharacters(struct InstData *data, char (*change)(char c))
{
  LONG startx;
  LONG stopx;
  LONG _startx;
  struct line_node *startline;
  struct line_node *stopline;
  struct line_node *_startline;
  struct marking newblock;

  ENTER();

  if(Enabled(data))
  {
    NiceBlock(&data->blockinfo, &newblock);
    startx    = newblock.startx;
    stopx     = newblock.stopx;
    startline = newblock.startline;
    stopline  = newblock.stopline;
  }
  else
  {
    startx    = data->CPos_X;
    stopx     = startx+1;
    startline = data->actualline;
    stopline  = startline;

    newblock.enabled   = FALSE;
    newblock.startline = startline;
    newblock.stopline  = stopline;
    newblock.startx    = startx;
    newblock.stopx     = stopx;
  }

  AddToUndoBuffer(data, ET_DELETEBLOCK, &newblock);
  AddToUndoBuffer(data, ET_PASTEBLOCK, &newblock);

  _startx = startx;
  _startline = startline;

  while(startline != GetNextLine(stopline))
  {
    while(startline->line.Contents[startx] != '\n')
    {
      if(startx == stopx && startline == stopline)
        break;

      startline->line.Contents[startx] = change(startline->line.Contents[startx]);

      startx++;
    }
    startx = 0;
    startline = GetNextLine(startline);
  }

  data->HasChanged = TRUE;
  data->ChangeEvent = TRUE;
  RedrawArea(data, _startx, _startline, stopx, stopline);

  LEAVE();
}
コード例 #4
0
void quadrupedClass::Move(HWND Wnd){
	RECT window;
	RECT collision = RedrawArea(true);
	bool needToReverse = false;
	bool bounced = false;
	GetClientRect(Wnd, &window);//get the current window size.
	if (iDirection != STOP){
		if (iDirection & DOWN){
			Head.top += iMoveSpeed;
			Head.bottom += iMoveSpeed;
			Back.Start.y += iMoveSpeed;
			Back.End.y += iMoveSpeed;
			LegFB.Start = Back.Start;
			LegFF.Start = Back.Start;
			LegBB.Start = Back.End;
			LegBF.Start = Back.End;
			LegFB.End.y += iMoveSpeed;
			LegFF.End.y += iMoveSpeed;
			LegBB.End.y += iMoveSpeed;
			LegBF.End.y += iMoveSpeed;
		}
		if (iDirection & UP){
			Head.top -= iMoveSpeed;
			Head.bottom -= iMoveSpeed;
			Back.Start.y -= iMoveSpeed;
			Back.End.y -= iMoveSpeed;
			LegFB.Start = Back.Start;
			LegFF.Start = Back.Start;
			LegBB.Start = Back.End;
			LegBF.Start = Back.End;
			LegFB.End.y -= iMoveSpeed;
			LegFF.End.y -= iMoveSpeed;
			LegBB.End.y -= iMoveSpeed;
			LegBF.End.y -= iMoveSpeed;
		}
		if (iDirection & RIGHT){
			Head.left += iMoveSpeed;
			Head.right += iMoveSpeed;
			Back.Start.x += iMoveSpeed;
			Back.End.x += iMoveSpeed;
			LegFB.Start = Back.Start;
			LegFF.Start = Back.Start;
			LegBB.Start = Back.End;
			LegBF.Start = Back.End;
			LegFB.End.x += iMoveSpeed;
			LegFF.End.x += iMoveSpeed;
			LegBB.End.x += iMoveSpeed;
			LegBF.End.x += iMoveSpeed;
		}
		if (iDirection & LEFT){
			Head.left -= iMoveSpeed;
			Head.right -= iMoveSpeed;
			Back.Start.x -= iMoveSpeed;
			Back.End.x -= iMoveSpeed;
			LegFB.Start = Back.Start;
			LegFF.Start = Back.Start;
			LegBB.Start = Back.End;
			LegBF.Start = Back.End;
			LegFB.End.x -= iMoveSpeed;
			LegFF.End.x -= iMoveSpeed;
			LegBB.End.x -= iMoveSpeed;
			LegBF.End.x -= iMoveSpeed;
		}
		//if changing directions:
		if ((collision.right >= window.right)){
			if (iDirection & RIGHT){
				iDirection ^= RIGHT;//stop going right
				iDirection |= LEFT;//start going left
			}
			
			int difference = collision.right - window.right;
			Head.left -= difference + 1;
			Head.right -= difference + 1;
			Back.Start.x -= difference + 1;
			Back.End.x -= difference + 1;
			LegFB.Start = Back.Start;
			LegFF.Start = Back.Start;
			LegBB.Start = Back.End;
			LegBF.Start = Back.End;
			LegFB.End.x -= difference + 1;
			LegFF.End.x -= difference + 1;
			LegBB.End.x -= difference + 1;
			LegBF.End.x -= difference + 1;
			//set the position to a reasonable one so it can't double-trigger
			needToReverse = true;
			bounced = true;
		}
		if (collision.left <= window.left){
			if (iDirection & LEFT){
				iDirection ^= LEFT;//stop going right
				iDirection |= RIGHT;//start going left
			}

			int difference = window.left - collision.left;
			Head.left += difference + 1;
			Head.right += difference + 1;
			Back.Start.x += difference + 1;
			Back.End.x += difference + 1;
			LegFB.Start = Back.Start;
			LegFF.Start = Back.Start;
			LegBB.Start = Back.End;
			LegBF.Start = Back.End;
			LegFB.End.x += difference + 1;
			LegFF.End.x += difference + 1;
			LegBB.End.x += difference + 1;
			LegBF.End.x += difference + 1;
			needToReverse = true;
			bounced = true;
		}
		if ((collision.bottom >= window.bottom)){
			if (iDirection & DOWN){
				iDirection ^= DOWN;//stop going down
				iDirection |= UP;//start going up
			}

			int difference = collision.bottom - window.bottom;
			Head.top -= difference + 1;
			Head.bottom -= difference + 1;
			Back.Start.y -= difference + 1;
			Back.End.y -= difference + 1;
			LegFB.Start = Back.Start;
			LegFF.Start = Back.Start;
			LegBB.Start = Back.End;
			LegBF.Start = Back.End;
			LegFB.End.y -= difference + 1;
			LegFF.End.y -= difference + 1;
			LegBB.End.y -= difference + 1;
			LegBF.End.y -= difference + 1;
			//set the position to a reasonable one so it can't double-trigger
			bounced = true;
		}
		if ((collision.top <= window.top)){
			if (iDirection & UP){
				iDirection ^= UP;//stop going up
				iDirection |= DOWN;//start going down
			}

			int difference = window.top - collision.top;
			Head.top += difference + 1;
			Head.bottom += difference + 1;
			Back.Start.y += difference + 1;
			Back.End.y += difference + 1;
			LegFB.Start = Back.Start;
			LegFF.Start = Back.Start;
			LegBB.Start = Back.End;
			LegBF.Start = Back.End;
			LegFB.End.y += difference + 1;
			LegFF.End.y += difference + 1;
			LegBB.End.y += difference + 1;
			LegBF.End.y += difference + 1;
			//set the position to a reasonable one so it can't double-trigger
			bounced = true;
		}
		if (needToReverse){
			if (iDirection & LEFT){
				Head.left = Back.End.x - iHeadRadius;
				Head.right = Back.End.x + iHeadRadius;
			}
			else{
				Head.left = Back.Start.x - iHeadRadius;
				Head.right = Back.Start.x + iHeadRadius;
			}
		}
		if (bounced){
			InvalidateRect(Wnd, NULL, true);//just redraw the whole screen. -will probably cause a single loop of recursion, but a single loop won't hurt.
		}

		//do animation
		LegFF = AnimateLimb(LegFF);
		LegFB = AnimateLimb(LegFB);
		LegBF = AnimateLimb(LegBF);
		LegBB = AnimateLimb(LegBB);

	}//this entire block only runs if iDirection != 0

}
コード例 #5
0
ファイル: arc.c プロジェクト: lamby/pkg-swi-prolog
static status
RedrawAreaArc(Arc a, Area area)
{ int x, y, w, h;
  int aw = valInt(a->size->w);
  int ah = valInt(a->size->h);
  int sx, sy, ex, ey;
  int cx, cy;

  initialiseDeviceGraphical(a, &x, &y, &w, &h);

  points_arc(a, &sx, &sy, &ex, &ey);
  cx = valInt(a->position->x);
  cy = valInt(a->position->y);

  r_thickness(valInt(a->pen));
  r_dash(a->texture);

#ifndef WIN32_GRAPHICS
  r_arcmode(a->close == NAME_none ? NAME_pieSlice : a->close);
  r_arc(valInt(a->position->x) - aw, valInt(a->position->y) - ah,
	2*aw, 2*ah,
	rfloat(valReal(a->start_angle)*64.0), rfloat(valReal(a->size_angle)*64.0),
	a->fill_pattern);

  if ( a->close != NAME_none && a->pen != ZERO )
  { if ( a->close == NAME_chord )
    { r_line(sx, sy, ex, ey);
    } else /* if ( a->close == NAME_pieSlice ) */
    { r_line(cx, cy, sx, sy);
      r_line(cx, cy, ex, ey);
    }
  }

#else /*WIN32_GRAPHICS*/

{ int ax, ay, bx, by;
  double sa = valReal(a->size_angle);
  int large;

  if ( sa >= 0.0 )
  { ax = sx, ay = sy, bx = ex, by = ey;
    large = (sa >= 180.0);
  } else
  { ax = ex, ay = ey, bx = sx, by = sy;
    large = (sa <= -180.0);
  }

  r_msarc(valInt(a->position->x) - aw, valInt(a->position->y) - ah,
	  2*aw, 2*ah,
	  ax, ay, bx, by, large,
	  a->close, a->fill_pattern);
}

#endif /* __WINDOWS__ */

  if (notNil(a->first_arrow))
  { Any av[4];

    av[0] = toInt(sx);
    av[1] = toInt(sy);

    if ( valReal(a->size_angle) >= 0.0 )
    { av[2] = toInt(sx+(sy-cy));
      av[3] = toInt(sy-(sx-cx));
    } else
    { av[2] = toInt(sx-(sy-cy));
      av[3] = toInt(sy+(sx-cx));
    }

    if ( qadSendv(a->first_arrow, NAME_points, 4, av) )
    { assign(a->first_arrow, displayed, ON);
      ComputeGraphical(a->first_arrow);
      RedrawArea(a->first_arrow, area);
    }
  }
  if (notNil(a->second_arrow))
  { Any av[4];

    av[0] = toInt(ex);
    av[1] = toInt(ey);

    if ( valReal(a->size_angle) >= 0.0 )
    { av[2] = toInt(ex-(ey-cy));
      av[3] = toInt(ey+(ex-cx));
    } else
    { av[2] = toInt(ex+(ey-cy));
      av[3] = toInt(ey-(ex-cx));
    }

    if ( qadSendv(a->second_arrow, NAME_points, 4, av) )
    { assign(a->second_arrow, displayed, ON);
      ComputeGraphical(a->second_arrow);
      RedrawArea(a->second_arrow, area);
    }
  }

  return RedrawAreaGraphical(a, area);
}