Renderer: Replaced RenderTarget::Get[Height|Width] by RenderTarget::GetSize
Utility: Removed Window::Get[Height|Width] methods
This commit is contained in:
@@ -251,21 +251,20 @@ bool LogoExample::Update(Ndk::StateMachine& fsm, float elapsedTime)
|
||||
|
||||
void LogoExample::ResetParticles(float elapsed)
|
||||
{
|
||||
unsigned int width = m_shared.target->GetWidth();
|
||||
unsigned int height = m_shared.target->GetHeight();
|
||||
Nz::Vector2ui size = m_shared.target->GetSize();
|
||||
|
||||
Nz::Vector2f center = {width / 2.f, height / 2.f};
|
||||
Nz::Vector2f center = {size.x / 2.f, size.y / 2.f};
|
||||
Nz::Vector2f offset = center - Nz::Vector2f(Nz::Vector2ui(m_logo.GetSize()) / 2);
|
||||
|
||||
std::uniform_real_distribution<float> disX(0.f, float(width));
|
||||
std::uniform_real_distribution<float> disY(-float(height) * 0.5f, float(height) * 1.5f);
|
||||
std::uniform_real_distribution<float> disX(0.f, float(size.x));
|
||||
std::uniform_real_distribution<float> disY(-float(size.y) * 0.5f, float(size.y) * 1.5f);
|
||||
|
||||
ParticleData* sprite = static_cast<ParticleData*>(m_particles);
|
||||
for (PixelData& data : m_pixels)
|
||||
{
|
||||
sprite->color = data.color;
|
||||
sprite->destination = offset + Nz::Vector2f(data.pos);
|
||||
sprite->position.Set(disX(m_shared.randomGen) - float(width), disY(m_shared.randomGen), 0.f);
|
||||
sprite->position.Set(disX(m_shared.randomGen) - float(size.x), disY(m_shared.randomGen), 0.f);
|
||||
sprite->velocity = Nz::Vector2f::Zero();
|
||||
sprite++;
|
||||
}
|
||||
|
||||
@@ -820,5 +820,6 @@ void SpacebattleExample::OnMouseMoved(const Nz::EventHandler* /*eventHandler*/,
|
||||
m_turretCannonBaseRotation = Nz::Clamp(m_turretCannonBaseRotation + speed * event.deltaY, -65.f, 40.f);
|
||||
m_turretBaseRotation -= event.deltaX * speed;
|
||||
|
||||
Nz::Mouse::SetPosition(m_shared.target->GetWidth() / 2, m_shared.target->GetHeight() / 2, *m_shared.target);
|
||||
Nz::Vector2ui size = m_shared.target->GetSize();
|
||||
Nz::Mouse::SetPosition(size.x / 2, size.y / 2, *m_shared.target);
|
||||
}
|
||||
|
||||
@@ -100,9 +100,10 @@ int main()
|
||||
Nz::Boxf fpsCountBox = fpsGfx.GetBoundingVolume().aabb;
|
||||
Nz::Boxf particleCountBox = particleCountGfx.GetBoundingVolume().aabb;
|
||||
|
||||
Nz::Vector2ui windowSize = window.GetSize();
|
||||
demoNameNode.SetPosition(5.f, 5.f);
|
||||
particleCountNode.SetPosition(5.f, window.GetHeight() - particleCountBox.height - 5.f);
|
||||
fpsNode.SetPosition(5.f, window.GetHeight() - fpsCountBox.height - particleCountBox.height - 5.f);
|
||||
particleCountNode.SetPosition(5.f, windowSize.y - particleCountBox.height - 5.f);
|
||||
fpsNode.SetPosition(5.f, windowSize.x - fpsCountBox.height - particleCountBox.height - 5.f);
|
||||
|
||||
|
||||
shared.demos.push_back(std::make_shared<LogoExample>(shared));
|
||||
|
||||
Reference in New Issue
Block a user