Example #1
0
void CGUIWindowTestPatternDX::DrawContrastBrightnessPattern(int top, int left, int bottom, int right)
{
  DWORD color;
  DWORD color_white = D3DCOLOR_COLORVALUE(m_white, m_white, m_white, 1.0f);
  DWORD color_black = D3DCOLOR_COLORVALUE(m_black, m_black, m_black, 1.0f);
  float x5p = (float) (left + (0.05f * (right - left)));
  float y5p = (float) (top + (0.05f * (bottom - top)));
  float x12p = (float) (left + (0.125f * (right - left)));
  float y12p = (float) (top + (0.125f * (bottom - top)));
  float x25p = (float) (left + (0.25f * (right - left)));
  float y25p = (float) (top + (0.25f * (bottom - top)));
  float x37p = (float) (left + (0.375f * (right - left)));
  float y37p = (float) (top + (0.375f * (bottom - top)));
  float x50p = (float)(left + (right - left) / 2);
  float y50p = (float)(top + (bottom - top) / 2);
  float x62p = (float) (left + (0.625f * (right - left)));
  float y62p = (float) (top + (0.625f * (bottom - top)));
  float x75p = (float) (left + (0.75f * (right - left)));
  float y75p = (float) (top + (0.75f * (bottom - top)));
  float x87p = (float) (left + (0.875f * (right - left)));
  float y87p = (float) (top + (0.875f * (bottom - top)));
  float x95p = (float) (left + (0.95f * (right - left)));
  float y95p = (float) (top + (0.95f * (bottom - top)));

  m_blinkFrame = (m_blinkFrame + 1) % TEST_PATTERNS_BLINK_CYCLE;

  // draw main quadrants
  DrawRectangle(x50p, (float)top, (float)right, y50p, color_white);
  DrawRectangle((float)left, (float)y50p, x50p, (float)bottom, color_white);

  // draw border lines
  CUSTOMVERTEX vert[] = 
  {
    {(float)left, y5p, 0.5f, 1.0f, color_white},
    {x50p, y5p, 0.5f, 1.0f, color_white},
    {x5p, (float)top, 0.5f, 1.0f, color_white},
    {x5p, y50p, 0.5f, 1.0f, color_white},
    {x50p, y95p, 0.5f, 1.0f, color_white},
    {(float)right, y95p, 0.5f, 1.0f, color_white},
    {x95p, y50p, 0.5f, 1.0f, color_white},
    {x95p, (float)bottom, 0.5f, 1.0f, color_white},

    {x50p, y5p, 0.5f, 1.0f, color_black},
    {(float)right, y5p, 0.5f, 1.0f, color_black},
    {x5p, y50p, 0.5f, 1.0f, color_black},
    {x5p, (float)bottom, 0.5f, 1.0f, color_black},
    {(float)left, y95p, 0.5f, 1.0f, color_black},
    {x50p, y95p, 0.5f, 1.0f, color_black},
    {x95p, (float)top, 0.5f, 1.0f, color_black},
    {x95p, y50p, 0.5f, 1.0f, color_black}
  };
  g_Windowing.Get3DDevice()->SetFVF(D3DFVF_CUSTOMVERTEX);
  g_Windowing.Get3DDevice()->DrawPrimitiveUP(D3DPT_LINELIST, 8, vert, sizeof(CUSTOMVERTEX));

  // draw inner rectangles
  DrawRectangle(x12p, y12p, x37p, y37p, color_white);
  DrawRectangle(x62p, y62p, x87p, y87p, color_white);

  DrawRectangle(x62p, y12p, x87p, y37p, color_black);
  DrawRectangle(x12p, y62p, x37p, y87p, color_black);

  // draw inner circles
  if (m_blinkFrame < TEST_PATTERNS_BLINK_CYCLE / 2)
    color = D3DCOLOR_COLORVALUE(m_black + 0.05f, m_black + 0.05f, m_black + 0.05f, 1.0f);
  else
    color = D3DCOLOR_COLORVALUE(0.0f, 0.0f, 0.0f, 1.0f); // BTB
  DrawCircleEx(x25p, y75p, (y37p - y12p) / 3, color);
  DrawCircleEx(x75p, y25p, (y37p - y12p) / 3, color);

  if (m_blinkFrame < TEST_PATTERNS_BLINK_CYCLE / 2)
    color = D3DCOLOR_COLORVALUE(m_white - 0.05f, m_white - 0.05f, m_white - 0.05f, 1.0f);
  else
    color = D3DCOLOR_COLORVALUE(1.0f, 1.0f, 1.0f, 1.0f); // WTW
  DrawCircleEx(x25p, y25p, (y37p - y12p) / 3, color);
  DrawCircleEx(x75p, y75p, (y37p - y12p) / 3, color);
}
Example #2
0
void CGUIWindowTestPatternDX::DrawCircle(int originX, int originY, int radius)
{
  DrawCircleEx((float)originX, (float)originY, (float)radius, D3DCOLOR_COLORVALUE(m_white, m_white, m_white, 1.0f));
}
Example #3
0
void DrawScrolly(int t)
{
	int xp;
	int yp;
	int i, j;
	float a_dir;
	float v_radius;
	int all_blue = 0;
	SDL_Rect draw_from, draw_to;
	
	int x, y, r;
	
	float bright;
	
	if (t < 795) {
		xp = 8192 - 320 - 3180 + (t * 4);
		yp = t * 20;
	} else {
		xp = 8192 - 320 + ( (t-795) * 10);
		yp = 795 * 20 - (t-795)*10;
	}
	
	// Palette
	
	
	if ((rand() % 10)==9) {
		all_blue = 1;
	}
	for (i = 0; i < 256; i++) {
		bright = sin((float)t / 10.0) * 0.2 + 0.4;
		ending_pal[i].r = (i * bright + (256*(1.0-bright))) * ((float)(all_blue == 0) * 0.5 + 0.5);
		ending_pal[i].g = (i * bright + (256*(1.0-bright))) * ((float)(all_blue == 0) * 0.5 + 0.5);
		ending_pal[i].b = i * bright + (256*(1.0-bright));
	}
	DrawLevel(xp, yp, 0, 0);
	
	v_radius = sin((float)t / 10.0)*20 + 100;
	
	for (i = 0; i < 5; i++) {
		x = rand()%640;
		y = rand()%480;
		r = rand()%500+100;
		
		DrawCircleEx(x, y, r+2, r-4, 128);
		DrawCircleEx(x, y, r, r-2, 255);
	}
	
	for (i = 0; i < 4; i++) {
		draw_from.x = (8 + i) * 32;
		draw_from.y = 0;
		draw_from.w = 32;
		draw_from.h = 32;
		
		a_dir = ((float)t / 10.0) + (M_PI*(float)i/2);
		
		for (j = 10; j >= 0; j--) {
			DrawCircleEx(320+cos(a_dir)*v_radius, 240+sin(a_dir)*v_radius, 22 + j * 2, 0, abs(j-3) * 15);
		}
		DrawCircleEx(320+cos(a_dir)*v_radius, 240+sin(a_dir)*v_radius, 20, 0, 0);
		
		draw_to.x = 320 + cos(a_dir) * v_radius - 16;
		draw_to.y = 240 + sin(a_dir) * v_radius - 16;
		SDL_BlitSurface(artifact_spr, &draw_from, screen, &draw_to);
	}
	
	UpdatePalette();
	VideoUpdate();
}