TEST_F(ConstantVelocityTransitionAnimatorTest, should_handle_multiple_transitions)
 {
     animator.addTransition(FIRST, SECOND, sprite);
     
     setElapsedTime(FIRST_SECOND_DISTANCE / VELOCITY / 2);
     animator.addTransition(FIRST2, SECOND2, sprite2);
     
     animator.updateFrame();
     
     InSequence order;
     EXPECT_CALL(*sprite, drawAt(FIRST_SECOND_MIDPOINT));
     EXPECT_CALL(*sprite2, drawAt(FIRST2));
     animator.drawFrame();
 }
void CStarCrosshairs::drawEntry(int index, CVideoSurface *surface, CStarField *starField, CStarMarkers *markers) {
	surface->lock();
	CSurfaceArea surfaceArea(surface);
	drawAt(_entries[index], &surfaceArea);
	surface->unlock();

	const CBaseStarEntry *starP = starField->getDataPtr(_entries[index]._index1);
	markers->addStar(starP);
}
Exemple #3
0
void GraphicsTCOD::drawAll()
{
    
    for(int x = 0; x < MAP_WINDOW_WIDTH; x++)
    {
        for(int y=0; y < MAP_WINDOW_HEIGHT; y++)
        {
            
            drawAt(x, y);
        }
    }
}
 void assertDrawAt(MockSpritePtr sprite, Position pos)
 {
     EXPECT_CALL(*sprite, drawAt(pos));
     animator.drawFrame();
 }
Exemple #5
0
void DSBBranch::redraw()
{
    drawAt(m_basept);
}
Exemple #6
0
void DSBBranch::drawRelTo(QPointF q)
{
    QPointF r = m_relpt + q;
    drawAt(r);
}
Exemple #7
0
		Quad drawAt(const Vec2& pos, const ColorF& diffuse = Palette::White) const
		{
			return drawAt(pos.x, pos.y, diffuse);
		}
void CStarCrosshairs::eraseCurrent(CSurfaceArea *surfaceArea) {
	assert(_entryIndex >= 0);
	const CStarPosition &pt = _entries[_entryIndex];
	drawAt(pt, surfaceArea);
}
void CStarCrosshairs::drawStar(int index, CSurfaceArea *surfaceArea) {
	if (index >= 0 && index < (int)_positions.size()) {
		const CStarPosition &pt = _positions[index];
		drawAt(pt, surfaceArea);
	}
}
Exemple #10
0
void FreePathway::redraw()
{
    drawAt(m_basept);
}
Exemple #11
0
void FreePathway::drawRelTo(QPointF q)
{
    QPointF r = m_relpt + q;
    drawAt(r);
}
Exemple #12
0
/**
 * Draw tiles and map objects.
 */
void MapRenderer::render(int worldX, int worldY, SquadSelection *pSelection) {
    // TODO: after a lot of attempts to fix this, map drawing remains buggy
    MapTilePoint mtp = pMap_->screenToTilePoint(worldX, worldY);
    int sw = mtp.tx;
    int chk = g_Screen.gameScreenWidth() / (TILE_WIDTH / 2) + 2
        + g_Screen.gameScreenHeight() / (TILE_HEIGHT / 3) + pMap_->maxZ() * 2;
    int swm = sw + chk;
    int sh = mtp.ty - 8;

    int shm = sh + chk;

#ifdef EXECUTION_SPEED_TIME
    printf("---------------------------");
    int measure_ticks = SDL_GetTicks();
    printf("start time %i.%i\n", measure_ticks/1000, measure_ticks%1000);
#endif

    createFastKeys(sw, sh, swm, shm);
    int cmw = worldX + g_Screen.gameScreenWidth() -
                g_Screen.gameScreenLeftMargin() + 128;
    int cmh = worldY + g_Screen.gameScreenHeight() + 128;
    int cmx = worldX - g_Screen.gameScreenLeftMargin();
     //  z = 0 - is minimap data and mapdata
    int chky = sh < 0 ? 0 : sh;
    int zr = shm + pMap_->maxZ() + 1;
    for (int inc = 0; inc < zr; ++inc) {
        int ye = sh + inc;
        int ys = ye - pMap_->maxZ() - 2;
        int tile_z = pMap_->maxZ() + 1;  // the Z coord of the next tile to draw
        for (int yb = ys; yb < ye; ++yb) {
            if (yb < 0 || yb < sh || yb >= shm) {
                --tile_z;
                continue;
            }
            int tile_y = yb;  // The Y coord of the tile to draw
            for (int tile_x = sw; tile_y >= chky && tile_x < pMap_->maxX(); ++tile_x) {
                if (tile_x < 0 || tile_y >= pMap_->maxY()) {
                    --tile_y;
                    continue;
                }
                int screen_w = (pMap_->maxX() + (tile_x - tile_y)) * (TILE_WIDTH / 2);
                // int screen_h = (max_z_ + w + h) * (TILE_HEIGHT / 3);
                int coord_h = ((pMap_->maxZ() + tile_x + tile_y) - (tile_z - 1)) * (TILE_HEIGHT / 3);
                if (screen_w >= worldX - TILE_WIDTH * 2
                    && screen_w + TILE_WIDTH * 2 < cmw
                    && coord_h >= worldY - TILE_HEIGHT * 2
                    && coord_h + TILE_HEIGHT * 2 < cmh) {
#if 0
                    if (z > 2)
                        continue;
#endif
                    // draw a tile
                    if (tile_z < pMap_->maxZ()) {
                        Tile *p_tile = pMap_->getTileAt(tile_x, tile_y, tile_z);
                        if (p_tile->notTransparent()) {
                            int dx = 0, dy = 0;
                            if (screen_w - worldX < 0)
                                dx = -(screen_w - worldX);
                            if (coord_h - worldY < 0)
                                dy = -(coord_h - worldY);
                            if (dx < TILE_WIDTH && dy < TILE_HEIGHT) {
                                p_tile->drawToScreen(screen_w - cmx, coord_h - worldY);
                            }
                        }
                    }

                    // draw everything that's on the tile
                    if (tile_z - 1 >= 0) {
                        drawAt(tile_x, tile_y, tile_z - 1,
                            screen_w - cmx + TILE_WIDTH / 2,
                            coord_h - worldY + TILE_HEIGHT / 3 * 2);
                    }
                }
                --tile_y;
            }
            --tile_z;
        }
    }

#ifdef _DEBUG
    if (g_System.getKeyModState() & KMD_LALT) {
        for (SquadSelection::Iterator it = pSelection->begin();
            it != pSelection->end(); ++it) {
            (*it)->showPath(worldX, worldY);
        }
    }
#endif

#ifdef EXECUTION_SPEED_TIME
    printf("+++++++++++++++++++++++++++");
    int measure_ticks_end = SDL_GetTicks();
    printf("end time %i.%i,%i\n", measure_ticks_end/1000, measure_ticks_end%1000,
        measure_ticks_end - measure_ticks);
#endif
}
Exemple #13
0
void ToggleButton::draw() {
  drawAt(0,0, false);
}