Example #1
0
void iwBuilding::Msg_PaintAfter()
{
    if(building->GetBuildingType() >= BLD_GRANITEMINE && building->GetBuildingType() <= BLD_GOLDMINE)
    {
        // Bei Bergwerken sieht die Nahrungsanzeige ein wenig anders aus (3x 2)

        // "Schwarzer Rahmen"
        DrawRectangle(GetDrawPos() + DrawPoint(40, 60), 144, 24, 0x80000000);
        DrawPoint curPos = GetDrawPos() + DrawPoint(52, 72);
        for(unsigned char i = 0; i < 3; ++i)
        {
            for(unsigned char z = 0; z < 2; ++z)
            {
                glArchivItem_Bitmap* bitmap = LOADER.GetMapImageN(2250 + USUAL_BUILDING_CONSTS[building->GetBuildingType() - 10].wares_needed[i]);
                bitmap->Draw(curPos, 0, 0, 0, 0, 0, 0, (z < building->GetWares(i) ? 0xFFFFFFFF : 0xFF404040) );
                curPos.x += 24;
            }
        }
    }
    else
    {
        DrawPoint curPos = GetDrawPos() + DrawPoint(width_ / 2, 60);
        for(unsigned char i = 0; i < 2; ++i)
        {
            if(USUAL_BUILDING_CONSTS[building->GetBuildingType() - 10].wares_needed[i] == GD_NOTHING)
                break;

            // 6x Waren, je nachdem ob sie da sind, bei Katapult 4!
            unsigned wares_count = (building->GetBuildingType() == BLD_CATAPULT) ? 4 : 6;

            // "Schwarzer Rahmen"
            DrawPoint waresPos = curPos - DrawPoint(24 * wares_count / 2, 0);
            DrawRectangle(waresPos, 24 * wares_count, 24, 0x80000000);
            waresPos += DrawPoint(12, 12);

            for(unsigned char z = 0; z < wares_count; ++z)
            {
                glArchivItem_Bitmap* bitmap = LOADER.GetMapImageN(2250 + USUAL_BUILDING_CONSTS[building->GetBuildingType() - 10].wares_needed[i]);
                bitmap->Draw(waresPos, 0, 0, 0, 0, 0, 0, (z < building->GetWares(i) ? COLOR_WHITE : 0xFF404040) );
                waresPos.x += 24;
            }

            std::stringstream text;
            text << (unsigned int)building->GetWares(i) << "/" << wares_count;
            NormalFont->Draw(curPos + DrawPoint(0, 12), text.str(), glArchivItem_Font::DF_CENTER | glArchivItem_Font::DF_VCENTER);
            curPos.y += 29;
        }
    }
}
Example #2
0
//----------------------------------------------------------------------------------------------------//
// Here's where we draw the top view of the simulation.  We'll show the cannon location,
// the target location, and the shell trajectory.  The scale here is 1 pixel equals 1 meter.
//----------------------------------------------------------------------------------------------------//
void	DrawTopView(HDC hdc, RECT *r)
//----------------------------------------------------------------------------------------------------//
{
	int					w = (r->right - r->left);	// the window width
	int					h = (r->bottom - r->top);	// the window height
	RECT				tr;
	COLORREF			red = RGB(255,0,0);
	COLORREF			black = RGB(0,0,0);
	COLORREF			blue = RGB(0,0,255);
	COLORREF			white = RGB(255,255,255);
	COLORREF			green = RGB(0,255,0);
	int					x,z;

	// NOTE: the h/2 factor that you see in the following
	// calculations is an adjustment to place the origin
	// at mid-height in the window.  The window origin is
	// the upper left corner by default.

	if(time == 0)
		DrawRectangle(hdc, r, 1, black);

	// Draw target bounding box (we'll draw the target in red)
	tr.left = (int) (X - Length/2);
	tr.right = (int) (X + Length/2);
	tr.top = (int) (Z - Width/2 + h/2);
	tr.bottom = (int) (Z + Width/2 + h/2);
	DrawRectangle(hdc, &tr, 2, red);

	// Draw the cannon in black
	tr.left = 0;
	tr.top = h/2;
	tr.right = (int) (L * cos((90-Alpha) *3.14/180) * cos(Gamma * 3.14/180));
	tr.bottom = (int) (L * cos((90-Alpha) *3.14/180) * sin(Gamma * 3.14/180) + h/2);
	DrawLine(hdc, tr.left, tr.top, tr.right, tr.bottom, 2, blue);

	// Draw the shell in blue (only draw the shell if time is greater than zero, i.e.,
	// only after it leaves the barrel in our simulation
	if(time>0)
	{
		x = (int) (s.i);
		z = (int) (s.k + h/2);
		DrawLine(hdc, x, z, x, z, 2, green);
	}

	// Draw label for this view
	DrawString(hdc, 5, 20, "Top View", 8, 14);

}
Example #3
0
void ClipBitmapStyleEditor::Draw(wxDC& dc)
{
	if (!m_pClipBitmapStyle) return;

	const PieceInfo* pDefaultPieceInfo = m_pClipBitmapStyle->GetStatePiece(IStyle::SS_NORMAL);

	for (int i = 0; i < IStyle::SS_NUM; ++i)
	{
		const PieceInfo* pPieceInfo = pDefaultPieceInfo;
		const PieceInfo* pCurrPieceInfo = m_pClipBitmapStyle->GetStatePiece((IStyle::STYLE_STATE)i);
		if (pCurrPieceInfo) pPieceInfo = pCurrPieceInfo;

		if (!pPieceInfo)
		{
			dc.SetPen(wxPen(*wxLIGHT_GREY, Config::DISABLED_PEN_WIDTH));
			dc.SetBrush(*wxGREY_BRUSH);
			DrawRectangle(dc, m_rectState[i]);
			DrawLine(dc, wxPoint(m_rectState[i].x, m_rectState[i].y), wxPoint(m_rectState[i].x+m_rectState[i].width, m_rectState[i].y+m_rectState[i].height));
			DrawLine(dc, wxPoint(m_rectState[i].x, m_rectState[i].y+m_rectState[i].height), wxPoint(m_rectState[i].x+m_rectState[i].width, m_rectState[i].y));
		}
		else
		{
			DrawPiece(dc, m_rectState[i].GetPosition(), pPieceInfo);
		}
	}

	DrawSelection(dc);
}
Example #4
0
// Gameplay Screen Draw logic
void DrawGameplayScreen(void)
{
    // TODO: Draw GAMEPLAY screen here!
    
    HideCursor();
    
    // Background
    DrawTextureEx(bg, Vector2Zero(), 0, 10, WHITE);
    
    // Ground
    DrawRectangle(0, groundPositionY, GetScreenWidth(), 1, RED);
   
    DrawPlayer(player);
    
    // Draw triangles 
    for (int i=0; i<maxTriangles; i++)
    {
        if (triangles[i].isActive) DrawObjectOnCameraPosition(triangleTexture, triangles[i].position);
    }
    
    for (int i=0; i<maxPlatforms; i++)
    {
        if (platforms[i].isActive) DrawObjectOnCameraPosition(platformTexture, platforms[i].position);
        //if (platforms[i].isActive) DrawRectangleRec(platforms[i].collider, RED);
    }
    
    if (!startGame) DrawText ("PRESS SPACE", 20, GetScreenHeight()-30, 15, WHITE);
}
Example #5
0
/**
**	Draw selected rectangle around the unit.
**
**	@param unit	Pointer to the unit.
**	@param type	Type of the unit.
**	@param x	Screen X position of the unit.
**	@param y	Screen Y position of the unit.
*/
local void DrawSelectionRectangle(Unit* unit,UnitType* type,int x,int y)
{
    int color;

    //
    //	Select color for the rectangle
    //
    if( unit->Selected || (unit->Blink&1) ) {
	if( unit->Player->Player==PlayerNumNeutral ) {
	    color=ColorYellow;
	} else if( unit->Player==ThisPlayer ) {
	    color=ColorGreen;
	} else {
	    color=ColorRed;
	}
    } else if( CursorBuilding && type->Building && unit->Player==ThisPlayer ) {
	// If building mark all buildings
	color=ColorGray;
    } else {
	return;
    }

    DrawRectangle(color
	,x+(type->TileWidth*TileSizeX-type->BoxWidth)/2
	,y+(type->TileHeight*TileSizeY-type->BoxHeight)/2
	,type->BoxWidth
	,type->BoxHeight);
}
Example #6
0
void CDX10Renderer::DrawRectangleFill(const TVector2& _rv2Position, const float _kfWidth, const float _kfHeight, const bool _kHasBorder)
{
	m_pDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);

	//fill vertex buffer with vertices
	TVertex* pVerts = 0;

	// Set vertex buffer
	UINT stride = sizeof( TVertex );
	UINT offset = 0;
	m_pDevice->IASetVertexBuffers( 0, 1, &m_pVertexBuffer, &stride, &offset );

	m_pVertexBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**) &pVerts);

	pVerts[0] = TVertex(TVector3(_rv2Position.x - _kfWidth * 0.5f, _rv2Position.y + _kfHeight * 0.5f, 0), m_uiBrushColour);
	pVerts[1] = TVertex(TVector3(_rv2Position.x - _kfWidth * 0.5f, _rv2Position.y - _kfHeight * 0.5f, 0), m_uiBrushColour);
	pVerts[2] = TVertex(TVector3(_rv2Position.x + _kfWidth * 0.5f, _rv2Position.y + _kfHeight * 0.5f, 0), m_uiBrushColour);
	pVerts[3] = TVertex(TVector3(_rv2Position.x - _kfWidth * 0.5f, _rv2Position.y - _kfHeight * 0.5f, 0), m_uiBrushColour);
	pVerts[4] = TVertex(TVector3(_rv2Position.x + _kfWidth * 0.5f, _rv2Position.y + _kfHeight * 0.5f, 0), m_uiBrushColour);
	pVerts[5] = TVertex(TVector3(_rv2Position.x + _kfWidth * 0.5f, _rv2Position.y - _kfHeight * 0.5f, 0), m_uiBrushColour);

	m_pVertexBuffer->Unmap();
	m_pDevice->Draw(6, 0);

	if(_kHasBorder)
		DrawRectangle(_rv2Position, _kfWidth, _kfHeight);
}
void FForwardShadingSceneRenderer::CopySceneAlpha(FRHICommandListImmediate& RHICmdList, const FViewInfo& View)
{
	SCOPED_DRAW_EVENTF(RHICmdList, EventCopy, TEXT("CopySceneAlpha"));
	RHICmdList.SetRasterizerState(TStaticRasterizerState<FM_Solid, CM_None>::GetRHI());
	RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false,CF_Always>::GetRHI());
	RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());

	GSceneRenderTargets.ResolveSceneColor(RHICmdList);

	GSceneRenderTargets.BeginRenderingSceneAlphaCopy(RHICmdList);

	int X = GSceneRenderTargets.GetBufferSizeXY().X;
	int Y = GSceneRenderTargets.GetBufferSizeXY().Y;

	RHICmdList.SetViewport(0, 0, 0.0f, X, Y, 1.0f);

	TShaderMapRef<FScreenVS> ScreenVertexShader(View.ShaderMap);
	TShaderMapRef<FForwardCopySceneAlphaPS> PixelShader(View.ShaderMap);
	SetGlobalBoundShaderState(RHICmdList, FeatureLevel, ForwardCopySceneAlphaBoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *ScreenVertexShader, *PixelShader);

	PixelShader->SetParameters(RHICmdList, View);

	DrawRectangle( 
		RHICmdList,
		0, 0, 
		X, Y, 
		0, 0, 
		X, Y,
		FIntPoint(X, Y),
		GSceneRenderTargets.GetBufferSizeXY(),
		*ScreenVertexShader,
		EDRF_UseTriangleOptimization);

	GSceneRenderTargets.FinishRenderingSceneAlphaCopy(RHICmdList);
}
void FTranslucencyDrawingPolicyFactory::CopySceneColor(FRHICommandList& RHICmdList, const FViewInfo& View, const FPrimitiveSceneProxy* PrimitiveSceneProxy)
{

	SCOPED_DRAW_EVENTF(RHICmdList, EventCopy, TEXT("CopySceneColor for %s %s"), *PrimitiveSceneProxy->GetOwnerName().ToString(), *PrimitiveSceneProxy->GetResourceName().ToString());
	RHICmdList.SetRasterizerState(TStaticRasterizerState<FM_Solid, CM_None>::GetRHI());
	RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
	RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());

	GSceneRenderTargets.ResolveSceneColor(RHICmdList);

	GSceneRenderTargets.BeginRenderingLightAttenuation(RHICmdList);
	RHICmdList.SetViewport(View.ViewRect.Min.X, View.ViewRect.Min.Y, 0.0f, View.ViewRect.Max.X, View.ViewRect.Max.Y, 1.0f);

	TShaderMapRef<FScreenVS> ScreenVertexShader(View.ShaderMap);
	TShaderMapRef<FCopySceneColorPS> PixelShader(View.ShaderMap);
	SetGlobalBoundShaderState(RHICmdList, View.GetFeatureLevel(), CopySceneColorBoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *ScreenVertexShader, *PixelShader);

	/// ?
	PixelShader->SetParameters(RHICmdList, View);

	DrawRectangle(
		RHICmdList,
		0, 0, 
		View.ViewRect.Width(), View.ViewRect.Height(),
		View.ViewRect.Min.X, View.ViewRect.Min.Y, 
		View.ViewRect.Width(), View.ViewRect.Height(),
		FIntPoint(View.ViewRect.Width(), View.ViewRect.Height()),
		GSceneRenderTargets.GetBufferSizeXY(),
		*ScreenVertexShader,
		EDRF_UseTriangleOptimization);

	GSceneRenderTargets.FinishRenderingLightAttenuation(RHICmdList);
}
Example #9
0
/**
 *  Zeichenmethode
 *
 *  @return @p true bei Erfolg, @p false bei Fehler
 *
 *  @author FloSoft
 */
