当前位置: 首页>>代码示例>>C++>>正文


C++ Painter::drawTexture方法代码示例

本文整理汇总了C++中Painter::drawTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ Painter::drawTexture方法的具体用法?C++ Painter::drawTexture怎么用?C++ Painter::drawTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Painter的用法示例。


在下文中一共展示了Painter::drawTexture方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: draw

void EconomyGraph::draw( Painter& painter ){
   
    Color white;
    white.parse( "white" );
    
    Rect2D background( 0, 0, getWidth(), getHeight() );
    int mgX = border;
    int mgY = 3*border;
    int mgW = getConfig()->monthgraphW; 
    int mgH = getConfig()->monthgraphH;
    
    painter.setFillColor( white );
    painter.fillRectangle( background );

    Vector2 labelPos( 2 * border, border-1 );
    
    //Draw HistoryLineGraph
    painter.drawTexture( labelTextureEconomy, labelPos ); 
    Rect2D currentGraph( mgX, mgY, mgX + mgW, mgY + mgH );
    drawHistoryLineGraph( painter, currentGraph );

    //Draw Sustainability Bars
    labelPos.y += 2 * border + mgH; 
    painter.drawTexture( labelTextureSustainability, labelPos ); 
    currentGraph.move( Vector2( 0, 2 * border + mgH ) );
    drawSustBarGraph( painter, currentGraph);

    //Draw FPS-Window
    labelPos.y += 2 * border + mgH; 
    painter.drawTexture( labelTextureFPS, labelPos ); 
    currentGraph.move( Vector2( 0, 2 * border + mgH ) );
    currentGraph.setHeight( mgH/2 );
    drawFPSGraph( painter, currentGraph );
}
开发者ID:BackupTheBerlios,项目名称:lincity-ng-svn,代码行数:34,代码来源:EconomyGraph.cpp

示例2:

void
Image::draw(Painter& painter)
{
    if(width != texture->getWidth() || height != texture->getHeight())
        painter.drawStretchTexture(texture, Rect2D(0, 0, width, height));
    else
        painter.drawTexture(texture, Vector2(0, 0));
}
开发者ID:BackupTheBerlios,项目名称:lincity-ng-svn,代码行数:8,代码来源:Image.cpp

示例3:

void
Panel::draw(Painter& painter)
{
    if(background)
        painter.drawTexture(background, Vector2(0, 0));
    
    Component::draw(painter);
}
开发者ID:BackupTheBerlios,项目名称:lincity-ng-svn,代码行数:8,代码来源:Panel.cpp

示例4:

void
Gradient::draw(Painter& painter)
{
    painter.drawTexture(texture.get(), Vector2(0, 0));
}
开发者ID:SirIvanMoReau,项目名称:lincity-ng,代码行数:5,代码来源:Gradient.cpp

示例5:

void
DocumentImage::draw(Painter& painter)
{
    painter.drawTexture(texture, Vector2(0, 0));
}
开发者ID:SirIvanMoReau,项目名称:lincity-ng,代码行数:5,代码来源:DocumentImage.cpp

示例6: drawSustBarGraph

