Examples: Pass argc/argv to Application

This commit is contained in:
SirLynix
2023-07-30 12:46:18 +02:00
parent 816d9d1174
commit a7eba496fb
12 changed files with 28 additions and 31 deletions

View File

@@ -65,7 +65,7 @@ struct SpotLight
Nz::RadianAnglef outerAngle = Nz::DegreeAnglef(20.f);
};
int main()
int main(int argc, char* argv[])
{
std::filesystem::path resourceDir = "assets/examples";
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
@@ -75,7 +75,7 @@ int main()
if (!std::filesystem::is_directory(shaderDir) && std::filesystem::is_directory("../.." / shaderDir))
shaderDir = "../.." / shaderDir;
Nz::Application<Nz::Graphics> app;
Nz::Application<Nz::Graphics> app(argc, argv);
nzsl::ShaderWriter::States states;
states.shaderModuleResolver = Nz::Graphics::Instance()->GetShaderModuleResolver();
@@ -343,9 +343,6 @@ int main()
light.radius = radiusDis(randomEngine);
}
unsigned int offscreenWidth = windowSize.x;
unsigned int offscreenHeight = windowSize.y;
// Bloom data
Nz::RenderPipelineLayoutInfo fullscreenPipelineLayoutInfoViewer;
@@ -1145,9 +1142,9 @@ int main()
if (lightAnimation)
elapsedTime += deltaTime;
if (std::optional<Nz::Time> deltaTime = updateClock.RestartIfOver(Nz::Time::TickDuration(60)))
if (std::optional<Nz::Time> movementDuration = updateClock.RestartIfOver(Nz::Time::TickDuration(60)))
{
float cameraSpeed = 2.f * deltaTime->AsSeconds();
float cameraSpeed = 2.f * movementDuration->AsSeconds();
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Up) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Z))
viewerPos += camQuat * Nz::Vector3f::Forward() * cameraSpeed;