bool ctrlTable::Draw_(void)
{
	Draw3D(GetX(), GetY(), width, height, tc, 2);

	DrawControls();

	unsigned short lines = static_cast<unsigned short>((line_count > rows.size() ? rows.size() : line_count));
	ctrlScrollBar *scroll = GetCtrl<ctrlScrollBar>(0);

	for(unsigned short i = 0; i < lines; ++i)
	{
		if(row_l_selection == i + scroll->GetPos())
		{
			// durchsichtig schwarze Markierung malen
			DrawRectangle(GetX() + 2, GetY() + 2 + header_height + i*font->getHeight(), width - 4 - (scroll->GetVisible() ? 24 : 0), font->getHeight(), 0x80000000);
		}

		unsigned short pos = 0;
		for(unsigned short c = 0; c < columns.size(); ++c)
		{
			if(columns.at(c).width == 0)
				continue;

			font->Draw(GetX()+2+pos, GetY()+2 + header_height + i*font->getHeight(),rows.at(i+scroll->GetPos()).columns.at(c), 0, (row_l_selection == i + scroll->GetPos() ? 0xFFFFAA00 : COLOR_YELLOW), 0, GetCtrl<ctrlButton>(c+1)->GetWidth(), "");
			pos += GetCtrl<ctrlButton>(c+1)->GetWidth();
		}
	}

	return true;
}
Example #10
0
// DrawQuads (GL_QUADS)
void nuiSoftwarePainter::DrawQuadStrip(const nuiRenderArray* pArray)
{
  int32 i;
  int32 count = (pArray->GetSize() - 2) / 2;
  for (i = 0; i < count; i++)
  {
    int32 ii = i << 1;

    // Is the quad a special case?
    const std::vector<nuiRenderArray::Vertex>& rCoords = pArray->GetVertices();

    float x0 = rCoords[ii].mX, y0 = rCoords[ii+1].mY;
    float x1 = rCoords[(ii+1)].mX, y1 = rCoords[(ii+1)].mY;
    float x2 = rCoords[(ii+2)].mX, y2 = rCoords[(ii+2)].mY;
    float x3 = rCoords[(ii+3)].mX, y3 = rCoords[(ii+3)].mY;
    if (x0 == x3 && x1 == x2 && y0 == y1 && y2 == y3)
    {
      // This is an axis aligned rectangle
      DrawRectangle(pArray, ii, ii+1, ii+3, ii+2);
    }
    else
    {
      // This is not a special quad, draw two triangles:
      DrawTriangle(pArray, ii, ii+1, ii+2);
      DrawTriangle(pArray, ii+1, ii+3, ii+2);
    }
  }
}
Example #11
0
///////////////////////////////////////////////////////////////////////////////
//
// draw_mem function
//
// author: Shaun Gruenig, Hannah Aker, Kelsey Bellew
//
// description: This function call the appropriate GUI functions to create
//      a graphical representation of the physical memory.
//
//
///////////////////////////////////////////////////////////////////////////////
void draw_mem ( void )
{
    glClear ( GL_COLOR_BUFFER_BIT );
    glutSetWindowTitle ( "Memory Contents" );
    int i, j, yval;
    int address_num = 0;

    string t;
    stringstream out;
    char temp;
    char *f;
    int size = memvec.size();

    for ( j = 0; j < 8; j++ )
    {
        for ( i = 0; i < 32; i++ )
        {
            yval = ScreenHeight - 25 * i;

            out << address_num << "   ";
            out << ( bitset<sizeof ( address ) * 8> ) memvec[address_num++];
            t = out.str();
            f = ( char* ) t.c_str();
            DrawTextString ( f, j * 130 + 3, yval - 20, Black );
            out.str ( "" );
            DrawRectangle ( ( j * 130 ) + 30, yval, ( j + 1 ) * 130, 
					yval - 25, Black );
        }
    }

    glFlush();

}
Example #12
0
void HPlotter::PlotFillBinGrid(AppCtx* context)
{
    if (!IsEnabled())
        return;

    double startX, startY;
    double finishX, finishY;

    for (int i = 0; i < context->sprData.binGrid.nBinCols; i++)
        for (int j = 0; j < context->sprData.binGrid.nBinRows; j++)
        {
            startX  = context->sprData.binGrid.bins[i][j].xCoord - context->sprData.binGrid.binWidth / 2.0;
            startY  = context->sprData.binGrid.bins[i][j].yCoord - context->sprData.binGrid.binHeight / 2.0;
            finishX = context->sprData.binGrid.bins[i][j].xCoord + context->sprData.binGrid.binWidth / 2.0;
            finishY = context->sprData.binGrid.bins[i][j].yCoord + context->sprData.binGrid.binHeight / 2.0;
            DrawRectangle(startX, startY, finishX, finishY, Color_LightPink, false);

            char str1[255], str2[255];
            sprintf(str1, Aux::SciFormat.c_str(), context->sprData.binGrid.bins[i][j].sumBufPotential);
            sprintf(str2, Aux::SciFormat.c_str(), context->sprData.binGrid.bins[i][j].sumPotential);

            DrawTextInPoint(string(str1), 
                context->sprData.binGrid.bins[i][j].xCoord - context->sprData.binGrid.binWidth / 2.0, 
                context->sprData.binGrid.bins[i][j].yCoord - context->sprData.binGrid.binHeight / 2.5, 0.3);
            DrawTextInPoint(string(str2), 
                context->sprData.binGrid.bins[i][j].xCoord - context->sprData.binGrid.binWidth / 2.0, 
                context->sprData.binGrid.bins[i][j].yCoord + context->sprData.binGrid.binHeight / 3.2, 0.3);
        }
}
Example #13
0
// Ending Screen Draw logic
void DrawEndingScreen(void)
{
    // TODO: Draw ENDING screen here!
    DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLUE);
    DrawText("ENDING SCREEN", 20, 20, 40, DARKBLUE);
    DrawText("PRESS ENTER to RETURN to TITLE SCREEN", 120, 220, 20, DARKBLUE);
}
Example #14
0
/**
 *  Zeichenmethode.
 *
 *  @return @p true bei Erfolg, @p false bei Fehler
 *
 *  @author OLiver
 */