void EconomyGraph::drawSustBarGraph( Painter& painter, Rect2D mg ){ 
    // see oldgui/screen.cpp do_sust_barchart
    Color grey,yellow,orange,black,green,blue,red;
    grey.parse( "#A9A9A9FF" );
    yellow.parse( "yellow" );
    orange.parse( "orange" );
    black.parse( "black" );
    green.parse( "green" );
    blue.parse( "blue" );
    red.parse( "red" );

    painter.setFillColor( grey );
    painter.fillRectangle( mg );
  
    int mgX = (int) mg.p1.x;
    int mgY = (int) mg.p1.y;
    int mgW = (int) mg.getWidth(); 
    int mgH = (int) mg.getHeight();

    Vector2 a, b, p;
    
#define SUST_BAR_H      5
#define SUST_BAR_GAP_Y  5

	/* draw the starting line */
    a.x = mgX + 38;
    a.y = mgY;
    b.x = mgX + 38;
    b.y = mgY + mgH;
    p.x = mgX;
    p.y = mgY;
    painter.setLineColor( yellow );
    painter.drawLine( a, b);
    
    Rect2D bar;
    bar.p1.x = mgX + 36;
    bar.p1.y = mgY + SUST_BAR_GAP_Y;
    bar.setHeight( SUST_BAR_H );
    int maxBarLen = mgW - 40;
    int newLen;
    int len; 
    
	/* ore coal */
    newLen = maxBarLen * sust_dig_ore_coal_count / SUST_ORE_COAL_YEARS_NEEDED;
    len = 3 + ( ( newLen > maxBarLen ) ? maxBarLen : newLen );
    bar.setWidth( len );
    painter.setFillColor( orange );
    painter.fillRectangle( bar );
    painter.drawTexture( labelTextureMIN, p ); 
    
	/* import export */
    p.y += SUST_BAR_H + SUST_BAR_GAP_Y ;
    newLen = maxBarLen * sust_port_count / SUST_PORT_YEARS_NEEDED;
    len = 3 + ( ( newLen > maxBarLen ) ? maxBarLen : newLen );
    bar.setWidth( len );
    painter.setFillColor( black );
    bar.move( Vector2( 0, SUST_BAR_H + SUST_BAR_GAP_Y ) );
    painter.fillRectangle( bar );
    painter.drawTexture( labelTexturePRT, p ); 
    
	/* money */
    p.y += SUST_BAR_H + SUST_BAR_GAP_Y ;
    newLen = maxBarLen * sust_old_money_count / SUST_MONEY_YEARS_NEEDED;
    len = 3 + ( ( newLen > maxBarLen ) ? maxBarLen : newLen );
    bar.setWidth( len );
    painter.setFillColor( green );
    bar.move( Vector2( 0, SUST_BAR_H + SUST_BAR_GAP_Y ) );
    painter.fillRectangle( bar );
    painter.drawTexture( labelTextureMNY, p ); 
    
	/* population */
    p.y += SUST_BAR_H + SUST_BAR_GAP_Y ;
    newLen = maxBarLen * sust_old_population_count / SUST_POP_YEARS_NEEDED;
    len = 3 + ( ( newLen > maxBarLen ) ? maxBarLen : newLen );
    bar.setWidth( len );
    painter.setFillColor( blue );
    bar.move( Vector2( 0, SUST_BAR_H + SUST_BAR_GAP_Y ) );
    painter.fillRectangle( bar );
    painter.drawTexture( labelTexturePOP, p ); 
    
	/* tech */
    p.y += SUST_BAR_H + SUST_BAR_GAP_Y ;
    newLen = maxBarLen * sust_old_tech_count / SUST_TECH_YEARS_NEEDED;
    len = 3 + ( ( newLen > maxBarLen ) ? maxBarLen : newLen );
    bar.setWidth( len );
    painter.setFillColor( yellow );
    bar.move( Vector2( 0, SUST_BAR_H + SUST_BAR_GAP_Y ) );
    painter.fillRectangle( bar );
    painter.drawTexture( labelTextureTEC, p ); 
    
	/* fire */
    p.y += SUST_BAR_H + SUST_BAR_GAP_Y ;
    newLen = maxBarLen * sust_fire_count / SUST_FIRE_YEARS_NEEDED;
    len = 3 + ( ( newLen > maxBarLen ) ? maxBarLen : newLen );
    bar.setWidth( len );
    painter.setFillColor( red );
    bar.move( Vector2( 0, SUST_BAR_H + SUST_BAR_GAP_Y ) );
    painter.fillRectangle( bar );
    painter.drawTexture( labelTextureFIR, p ); 
}
开发者ID:BackupTheBerlios,项目名称:lincity-ng-svn,代码行数:100,代码来源:EconomyGraph.cpp


注:本文中的Painter::drawTexture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。