Exemplo n.º 1
0
		void Base::DrawLinedRect( Gwen::Rect rect )
		{
			DrawFilledRect( Gwen::Rect( rect.x, rect.y, rect.w, 1 ) );
			DrawFilledRect( Gwen::Rect( rect.x, rect.y + rect.h - 1, rect.w, 1 ) );
			DrawFilledRect( Gwen::Rect( rect.x, rect.y, 1, rect.h ) );
			DrawFilledRect( Gwen::Rect( rect.x + rect.w - 1, rect.y, 1, rect.h ) );
		};
Exemplo n.º 2
0
void DrawButton(Button *button)
{
  if(button->usesprite)
  {
    if(!button->State)DrawSprite(button->sprite,screen,button->rect.x,button->rect.y,0);
    else DrawSprite(button->sprite,screen,button->rect.x,button->rect.y,1);
  }
  else
  {
    DrawFilledRect(button->rect.x,button->rect.y, button->rect.w, button->rect.h, IndexColor(button->bg), screen);
    if(!button->State)
    {
      DrawFilledRect(button->rect.x,button->rect.y, 1, button->rect.h, IndexColor(Black), screen);
      DrawFilledRect(button->rect.x,button->rect.y, button->rect.w, 1, IndexColor(White), screen);
      DrawFilledRect(button->rect.x + button->rect.w,button->rect.y, 1, button->rect.h, IndexColor(White), screen);
      DrawFilledRect(button->rect.x,button->rect.y + button->rect.h, button->rect.w, 1, IndexColor(Black), screen);
    }
    else
    {
      DrawFilledRect(button->rect.x,button->rect.y, 1, button->rect.h, IndexColor(White), screen);
      DrawFilledRect(button->rect.x,button->rect.y, button->rect.w, 1, IndexColor(Black), screen);
      DrawFilledRect(button->rect.x + button->rect.w,button->rect.y, 1, button->rect.h, IndexColor(Black), screen);
      DrawFilledRect(button->rect.x,button->rect.y + button->rect.h, button->rect.w, 1, IndexColor(White), screen);
    }
  }
  if(button->text != NULL)
  {
    DrawTextCentered(button->text,screen,button->rect.x + (button->rect.w/2),button->rect.y + 2,IndexColor(button->fg),F_Small);
  }
}
Exemplo n.º 3
0
void Drawing::DrawBorderBox( int x, int y, int w, int h, int thickness, D3DCOLOR Colour, IDirect3DDevice9 *pDevice)
{
	//Top horiz line
	DrawFilledRect( x, y, w, thickness,  Colour, pDevice );
	//Left vertical line
	DrawFilledRect( x, y, thickness, h, Colour, pDevice );
	//right vertical line
	DrawFilledRect( (x + w), y, thickness, h, Colour, pDevice );
	//bottom horiz line
	DrawFilledRect( x, y + h, w+thickness, thickness, Colour, pDevice );
}
Exemplo n.º 4
0
void DrawStatusBarHoriz(int stat,int range,int FG,int BG,int x, int y, int w, int h)
{
  float percent;
  DrawFilledRect(x,y, w, h, IndexColor(BG),screen);
  if((stat > 0)&&(range != 0))
  {
    percent = (stat * w) / range;
    DrawFilledRect(x,y, percent, h, IndexColor(FG),screen);
  }

}
Exemplo n.º 5
0
void DrawStringBox(char *title,char *text,int slength)
{
  SDL_Rect rect;
  rect.x = (screen->w>>1) - (slength * 4) - 20;
  rect.y = (screen->h>>1) - 30;
  rect.w = (slength * 8) + 40;
  rect.h = 60;
  DrawFilledRect(rect.x,rect.y,rect.w , rect.h, IndexColor(Silver), screen);
  DrawRect(rect.x,rect.y,rect.w , rect.h, IndexColor(DarkBlue), screen);
  DrawTextCentered(title,screen,screen->w>>1,rect.y + 8,IndexColor(DarkGrey),F_Medium);
  DrawFilledRect(rect.x + 10,rect.y + 30,rect.w -20, 20, IndexColor(White), screen);
  DrawRect(rect.x + 10,rect.y + 30,rect.w -20, 20, IndexColor(DarkBlue), screen);
  if(strlen(text) > 0)DrawText(text,screen,rect.x + 12,rect.y + 32,IndexColor(DarkGrey),F_Medium);
}
Exemplo n.º 6
0
		void Base::DrawShavedCornerRect( Rect rect, bool bSlight )
		{
			// Draw INSIDE the w/h.
			rect.w -= 1;
			rect.h -= 1;

			if ( bSlight )
			{
				DrawFilledRect( Gwen::Rect( rect.x+1, rect.y, rect.w-1, 1 ) );
				DrawFilledRect( Gwen::Rect( rect.x+1, rect.y + rect.h, rect.w-1, 1 ) );

				DrawFilledRect( Gwen::Rect( rect.x, rect.y+1, 1, rect.h-1 ) );
				DrawFilledRect( Gwen::Rect( rect.x + rect.w, rect.y+1, 1, rect.h-1 ) );
				return;
			}

			DrawPixel( rect.x+1, rect.y+1 );
			DrawPixel( rect.x+rect.w-1, rect.y+1 );

			DrawPixel( rect.x+1, rect.y+rect.h-1 );
			DrawPixel( rect.x+rect.w-1, rect.y+rect.h-1 );

			DrawFilledRect( Gwen::Rect( rect.x+2, rect.y, rect.w-3, 1 ) );
			DrawFilledRect( Gwen::Rect( rect.x+2, rect.y + rect.h, rect.w-3, 1 ) );

			DrawFilledRect( Gwen::Rect( rect.x, rect.y+2, 1, rect.h-3 ) );
			DrawFilledRect( Gwen::Rect( rect.x + rect.w, rect.y+2, 1, rect.h-3 ) );
		}
