Examples: Pass argc/argv to Application
This commit is contained in:
parent
816d9d1174
commit
a7eba496fb
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
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))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Application<Nz::Audio> app;
|
||||
Nz::Application<Nz::Audio> app(argc, argv);
|
||||
app.AddComponent<Nz::SignalHandlerAppComponent>();
|
||||
|
||||
Nz::Sound sound;
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@
|
|||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
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))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Application<Nz::Graphics> app;
|
||||
Nz::Application<Nz::Graphics> app(argc, argv);
|
||||
|
||||
std::shared_ptr<Nz::RenderDevice> device = Nz::Graphics::Instance()->GetRenderDevice();
|
||||
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@
|
|||
|
||||
NAZARA_REQUEST_DEDICATED_GPU()
|
||||
|
||||
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))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Application<Nz::Graphics, Nz::ChipmunkPhysics2D> app;
|
||||
Nz::Application<Nz::Graphics, Nz::ChipmunkPhysics2D> app(argc, argv);
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@
|
|||
|
||||
NAZARA_REQUEST_DEDICATED_GPU()
|
||||
|
||||
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))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Application<Nz::Graphics, Nz::BulletPhysics3D> app;
|
||||
Nz::Application<Nz::Graphics, Nz::BulletPhysics3D> app(argc, argv);
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
constexpr float BoxDims = 16.f;
|
||||
|
||||
int main()
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
try {
|
||||
// Mise en place de l'application, de la fenêtre et du monde
|
||||
|
|
@ -25,9 +25,9 @@ int main()
|
|||
renderConfig.validationLevel = Nz::RenderAPIValidationLevel::None;
|
||||
|
||||
#if USE_JOLT
|
||||
Nz::Application<Nz::Graphics, Nz::JoltPhysics3D> app(renderConfig);
|
||||
Nz::Application<Nz::Graphics, Nz::JoltPhysics3D> app(argc, argv, renderConfig);
|
||||
#else
|
||||
Nz::Application<Nz::Graphics, Nz::BulletPhysics3D> app(renderConfig);
|
||||
Nz::Application<Nz::Graphics, Nz::BulletPhysics3D> app(argc, argv, renderConfig);
|
||||
#endif
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@
|
|||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
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))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Application<Nz::Audio> app;
|
||||
Nz::Application<Nz::Audio> app(argc, argv);
|
||||
app.AddComponent<Nz::SignalHandlerAppComponent>();
|
||||
|
||||
Nz::SoundStreamParams streamParams;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
NAZARA_REQUEST_DEDICATED_GPU()
|
||||
|
||||
int main()
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
Nz::Application<Nz::Graphics, Nz::JoltPhysics3D> app;
|
||||
Nz::Application<Nz::Graphics, Nz::JoltPhysics3D> app(argc, argv);
|
||||
|
||||
Nz::PluginLoader loader;
|
||||
Nz::Plugin<Nz::AssimpPlugin> assimp = loader.Load<Nz::AssimpPlugin>();
|
||||
|
|
@ -223,7 +223,7 @@ int main()
|
|||
entt::handle lightEntity3 = world.CreateEntity();
|
||||
|
||||
{
|
||||
auto& bobNode = bobEntity.emplace<Nz::NodeComponent>();
|
||||
[[maybe_unused]] auto& bobNode = bobEntity.emplace<Nz::NodeComponent>();
|
||||
//bobNode.SetRotation(Nz::EulerAnglesf(-90.f, -90.f, 0.f));
|
||||
//bobNode.SetScale(1.f / 40.f * 0.5f);
|
||||
//bobNode.SetPosition(Nz::Vector3f(0.f, -1.f, 0.f));
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
#include <Nazara/Utility.hpp>
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// Mise en place de l'application, de la fenêtre et du monde
|
||||
Nz::Application<Nz::Graphics> app;
|
||||
Nz::Application<Nz::Graphics> app(argc, argv);
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1280, 720), "Tut01 - Hello world");
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
#include <Nazara/Utility.hpp>
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
Nz::Application<Nz::Graphics> app;
|
||||
Nz::Application<Nz::Graphics> app(argc, argv);
|
||||
|
||||
// Création de la fenêtre
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
#include <Nazara/Network.hpp>
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
Nz::Application<Nz::Network> app;
|
||||
Nz::Application<Nz::Network> app(argc, argv);
|
||||
|
||||
std::unique_ptr<Nz::WebService> webService = Nz::Network::Instance()->InstantiateWebService();
|
||||
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
NAZARA_REQUEST_DEDICATED_GPU()
|
||||
|
||||
int main()
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
Nz::Application<Nz::Graphics, Nz::Widgets> app;
|
||||
Nz::Application<Nz::Graphics, Nz::Widgets> app(argc, argv);
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1920, 1080), "Widget demo");
|
||||
|
|
|
|||
Loading…
Reference in New Issue