bool ctrlList::Draw_()
{
    ctrlScrollBar* scrollbar = GetCtrl<ctrlScrollBar>(0);

    // Box malen
    Draw3D(GetX(), GetY(), width_, height_, tc, 2);

    // Scrolleiste zeichnen
    DrawControls();

    // Wieviele Linien anzeigen?
    unsigned show_lines = (pagesize > lines.size() ? unsigned(lines.size()) : pagesize);

    // Listeneinträge zeichnen
    for(unsigned short i = 0; i < show_lines; ++i)
    {
        // Schwarze Markierung, wenn die Maus drauf ist
        if(i == mouseover)
            DrawRectangle(GetX() + 2, GetY() + 2 + i * font->getHeight(), width_ - 22, font->getHeight(), 0x80000000);

        // Text an sich
        font->Draw(GetX() + 2, GetY() + 2 + i * font->getHeight(), lines[i + scrollbar->GetPos()], 0, (selection_ == i + scrollbar->GetPos() ? 0xFFFFAA00 : 0xFFFFFF00), 0, width_ - 22);
    }

    return true;
}
void FPaperExtractSpritesViewportClient::Draw(FViewport* Viewport, FCanvas* Canvas)
{
	// Super will clear the viewport 
	FPaperEditorViewportClient::Draw(Viewport, Canvas);

	UTexture2D* Texture = TextureBeingExtracted.Get();

	if (Texture != nullptr)
	{
		const bool bUseTranslucentBlend = Texture->HasAlphaChannel();

		// Fully stream in the texture before drawing it.
		Texture->SetForceMipLevelsToBeResident(30.0f);
		Texture->WaitForStreaming();

		FLinearColor TextureDrawColor = Settings->TextureTint;
		//FLinearColor RectOutlineColor = FLinearColor::Yellow;
		const FLinearColor RectOutlineColor = Settings->OutlineColor;

		const float XPos = -ZoomPos.X * ZoomAmount;
		const float YPos = -ZoomPos.Y * ZoomAmount;
		const float Width = Texture->GetSurfaceWidth() * ZoomAmount;
		const float Height = Texture->GetSurfaceHeight() * ZoomAmount;

		Canvas->DrawTile(XPos, YPos, Width, Height, 0.0f, 0.0f, 1.0f, 1.0f, TextureDrawColor, Texture->Resource, bUseTranslucentBlend);

		for (FPaperExtractedSprite Sprite : ExtractedSprites)
		{
			DrawRectangle(Canvas, RectOutlineColor, Sprite.Rect);
		}
	}
}
Example #16
0
// Fade the screen
void _Graphics::FadeScreen(float Amount) {
	Graphics.SetProgram(Assets.Programs["ortho_pos"]);
	Graphics.SetVBO(VBO_NONE);

	Graphics.SetColor(glm::vec4(0.0f, 0.0f, 0.0f, Amount));
	DrawRectangle(glm::vec2(0, 0), WindowSize, true);
}
Example #17
0
void Composite::draw()
{
	glPushMatrix();
	for (int i = 0; i < children.size(); i++)
    {
    	if (currentDepth < globalSize) {
	    	// Draw big bounding box
	    	glPushMatrix();
			    glColor4f(color[0], color[1], color[2], color[3]);
			    glTranslatef(_padding*SCALE, -_padding*SCALE, 0);
			    
			    #ifdef BOX_3D
			    	DrawBox(children[i]->getWidth(), -children[i]->getHeight(), globalDepth);
			    #else
			    	DrawRectangle(children[i]->getWidth(), -children[i]->getHeight(), globalDepth);
			    #endif
		    
		    glPopMatrix();
	    }


	    // Draw children
	    glPushMatrix();
	    	currentDepth++;
		    if (currentDepth <= globalSize) 
		    	glTranslatef(_padding*SCALE, -_padding*SCALE, globalDepth);
	        children[i]->draw();
	        currentDepth--;
        glPopMatrix();

        nextChild(*children[i]);
    }
    glPopMatrix();
}
Example #18
0
//TextOut of DC.
VOID TextOut(HANDLE hDC,int x,int y,TCHAR* pszString)
{
	__DC* pDC = (__DC*)hDC;
	__WINDOW* pWindow = NULL;
	int strspace = 0;
	int ax = x;  //Actual x,should be adjusted later according to DC's base window.
	int ay = y;  //Actual y,should be adjusted later according to DC's base window.

	if((NULL == pDC) || (NULL == pszString))  //Invalid parameters.
	{
		return;
	}
	pWindow = (__WINDOW*)pDC->hWindow;
	if(pWindow)  //Window existing,adjust actual position of x and y.
	{
		if(pDC->dwDCType & DC_TYPE_CLIENT)  //Window client's DC.
		{
			ax += pWindow->xclient;
			ay += pWindow->yclient;
		}
		if(pDC->dwDCType & DC_TYPE_WINDOW)  //Window's DC.
		{
			ax += pWindow->x;
			ay += pWindow->y;
		}
	}
	//Clear the background of the text.
	strspace = strlen(pszString);
	strspace *= 8;
	DrawRectangle(pDC->pVideo,ax,ay,ax + strspace,ay + 16,
		pDC->pBrush->color,TRUE,pDC->pBrush->color);
	//Call device level text out routine to draw text.
	__TextOut(hDC,x,y,pszString);
	return;
}
Example #19
0
// Title Screen Draw logic
void DrawTitleScreen(void)
{
    // TODO: Draw TITLE screen here!
    DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), GREEN);
    DrawText("TITLE SCREEN", 20, 20, 40, DARKGREEN);
    DrawText("PRESS ENTER to JUMP to GAMEPLAY SCREEN", 160, 220, 20, DARKGREEN);
}
Example #20
0
// Ending Screen Draw logic
void DrawEndingScreen(void)
{
    // TODO: Draw ENDING screen here!
    DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLUE);
    DrawTextEx(font, "ENDING SCREEN", (Vector2){ 20, 10 }, font.baseSize*3, 4, DARKBLUE);
    DrawText("PRESS ENTER or TAP to RETURN to TITLE SCREEN", 120, 220, 20, DARKBLUE);
}
void FRCPassPostProcessWeightedSampleSum::DrawQuad(FRHICommandListImmediate& RHICmdList, bool bDoFastBlur, FIntRect SrcRect, FIntRect DestRect, bool bRequiresClear, FIntPoint DestSize, FIntPoint SrcSize, FShader* VertexShader) const
{
	if (bDoFastBlur)
	{
		if (FilterShape == EFS_Horiz)
		{
			SrcRect.Min.X = DestRect.Min.X * 2;
			SrcRect.Max.X = DestRect.Max.X * 2;
		}
		else
		{
			DestRect.Min.X = SrcRect.Min.X * 2;
			DestRect.Max.X = SrcRect.Max.X * 2;
		}
	}

	if (bRequiresClear)
	{
		RHICmdList.Clear(true, FLinearColor(0, 0, 0, 0), false, 1.0f, false, 0, DestRect);
	}

	// Draw a quad mapping scene color to the view's render target
	DrawRectangle(
		RHICmdList,
		DestRect.Min.X, DestRect.Min.Y,
		DestRect.Width(), DestRect.Height(),
		SrcRect.Min.X, SrcRect.Min.Y,
		SrcRect.Width(), SrcRect.Height(),
		DestSize,
		SrcSize,
		VertexShader,
		EDRF_UseTriangleOptimization);
}
/** Draws a full view quad that sets stencil to 1 anywhere that decals should not be projected. */
void StencilDecalMask(const FSceneView& View)
{
	SCOPED_DRAW_EVENT(StencilDecalMask, DEC_SCENE_ITEMS);
	RHISetRasterizerState(TStaticRasterizerState<FM_Solid,CM_None>::GetRHI());
	RHISetBlendState(TStaticBlendState<CW_NONE>::GetRHI());
	RHISetRenderTarget(NULL, GSceneRenderTargets.GetSceneDepthSurface());
	RHISetViewport(View.ViewRect.Min.X, View.ViewRect.Min.Y, 0.0f, View.ViewRect.Max.X, View.ViewRect.Max.Y, 1.0f);

	// Write 1 to highest bit of stencil to areas that should not receive decals
	RHISetDepthStencilState(TStaticDepthStencilState<false,CF_Always,true,CF_Always,SO_Replace,SO_Replace,SO_Replace>::GetRHI(), 0x80);

	TShaderMapRef<FScreenVS> ScreenVertexShader(GetGlobalShaderMap());
	TShaderMapRef<FStencilDecalMaskPS> PixelShader(GetGlobalShaderMap());
	
	SetGlobalBoundShaderState(StencilDecalMaskBoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *ScreenVertexShader, *PixelShader);

	PixelShader->SetParameters(View);

	DrawRectangle( 
		0, 0, 
		View.ViewRect.Width(), View.ViewRect.Height(),
		View.ViewRect.Min.X, View.ViewRect.Min.Y, 
		View.ViewRect.Width(), View.ViewRect.Height(),
		FIntPoint(View.ViewRect.Width(), View.ViewRect.Height()),
		GSceneRenderTargets.GetBufferSizeXY(),
		EDRF_UseTriangleOptimization);
}
Example #23
0
/**
 *  Zeichenmethode.
 *
 *  @return @p true bei Erfolg, @p false bei Fehler
 */