Exemplo n.º 7
0
void AdManager::OnRender()
{

#ifdef WIN32
	if (m_bShowingAd)
	{
		//draw a fake rectangle the same size as the real ad will be, this is just for testing, so you get an idea
		//of how big the ad when developing on Windows, and when it will pop up

		CL_Vec2f vRatio = CL_Vec2f(1,1);
		if (GetFakePrimaryScreenSizeX() != 0)
		{
			vRatio.x = (GetScreenSizeXf()/float(GetOriginalScreenSizeX()));
			vRatio.y =(GetScreenSizeYf()/float(GetOriginalScreenSizeY()));
		}
		rtRect r(0,0, (int)(m_vBannerSize.x*vRatio.x),(int)(m_vBannerSize.y*vRatio.y));
		
		//move to bottom
		r.AdjustPosition(0, GetScreenSizeY()-r.GetHeight());

		//center
		r.AdjustPosition( (GetScreenSizeX()-r.GetWidth())/2, 0 );
		
		DrawFilledRect(r, MAKE_RGBA(40,255,40,200));
	}
#endif

}
Exemplo n.º 8
0
//*********************************************************************************************************
void CProgressBarWidget::DrawBar()
{
	SDL_Rect rectInset;
	GetRect(rectInset);

	static const UINT CX_BAR_SPACE = 1;
	static const UINT CY_BAR_SPACE = 1;
	static const UINT CX_MIN_INSET = (CX_BAR_SPACE + CX_INSET_BORDER) * 2 + 3; //3 = left/right bar border + red center.
	static const UINT CY_MIN_INSET = (CY_BAR_SPACE + CY_INSET_BORDER) * 2 + 3; //3 = top/bottom bar border + red center.

	SDL_Surface *pDestSurface = GetDestSurface();

	if (rectInset.w >= CX_MIN_INSET && rectInset.h >= CY_MIN_INSET)  //Inset must be big enough to display bar.
	{
		SURFACECOLOR Black;
		SURFACECOLOR Red;
		GetDestSurfaceColor(0, 0, 0, Black);
		ASSERT(this->fValue >= 0.0 && this->fValue <= 1.0);
		GetDestSurfaceColor(128 + (Uint8)(this->fValue*127), (Uint8)(this->fValue*255), 0, Red);   //get brighter

		//Calc bar's rect.
		SDL_Rect rectBar;
		rectBar.x = rectInset.x + CX_INSET_BORDER + CX_BAR_SPACE;
		rectBar.y = rectInset.y + CY_INSET_BORDER + CY_BAR_SPACE;
		rectBar.h = rectInset.h - (CY_INSET_BORDER + CY_BAR_SPACE) * 2;
		const UINT wAvailableWidth = rectInset.w - (CX_INSET_BORDER + CX_BAR_SPACE) * 2;
		rectBar.w = static_cast<Uint16>(wAvailableWidth * this->fValue);
		if (rectBar.w < 3) rectBar.w = 3;

		//Draw the bar.
		DrawFilledRect(rectBar, Red, pDestSurface);
		DrawRect(rectBar, Black, pDestSurface);
	}
}
Exemplo n.º 9
0
//Draws an outlined filled rectangle
//param:rectangle->The rectangle to draw
//param:outlineColor->The color of the outline
//param:fillColor->The color to fill it with
//returns 0 for success, -1 for errors
int SpriteBatch::DrawOutlinedFilledRect(SDL_Rect* rectangle, SDL_Color outlineColor, SDL_Color fillColor)
{
	int result = 0;

	//Draw the filled rectangle
	result = DrawFilledRect(rectangle, fillColor);

	//Check for filled rectangle drawing errors
	if(result != 0)
	{
		std::cout<<"DrawOutlinedFilledRect error: Error drawing filled rectangle"<<std::endl;
		return result;
	}

	//Draw outlined rectangle
	result = DrawRect(rectangle, outlineColor);

	//Check for outline rectangle drawing errors
	if(result != 0)
	{
		std::cout<<"DrawOutlinedFilledRect error: Error drawing outline rectangle"<<std::endl;
		return result;
	}

	//Return success
	return result;
}
Exemplo n.º 10
0
void DrawWindowGeneric(Window *self)
{
  int i;
  if(self->sprite != NULL)
  {
    DrawSprite(self->sprite,screen,self->rect.x,self->rect.y,0);
  }
  else
  {
    DrawFilledRect(self->rect.x,self->rect.y, self->rect.w, self->rect.h, IndexColor(self->fg), screen);
    DrawFilledRect(self->rect.x,self->rect.y, 1, self->rect.h, IndexColor(self->fg), screen);
    DrawFilledRect(self->rect.x,self->rect.y, self->rect.w, 1, IndexColor(self->fg), screen);
    DrawFilledRect(self->rect.x + self->rect.w,self->rect.y, 1, self->rect.h, IndexColor(self->fg), screen);
    DrawFilledRect(self->rect.x,self->rect.y + self->rect.h, self->rect.w, 1, IndexColor(self->fg), screen);
  }
  DrawTextCentered(self->title,screen,self->rect.x + (self->rect.w /2),self->rect.y + 2,IndexColor(self->bg),F_Small);
  for(i = 0; i < self->buttoncount;i++)
  {
    DrawButton(self->buttonlist[i]);
  }
}
Exemplo n.º 11
0
void RectRenderComponent::OnRender(VariantList *pVList)
{

	if (*m_pAlpha > 0.01)
	{
		CL_Vec2f vFinalPos = pVList->m_variant[0].GetVector2()+*m_pPos2d;
		uint32 color = ColorCombine(*m_pColor, *m_pColorMod, *m_pAlpha);

		if (GET_ALPHA(color) == 0) return;

		CL_Vec2f vRotationPt = vFinalPos;

		g_globalBatcher.Flush();

		if (*m_pRotation != 0)
		{
			SetupOrtho();
			PushRotationMatrix(*m_pRotation, vRotationPt);
			vFinalPos -= vRotationPt;
		}

			CL_Rectf r = CL_Rectf(vFinalPos.x, vFinalPos.y, vFinalPos.x+ m_pSize2d->x, vFinalPos.y+m_pSize2d->y); 
			if (*m_pVisualStyle != STYLE_BORDER_ONLY)
			{
				DrawFilledRect(r, color);
			}
			
			if (GET_ALPHA(*m_pBorderColor) > 0)
			{
				DrawRect(r, *m_pBorderColor, 1);
			}

			if (*m_pVisualStyle == STYLE_3D)
			{
				int shadedColor = ColorCombineMix(color, MAKE_RGBA(0,0,0,255), 0.4f);
				DrawLine(shadedColor, vFinalPos.x, vFinalPos.y+m_pSize2d->y, vFinalPos.x+m_pSize2d->x,vFinalPos.y+m_pSize2d->y, 1);
				DrawLine(shadedColor, vFinalPos.x+m_pSize2d->x, vFinalPos.y, vFinalPos.x+m_pSize2d->x,vFinalPos.y+m_pSize2d->y, 1);

				shadedColor = ColorCombineMix(color, MAKE_RGBA(255,255,255 ,255), 0.4f);
				DrawLine(shadedColor, vFinalPos.x, vFinalPos.y, vFinalPos.x,vFinalPos.y+m_pSize2d->y, 1);
				DrawLine(shadedColor, vFinalPos.x, vFinalPos.y, vFinalPos.x+m_pSize2d->x,vFinalPos.y, 1);
			}

			if (*m_pRotation != 0)
			{
				PopRotationMatrix();
			}

		
	}

}
Exemplo n.º 12
0
		void Base::RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString & text )
		{
			
		//	std::cout << "tryinta render sum txt '" << Gwen::Utility::UnicodeToString(text) <<"'\n";
			float fSize = pFont->size * Scale();

			SetDrawColor(Gwen::Color(0,0,0,255));
			for ( float i = 0; i < text.length(); i++ )
			{
				wchar_t chr = text[i];

				if ( chr == ' ' ) { continue; }

				Gwen::Rect r( pos.x + i * fSize * 0.4, pos.y, fSize * 0.4 - 1, fSize );

				/*
					This isn't important, it's just me messing around changing the
					shape of the rect based on the letter.. just for fun.
				*/
				if ( chr == 'l' || chr == 'i' || chr == '!' || chr == 't' )
				{
					r.w = 1;
				}
				else if ( chr >= 'a' && chr <= 'z' )
				{
					r.y += fSize * 0.5f;
					r.h -= fSize * 0.4f;
				}
				else if ( chr == '.' || chr == ',' )
				{
					r.x += 2;
					r.y += r.h - 2;
					r.w = 2;
					r.h = 2;
				}
				else if ( chr == '\'' || chr == '`'  || chr == '"' )
				{
					r.x += 3;
					r.w = 2;
					r.h = 2;
				}

				if ( chr == 'o' || chr == 'O' || chr == '0' )
				{ DrawLinedRect( r ); }
				else
				{
				//	std::cout << "drawing ur flld rct: " <<r.x<<','<<r.y<<','<<r.w<<','<<r.h<<"\n";
					DrawFilledRect( r );
				}
			}
		}
