Ejemplo n.º 1
0
void CustomColorsSystem::UpdateBrushTool(float32 timeElapsed)
{
	Sprite* colorSprite = drawSystem->GetCustomColorsProxy()->GetSprite();
	
	RenderManager::Instance()->SetRenderTarget(colorSprite);

	RenderManager::Instance()->SetColor(drawColor);

	Vector2 spriteSize = Vector2(cursorSize, cursorSize);
	Vector2 spritePos = cursorPosition - spriteSize / 2.f;
	
    Sprite::DrawState drawState;
	drawState.SetScaleSize(spriteSize.x / Core::GetVirtualToPhysicalFactor(),
                           spriteSize.y / Core::GetVirtualToPhysicalFactor(),
                           toolImageSprite->GetWidth(),
                           toolImageSprite->GetHeight());
	drawState.SetPosition(spritePos / Core::GetVirtualToPhysicalFactor());
	toolImageSprite->Draw(&drawState);
	
	RenderManager::Instance()->RestoreRenderTarget();
	RenderManager::Instance()->SetColor(Color::White);
	
	drawSystem->GetLandscapeProxy()->SetCustomColorsTexture(colorSprite->GetTexture());
	
	Rect updatedRect;
	updatedRect.SetCenter(spritePos);
	updatedRect.SetSize(spriteSize);
    
	AddRectToAccumulator(updatedRect);
}
Ejemplo n.º 2
0
void PVRTest::Draw(const DAVA::UIGeometricData &geometricData)
{
    RenderManager::Instance()->ClearWithColor(0.f, 0.0f, 0.f, 1.f);
    
    Sprite::DrawState state;
    state.SetFrame(0);

    if(pngSprite)
    {
        state.SetPosition(0.f, 0.f);
        state.SetScaleSize(256.f, 256.f, pngSprite->GetWidth(), pngSprite->GetHeight());
        pngSprite->Draw(&state);
    }
    
    if(pvrSprite)
    {
        state.SetPosition(260.f, 0.f);
        state.SetScaleSize(256.f, 256.f, pvrSprite->GetWidth(), pvrSprite->GetHeight());
        pvrSprite->Draw(&state);
    }
    
    TestTemplate<PVRTest>::Draw(geometricData);
}