// Sources pour https://github.com/NazaraEngine/NazaraEngine/wiki/(FR)-Tutoriel:-%5B01%5D-Hello-World #include #include #include #include #include #include int main() { Nz::Application app; auto& windowing = app.AddComponent(); Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1280, 720), "Tut01 - Hello world"); auto& ecs = app.AddComponent(); auto& world = ecs.AddWorld(); auto& renderSystem = world.AddSystem(); Nz::WindowSwapchain& windowSwapchain = renderSystem.CreateSwapchain(mainWindow); entt::handle cameraEntity = world.CreateEntity(); cameraEntity.emplace(); auto& cameraComponent = cameraEntity.emplace(&windowSwapchain, Nz::ProjectionType::Orthographic); cameraComponent.UpdateClearColor(Nz::Color(0.f, 0.f, 0.f, 1.f)); Nz::SimpleTextDrawer textDrawer; textDrawer.SetCharacterSize(72); textDrawer.SetOutlineThickness(4.f); textDrawer.SetText("Hello world !"); std::shared_ptr textSprite = std::make_shared(); textSprite->Update(textDrawer); entt::handle textEntity = world.CreateEntity(); { auto& nodeComponent = textEntity.emplace(); auto& gfxComponent = textEntity.emplace(); gfxComponent.AttachRenderable(textSprite); Nz::Boxf textBox = textSprite->GetAABB(); Nz::Vector2ui windowSize = mainWindow.GetSize(); nodeComponent.SetPosition(windowSize.x / 2 - textBox.width / 2, windowSize.y / 2 - textBox.height / 2); } return app.Run(); }