Exemplo n.º 13
0
		void Base::RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString& text )
		{
			float fSize = pFont->size * Scale();

			for ( float i=0; i<text.length(); i++ )
			{
				wchar_t chr = text[i];

				if ( chr == ' ' ) continue;

				Gwen::Rect r( pos.x + i * fSize * 0.4, pos.y, fSize * 0.4 -1, fSize );

				/*
					This isn't important, it's just me messing around changing the
					shape of the rect based on the letter.. just for fun.
				*/
				if ( chr == 'l' || chr == 'i' || chr == '!' || chr == 't' )
				{
					r.w = 1;
				}
				else if ( chr >= 'a' && chr <= 'z' )
				{
					r.y += fSize * 0.5f;
					r.h -= fSize * 0.4f;
				}
				else if ( chr == '.' || chr == ',' )
				{
					r.x += 2;
					r.y += r.h - 2;
					r.w = 2;
					r.h = 2;
				}
				else if ( chr == '\'' || chr == '`'  || chr == '"' )
				{
					r.x += 3;
					r.w = 2;
					r.h = 2;
				}


				if ( chr == 'o' || chr == 'O' || chr == '0' )
					DrawLinedRect( r );	
				else
					DrawFilledRect( r );
			}
		}
Exemplo n.º 14
0
		void OpenGL_DebugFont::RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString& text )
		{
			
			float fSize = pFont->size * Scale();

			if ( !text.length() )
				return;

			Gwen::String converted_string = Gwen::Utility::UnicodeToString( text );

			float yOffset=0.0f;
			for ( int i=0; i<text.length(); i++ )
			{
				wchar_t chr = text[i];
				char ch = converted_string[i];
				float curSpacing = sGwenDebugFontSpacing[ch] * m_fLetterSpacing * fSize * m_fFontScale[0];
				Gwen::Rect r( pos.x + yOffset, pos.y-fSize*0.2f, (fSize * m_fFontScale[0]), fSize * m_fFontScale[1] );

				if ( m_pFontTexture )
				{
					float uv_texcoords[8]={0.,0.,1.,1.};

					if ( ch >= 0 )
					{
						float cx= (ch%16)/16.0;
						float cy= (ch/16)/16.0;
						uv_texcoords[0] = cx;			
						uv_texcoords[1] = cy;
						uv_texcoords[4] = float(cx+1.0f/16.0f);	
						uv_texcoords[5] = float(cy+1.0f/16.0f);
					}

					DrawTexturedRect( m_pFontTexture, r, uv_texcoords[0], uv_texcoords[5], uv_texcoords[4], uv_texcoords[1] );
					yOffset+=curSpacing;
				} 
				else
				{
					DrawFilledRect( r );
					yOffset+=curSpacing;

				}
			}

		}