bool ctrlPercent::Draw_()
{
    // Wenn der Prozentsatzpointer = 0, dann wird 0 angezeigt und es soll nich abstürzen!
    unsigned short percentage = (this->percentage_ ?  *this->percentage_ : 0);

    // Farbe herausfinden
    unsigned int color = 0xFFFF0000;

    if(percentage > 100)
        percentage = 100;

    // Farbe wählen je nachdem wie viel Prozent
    if(percentage >= 60)
        color = 0xFF00E000;
    else if(percentage >= 30)
        color = 0xFFFFFF00;
    else if(percentage >= 20)
        color = 0xFFFF8000;

    // Box zeichnen
    Draw3D(GetX(), GetY(), width_, height_, tc, 2);

    // Fortschritt zeichnen
    DrawRectangle(GetX() + 4, GetY() + 4, (width_ - 8)*percentage / 100, height_ - 8, color);

    // Text zeichnen
    char caption[256];
    sprintf(caption, "%u%%", percentage);
    font->Draw(GetX() + width_ / 2, GetY() + height_ / 2, caption, glArchivItem_Font::DF_CENTER | glArchivItem_Font::DF_VCENTER, text_color);

    return true;
}
Example #24
0
/**
 *
 *
 *  @author jh
 */
void iwStatistics::Msg_PaintAfter()
{
    // Die farbigen Boxen unter den Spielerportraits malen
    unsigned short startX = 126 - numPlayingPlayers * 17;
    unsigned pos = 0;
    for (unsigned i = 0; i < GAMECLIENT.GetPlayerCount(); ++i)
    {
        GameClientPlayer& player = GAMECLIENT.GetPlayer(i);
        if (!(player.ps == PS_KI || player.ps == PS_OCCUPIED))
        {
            continue;
        }
        if (activePlayers[i])
        {
            DrawRectangle(this->x_ + startX + pos * 34, this->y_ + 68, 34, 12, COLORS[player.color]);
        }
        pos++;
    }

    // Koordinatenachsen malen
    DrawAxis();

    // Statistiklinien malen
    DrawStatistic(currentView);
}
Example #25
0
void CDX10Renderer::DrawRectangleFill(const TRect& _krRect, const bool _kHasBorder)
{
	m_pDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);

	//fill vertex buffer with vertices
	TVertex* pVerts = 0;

	// Set vertex buffer
	UINT stride = sizeof( TVertex );
	UINT offset = 0;
	m_pDevice->IASetVertexBuffers( 0, 1, &m_pVertexBuffer, &stride, &offset );

	m_pVertexBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**) &pVerts);

	pVerts[0] = TVertex(TVector3(_krRect.x1, _krRect.y2, 0), m_uiBrushColour);
	pVerts[1] = TVertex(TVector3(_krRect.x1, _krRect.y1, 0), m_uiBrushColour);
	pVerts[2] = TVertex(TVector3(_krRect.x2, _krRect.y2, 0), m_uiBrushColour);
	pVerts[3] = TVertex(TVector3(_krRect.x1, _krRect.y1, 0), m_uiBrushColour);
	pVerts[4] = TVertex(TVector3(_krRect.x2, _krRect.y1, 0), m_uiBrushColour);
	pVerts[5] = TVertex(TVector3(_krRect.x2, _krRect.y2, 0), m_uiBrushColour);

	m_pVertexBuffer->Unmap();
	m_pDevice->Draw(6, 0);

	if(_kHasBorder)
		DrawRectangle(_krRect);
}
void DrawPostProcessPass(
	FRHICommandList& RHICmdList,
	float X,
	float Y,
	float SizeX,
	float SizeY,
	float U,
	float V,
	float SizeU,
	float SizeV,
	FIntPoint TargetSize,
	FIntPoint TextureSize,
	FShader* VertexShader,
	EStereoscopicPass StereoView,
	bool bHasCustomMesh,
	EDrawRectangleFlags Flags)
{
	if (bHasCustomMesh && StereoView != eSSP_FULL)
	{
		DrawHmdMesh(RHICmdList, X, Y, SizeX, SizeY, U, V, SizeU, SizeV, TargetSize, TextureSize, StereoView, VertexShader);
	}
	else
	{
		DrawRectangle(RHICmdList, X, Y, SizeX, SizeY, U, V, SizeU, SizeV, TargetSize, TextureSize, VertexShader, Flags);
	}
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)   
{
	switch (message)    
	{
	case   WM_PAINT:
		DrawRectangle() ;
		ValidateRect(g_Hwnd, NULL) ;
		return 0 ;

	case WM_KEYDOWN: 
		{ 
			switch( wParam ) 
			{ 
			case VK_ESCAPE: 
				SendMessage( hwnd, WM_CLOSE, 0, 0 ); 
				break ; 
			default: 
				break ; 
			} 
		} 
		break ; 

	case WM_DESTROY: 
		Cleanup(); 
		PostQuitMessage( 0 ); 
		return 0; 
	}

	return DefWindowProc (hwnd, message, wParam, lParam) ;
}
/**
 *  Zeichenmethode.
 *
 *  @return @p true bei Erfolg, @p false bei Fehler
 */
