本文整理汇总了C++中DrawRectangle函数的典型用法代码示例。如果您正苦于以下问题:C++ DrawRectangle函数的具体用法?C++ DrawRectangle怎么用?C++ DrawRectangle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DrawRectangle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawRectangle
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;
}
}
}
示例2: DrawTopView
//----------------------------------------------------------------------------------------------------//
// 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);
}
示例3: DrawRectangle
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);
}
示例4: DrawGameplayScreen
// 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);
}
示例5: DrawSelectionRectangle
/**
** 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);
}
示例6: sizeof
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);
}
示例7: SCOPED_DRAW_EVENTF
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);
}
示例8: SCOPED_DRAW_EVENTF
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);
}
示例9: Draw3D
/**
* 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;
}
示例10: DrawRectangle
// 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);
}
}
}
示例11: draw_mem
///////////////////////////////////////////////////////////////////////////////
//
// 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();
}
示例12: DrawRectangle
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);
}
}
示例13: DrawEndingScreen
// 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);
}
示例14: Draw3D
/**
* 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;
}
示例15: DrawRectangle
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);
}
}
}