Exemplo n.º 15
0
void DrawElementWindow()
{
  int i;
  int percent;
  char message[80];
  DrawSprite(windowsprite,screen,30,30,0);
  switch(hud.subwindowinfo)
  {
    case 0:
      DrawTextCentered("Condition",screen,120,38,IndexColor(DarkGrey),F_Large);
      DrawTextCentered("Condition",screen,119,37,IndexColor(LightGreen),F_Large);
      DrawTextCentered(ThePlayerStats.stagename,screen,120,60,IndexColor(DarkGrey),F_Large);
      DrawTextCentered(ThePlayerStats.stagename,screen,119,59,IndexColor(Green),F_Large);
      
      sprintf(message,"Age: %i",PlayerStats[Player->playernum].Age );
      DrawText(message,screen,61,80,IndexColor(DarkGrey),F_Medium);
      DrawText(message,screen,60,79,IndexColor(Green),F_Medium);
      
      DrawSprite(attributes,screen,60,96,6);
      sprintf(message,"%i / %i",(int)PlayerStats[Player->playernum].health,PlayerStats[Player->playernum].healthmax );
      DrawText(message,screen,79,97,IndexColor(DarkGrey),F_Medium);
      DrawText(message,screen,78,96,IndexColor(Green),F_Medium);
      DrawSprite(attributes,screen,60,97 + 24,7);
      sprintf(message,"%i / %i",(int)PlayerStats[Player->playernum].stamina,PlayerStats[Player->playernum].staminamax );
      DrawText(message,screen,79,97 + 24,IndexColor(DarkGrey),F_Medium);
      DrawText(message,screen,78,96 + 24,IndexColor(Green),F_Medium);
      DrawSprite(attributes,screen,60,96 + 48,8);
      sprintf(message,"%i / %i",(int)PlayerStats[Player->playernum].fullness,PlayerStats[Player->playernum].stage * 25 );
      DrawText(message,screen,79,97 + 48,IndexColor(DarkGrey),F_Medium);
      DrawText(message,screen,78,96 + 48,IndexColor(Green),F_Medium);
      sprintf(message,"Food: %i",PlayerStats[Player->playernum].foodsupply );
      DrawText(message,screen,61,96 + 48 + 20,IndexColor(DarkGrey),F_Medium);
      DrawText(message,screen,60,97 + 48 + 20,IndexColor(Green),F_Medium);
      break;
    case 1:
      DrawTextCentered("Attributes",screen,120,38,IndexColor(DarkGrey),F_Large);
      DrawTextCentered("Attributes",screen,119,37,IndexColor(Green),F_Large);
      for(i = 0;i < 6;i++)
      {
        DrawSprite(attributes,screen,60,66 + (24 * i),i);
        sprintf(message,"%i",PlayerStats[Player->playernum].attributes[i]);
        DrawText(message,screen,79,67 + (24 * i),IndexColor(DarkGrey),F_Medium);
        if(PlayerStats[Player->playernum].attributetrains[i] <= 0)
          DrawText(message,screen,78,66 + (24 * i),IndexColor(DarkGreen),F_Medium);
        else if(PlayerStats[Player->playernum].attributetrains[i] < 10)
          DrawText(message,screen,78,66 + (24 * i),IndexColor(Green),F_Medium);
        else DrawText(message,screen,78,66 + (24 * i),IndexColor(LightGreen),F_Medium);
      }
      break;
    case 2:
      DrawTextCentered("Elements",screen,120,38,IndexColor(DarkGrey),F_Large);
      DrawTextCentered("Elements",screen,119,37,IndexColor(Green),F_Large);
      for(i = 0;i < 5;i++)
      {
        DrawSprite(elements,screen,60,56 + (33 * i),i);
        sprintf(message,"%i",(int)PlayerStats[Player->playernum].Element[i]);
        DrawText(message,screen,79,57 + (33 * i),IndexColor(DarkGrey),F_Medium);
        DrawText(message,screen,78,56 + (33 * i),IndexColor(Green),F_Medium);
          DrawSprite(elements,screen,75,56 + (33 * i) + 16,i + 5);
      }
      DrawSprite(elements,screen,120,74,12);/*good*/
      if(ThePlayerStats.good)
      {
        percent = (ThePlayerStats.good * 0.001)*100;
        if(percent <= 0)percent = 1;
        DrawFilledRect(140,130 - (percent), 16, percent, IndexColor(LightYellow),screen);
      }
      DrawSprite(elements,screen,120,122,11);/*balance*/
      DrawSprite(elements,screen,120,170,10);/*evil*/
      if(ThePlayerStats.evil)
      {
        percent = (ThePlayerStats.evil * 0.001)*100;
        if(percent <= 0)percent = 1;
        DrawFilledRect(140,130, 16, percent, IndexColor(LightViolet),screen);
      }
      break;
    case 3:
      DrawTextCentered("Attacks",screen,120,38,IndexColor(DarkGrey),F_Large);
      DrawTextCentered("Attacks",screen,119,37,IndexColor(Green),F_Large);
      for(i = 0;i < PlayerStats[Player->playernum].numattacks;i++)
      {
        sprintf(message,"%s",PlayerStats[Player->playernum].attacks[i]);
        DrawText(message,screen,79,57 + (20 * i),IndexColor(DarkGrey),F_Medium);
        DrawText(message,screen,78,56 + (20 * i),IndexColor(Green),F_Medium);
      }
      break;
    case 4:
      DrawTextCentered("Other Skills",screen,120,38,IndexColor(DarkGrey),F_Large);
      DrawTextCentered("Other Skills",screen,119,37,IndexColor(Green),F_Large);
      for(i = 0;i < PlayerStats[Player->playernum].numdefenses;i++)
      {
        sprintf(message,"%s",PlayerStats[Player->playernum].defenses[i]);
        DrawText(message,screen,79,57 + (20 * i),IndexColor(DarkGrey),F_Medium);
        DrawText(message,screen,78,56 + (20 * i),IndexColor(Green),F_Medium);
      }
      break;
  }
}
Exemplo n.º 16
0
		void Base::DrawPixel( int x, int y )
		{
			DrawFilledRect( Gwen::Rect( x, y, 1, 1 ) );
		}