void ctrlPercent::Draw_()
{
    // Wenn der Prozentsatzpointer = 0, dann wird 0 angezeigt und es soll nich abstürzen!
    unsigned short percentage = (this->percentage_ ? *this->percentage_ : 0);

    if(percentage > 100)
        percentage = 100;

    // Farbe wählen je nachdem wie viel Prozent
    unsigned color;
    if(percentage >= 60)
        color = COLOR_60_PERCENT;
    else if(percentage >= 30)
        color = COLOR_30_PERCENT;
    else if(percentage >= 20)
        color = COLOR_20_PERCENT;
    else
        color = COLOR_0_PERCENT;

    // Box zeichnen
    Draw3D(Rect(GetDrawPos(), GetSize()), tc, false);

    // Fortschritt zeichnen
    Extent progSize = GetSize() - Extent(8, 8);
    progSize.x = (progSize.x * percentage) / 100;
    DrawRectangle(Rect(GetDrawPos() + DrawPoint(4, 4), progSize), color);

    // Text zeichnen
    std::string caption = helpers::toString(percentage) + "%";
    font->Draw(GetDrawPos() + DrawPoint(GetSize()) / 2, caption, FontStyle::CENTER | FontStyle::VCENTER, text_color);
}
Example #29
0
void CTank::Draw(void)
{
	if (this->GetLife() > 0)
	{
		glPushMatrix();
		glTranslated(this->position.x, this->position.y, this->position.z);
		glRotated(this->Angle, 0.0, 0.0, 1.0);
		glColor3d(this->barrelColour.red, this->barrelColour.green, this->barrelColour.blue);

		glPushMatrix();
		// draw the barrel
		glRotated(this->barrelAngle, 0.0, 0.0, 1.0);
		glTranslated(this->barrelWidth / 2, this->barrelHeight / 2, 0.0);
		this->DrawRectangle(this->barrelWidth, this->barrelHeight);
		glPopMatrix();

		glColor3d(this->objectColour.red, this->objectColour.green, this->objectColour.blue);

		glPushMatrix();
		// draw the base
		DrawRectangle(this->tankWidth, this->tankHeight);
		glPopMatrix();

		glPopMatrix();
	}
}
Example #30
0
void ClipBitmapStyleEditor::DrawSelection(wxDC& dc)
{
	if (m_eSelState < 0 || m_eSelState >= IStyle::SS_NUM) return;
	dc.SetPen(*wxRED_PEN);
	dc.SetBrush(*wxTRANSPARENT_BRUSH);
	DrawRectangle(dc, m_rectState[m_eSelState]);
}