Exemplo n.º 17
0
void draw_object(Canvas *canvas, Quark *q)
{
    VPoint anchor;
    DObject *o = object_get_data(q);

    if (o == NULL) {
        return;
    }

    if (Apoint2Vpoint(q, &o->ap, &anchor) != RETURN_SUCCESS) {
        return;
    }
    anchor.x += o->offset.x;
    anchor.y += o->offset.y;

    setclipping(canvas, FALSE);

    activate_bbox(canvas, BBOX_TYPE_TEMP, TRUE);
    reset_bbox(canvas, BBOX_TYPE_TEMP);

    switch (o->type) {
    case DO_LINE:
    {
        DOLineData *l = (DOLineData *) o->odata;

        VPoint vp1;
        double x, y, co, si;

        x = l->vector.x;
        y = l->vector.y;

        co = cos(M_PI/180.0*o->angle);
        si = sin(M_PI/180.0*o->angle);

        vp1.x = anchor.x + x*co - y*si;
        vp1.y = anchor.y + x*si + y*co;

        setline(canvas, &o->line);
        DrawLine(canvas, &anchor, &vp1);

        switch (l->arrow_end) {
        case ARROW_AT_NONE:
            break;
        case ARROW_AT_BEGINNING:
            draw_arrowhead(canvas, &vp1, &anchor, &l->arrow,
                           &o->line.pen, &o->fillpen);
            break;
        case ARROW_AT_END:
            draw_arrowhead(canvas, &anchor, &vp1, &l->arrow,
                           &o->line.pen, &o->fillpen);
            break;
        case ARROW_AT_BOTH:
            draw_arrowhead(canvas, &vp1, &anchor, &l->arrow,
                           &o->line.pen, &o->fillpen);
            draw_arrowhead(canvas, &anchor, &vp1, &l->arrow,
                           &o->line.pen, &o->fillpen);
            break;
        }
    }
    break;
    case DO_BOX:
    {
        DOBoxData *b = (DOBoxData *) o->odata;
        if (o->angle == 0.0) {
            VPoint vp1, vp2;

            vp1.x = anchor.x - b->width/2;
            vp2.x = anchor.x + b->width/2;
            vp1.y = anchor.y - b->height/2;
            vp2.y = anchor.y + b->height/2;

            setpen(canvas, &o->fillpen);
            DrawFilledRect(canvas, &vp1, &vp2);

            setline(canvas, &o->line);
            DrawRect(canvas, &vp1, &vp2);
        } else {
            VPoint vps[4];
            double x, y, co, si;

            x = b->width/2;
            y = b->height/2;

            co = cos(M_PI/180.0*o->angle);
            si = sin(M_PI/180.0*o->angle);

            vps[0].x = anchor.x + x*co - y*si;
            vps[0].y = anchor.y + x*si + y*co;
            vps[1].x = anchor.x - x*co - y*si;
            vps[1].y = anchor.y - x*si + y*co;
            vps[2].x = anchor.x - x*co + y*si;
            vps[2].y = anchor.y - x*si - y*co;
            vps[3].x = anchor.x + x*co + y*si;
            vps[3].y = anchor.y + x*si - y*co;

            setpen(canvas, &o->fillpen);
            DrawPolygon(canvas, vps, 4);

            setline(canvas, &o->line);
            DrawPolyline(canvas, vps, 4, POLYLINE_CLOSED);
        }
    }
    break;
    case DO_ARC:
    {
        VPoint vp1, vp2;
        DOArcData *e = (DOArcData *) o->odata;

        vp1.x = anchor.x - e->width/2;
        vp2.x = anchor.x + e->width/2;
        vp1.y = anchor.y - e->height/2;
        vp2.y = anchor.y + e->height/2;

        setpen(canvas, &o->fillpen);
        /* FIXME: implement true ellipse rotation! */
        DrawFilledArc(canvas, &vp1, &vp2, e->angle1 + o->angle, e->angle2,
                      e->closure_type);

        setline(canvas, &o->line);
        DrawArc(canvas, &vp1, &vp2, e->angle1 + o->angle, e->angle2,
                e->closure_type, e->draw_closure);
    }
    break;
    case DO_NONE:
        break;
    }

    get_bbox(canvas, BBOX_TYPE_TEMP, &o->bb);
}
Exemplo n.º 18
0
		void Base::DrawMissingImage( Gwen::Rect pTargetRect )
		{
			SetDrawColor( Colors::Red );
			DrawFilledRect( pTargetRect );
		}
Exemplo n.º 19
0
void ProtonPainter::FillRect( int inX, int inY, int inW, int inH )
{
	DrawFilledRect(m_posX+(float)inX, m_posY+(float)inY, (float)inW, (float)inH, m_fillColor);
}
Exemplo n.º 20
0
void ProtonPainter::InvertRect( int inX, int inY, int inW, int inH )
{
	DrawFilledRect(m_posX+(float)inX, m_posY+(float)inY, (float)inW, (float)inH, MAKE_RGBA(200,200,200,150));
}
Exemplo n.º 21
0
void CClrButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
	CDC		*dc;
	CRect	focus_rect, button_rect, text_rect, offset_text_rect;
	UINT	state;
	
	dc    = CDC::FromHandle(lpDrawItemStruct->hDC);
	state = lpDrawItemStruct->itemState;

	focus_rect.CopyRect(&lpDrawItemStruct->rcItem); 
	button_rect.CopyRect(&lpDrawItemStruct->rcItem); 

	text_rect = button_rect;
	text_rect.OffsetRect(-1, -1); 
	offset_text_rect = text_rect;
	offset_text_rect.OffsetRect(1, 1);

	// Set the focus rectangle to just past the border decoration
	focus_rect.left   += 4;
    focus_rect.right  -= 4;
    focus_rect.top    += 4;
    focus_rect.bottom -= 4;
      
	// Retrieve the button's caption
    const int bufSize = 512;
    TCHAR buffer[bufSize];
    GetWindowText(buffer, bufSize);

	if (state & ODS_DISABLED)
    {
		DrawFilledRect(dc, button_rect, disabled_background_colour);
	}
	else
	{
		DrawFilledRect(dc, button_rect, background_colour);
	}
		
	if (state & ODS_SELECTED)
	{ 
    	DrawFrame(dc, button_rect, BUTTON_IN);
	}
	else
	{
		if ((state & ODS_DEFAULT) || (state & ODS_FOCUS))
		{
			DrawFrame(dc, button_rect, BUTTON_OUT | BUTTON_BLACK_BORDER);			
		}
		else
		{
			DrawFrame(dc, button_rect, BUTTON_OUT);
		}
	}

	if (state & ODS_DISABLED)
	{
		DrawButtonText(dc, offset_text_rect, buffer, CLR_BTN_WHITE);
		DrawButtonText(dc, text_rect,		 buffer, CLR_BTN_DGREY);
    }
	else
	{
		if (state & ODS_SELECTED)
		{
			DrawButtonText(dc, offset_text_rect, buffer, text_colour);
		}
		else
		{
  			DrawButtonText(dc, text_rect, buffer, text_colour);
		}
	}

	if (state & ODS_FOCUS)
	{
		DrawFocusRect(lpDrawItemStruct->hDC, (LPRECT)&focus_rect);
	}
} 
void ScrollBarRenderComponent::OnRender(VariantList *pVList)
{
	//NOTE: We don't support drawing a horizontal scroll bar yet!
	CHECK_GL_ERROR();
	//LogMsg("Drawing progress bar: %.2f", progress);
	if (*m_pAlpha <= 0.07)
	{
		return; //not ready
	}

	float contentAreaRatio;
	
	GLboolean bScissorEnabled = false;
	glGetBooleanv(GL_SCISSOR_TEST, &bScissorEnabled);

	if (bScissorEnabled)
	{
		g_globalBatcher.Flush();
		//disable it temporarily
		glDisable(GL_SCISSOR_TEST);
	}
	float barHeight;
	float barWidth;
	CL_Vec2f vFinalPos;
	uint32 color = ColorCombine(*m_pColor, *m_pColorMod, *m_pAlpha);

	if (!m_pSurf) return; //can't do anything without the graphics loaded
	
	contentAreaRatio = (m_pBoundsRect->get_height()+m_pSize2d->y)/m_pSize2d->y;

	if (!m_bUsingScrollComponent && m_pBoundsRect->get_height() < (m_pSize2d->y+1)) //I don't really know why I need that +1..but it works..
	{
		contentAreaRatio = 0; //definitely don't need to scroll here
	}

	if (contentAreaRatio > 1)
	{
		//render vertical scroll bar
		m_pSurf->SetupAnim(1,2);

		barHeight = m_pSize2d->y/contentAreaRatio;
		
		if (barHeight < m_pSurf->GetFrameHeight()*2) barHeight = m_pSurf->GetFrameHeight()*2;
		
		barWidth = m_pSurf->GetFrameWidth();
		//LogMsg("percent scrolled is %.2f, contentAreaRation is %.2f", m_pProgress2d->y, contentAreaRatio);

		vFinalPos = pVList->m_variant[0].GetVector2()+ *m_pPos2d + CL_Vec2f(m_pSize2d->x, 0);

		if (vFinalPos.x >= GetScreenSizeXf())
		{
			//position on the inside, not the outside
			vFinalPos.x -= ( barWidth+(iPadMapX(8) )); //adjust the spacer with the screensize
		}
		//slide it down to the right position:
		vFinalPos.y += (m_pSize2d->y - barHeight)* m_pProgress2d->y;

		//draw the top of the capsule
		m_pSurf->BlitAnim(vFinalPos.x, vFinalPos.y,0,0, color);
		vFinalPos.y += m_pSurf->GetFrameHeight(); 
		barHeight -=  m_pSurf->GetFrameHeight()*2;
		//draw the bottom end cap
		m_pSurf->BlitAnim(vFinalPos.x, vFinalPos.y+barHeight,0,1, color);
		//first draw the first end cap
		CL_Rectf r = CL_Rectf(0, 0, barWidth, barHeight);
		ApplyOffset(&r, vFinalPos);
		DrawFilledRect(r, color);
	}

	contentAreaRatio = (m_pBoundsRect->get_width()+m_pSize2d->x)/m_pSize2d->x;

	if (!m_bUsingScrollComponent && m_pBoundsRect->get_width() < (m_pSize2d->x+1)) //I don't really know why I need that +1..but it works..
	{
		contentAreaRatio = 0; //definitely don't need to scroll here
	}
	
	if (contentAreaRatio > 1)
	{
		//render horizontal scroll bar
		m_pSurf->SetupAnim(2,1); //repurpose the graphics for horizontal...

		barWidth = m_pSize2d->x/contentAreaRatio;

		if (barWidth < m_pSurf->GetFrameWidth()*2) barWidth = m_pSurf->GetFrameWidth()*2;

		barHeight= m_pSurf->GetFrameHeight();
		//LogMsg("percent scrolled is %.2f, contentAreaRation is %.2f", m_pProgress2d->x, contentAreaRatio);

		vFinalPos = pVList->m_variant[0].GetVector2()+ *m_pPos2d + CL_Vec2f(0, m_pSize2d->y);

		if (vFinalPos.y >= GetScreenSizeYf())
		{
			//position on the inside, not the outside
			vFinalPos.y -= ( barHeight+(iPadMapY(6) )); //adjust the spacer with the screensize
		}
		//slide it down to the right position:
		vFinalPos.x += (m_pSize2d->x - barWidth)* m_pProgress2d->x;

		//draw the top of the capsule
		m_pSurf->BlitAnim(vFinalPos.x, vFinalPos.y,0,0, color);
		vFinalPos.x += m_pSurf->GetFrameWidth(); 
		barWidth -=  m_pSurf->GetFrameWidth()*2;
		//draw the bottom end cap
		m_pSurf->BlitAnim(vFinalPos.x+barWidth, vFinalPos.y,1,0, color);
		//first draw the first end cap
		CL_Rectf r = CL_Rectf(0, 0, barWidth, barHeight);
		ApplyOffset(&r, vFinalPos);
		DrawFilledRect(r, color);
		CHECK_GL_ERROR();

	}
	
	
	if (bScissorEnabled)
	{
		g_globalBatcher.Flush();
		glEnable(GL_SCISSOR_TEST);
	}
	CHECK_GL_ERROR();

}
Exemplo n.º 23
0
void CColorButton::DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
    CDC* pDC = CDC::FromHandle(lpDIS->hDC);

    UINT state = lpDIS->itemState;
    CRect focusRect, btnRect;
    focusRect.CopyRect(&lpDIS->rcItem);
    btnRect.CopyRect(&lpDIS->rcItem);

    //
    // Set the focus rectangle to just past the border decoration
    //
    focusRect.left += 4;
    focusRect.right -= 4;
    focusRect.top += 4;
    focusRect.bottom -= 4;

    //
    // Retrieve the button's caption
    //
    const int bufSize = 512;
    TCHAR buffer[bufSize];
    GetWindowText(buffer, bufSize);


    //
    // Draw and label the button using draw methods
    //
    DrawFilledRect(pDC, btnRect, GetBGColor());
    DrawFrame(pDC, btnRect, GetBevel());
    DrawButtonText(pDC, btnRect, buffer, GetFGColor());


    //
    // Now, depending upon the state, redraw the button (down image) if it is selected,
    // place a focus rectangle on it, or redisplay the caption if it is disabled
    //
    if (state & ODS_FOCUS) {
        DrawFocusRect(lpDIS->hDC, (LPRECT)&focusRect);
        if (state & ODS_SELECTED) {
            DrawFilledRect(pDC, btnRect, GetBGColor());
            DrawFrame(pDC, btnRect, -1);


// ----> Changes!	// changes by RW:

            // move the button text if it is pressed...
            CRect rectPressedBtnText = btnRect;

            // to the right and bottom...
            rectPressedBtnText.OffsetRect( 1, 1 );

            // ... and now paint it!
            DrawButtonText(pDC, rectPressedBtnText, buffer, GetFGColor());

            // DrawButtonText(pDC, btnRect, buffer, GetFGColor());
            DrawFocusRect(lpDIS->hDC, (LPRECT)&focusRect);
        }
    }
    else if (state & ODS_DISABLED) {
        //COLORREF disabledColor = bg ^ 0xFFFFFF; // contrasting color
        DrawButtonText(pDC, btnRect, buffer, GetDisabledColor());
    }
}