// Sources pour https://github.com/NazaraEngine/NazaraEngine/wiki/(FR)-Tutoriel:-%5B01%5D-Hello-World #include #include #include #include #include #include #include #include #include #include #include int main() { Nz::Modules nazara; entt::registry registry; Nz::SystemGraph systemGraph(registry); Nz::RenderSystem& renderSystem = systemGraph.AddSystem(); Nz::RenderWindow& mainWindow = renderSystem.CreateWindow(Nz::Graphics::Instance()->GetRenderDevice(), Nz::VideoMode(1280, 720), "Tut01 - Hello world"); entt::entity cameraEntity = registry.create(); { registry.emplace(cameraEntity); auto& cameraComponent = registry.emplace(cameraEntity, mainWindow.GetRenderTarget(), Nz::ProjectionType::Orthographic); cameraComponent.UpdateClearColor(Nz::Color(0.46f, 0.48f, 0.84f, 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::entity textEntity = registry.create(); { auto& nodeComponent = registry.emplace(textEntity); auto& gfxComponent = registry.emplace(textEntity); gfxComponent.AttachRenderable(textSprite, 0xFFFFFFFF); Nz::Boxf textBox = textSprite->GetAABB(); Nz::Vector2ui windowSize = mainWindow.GetSize(); nodeComponent.SetPosition(windowSize.x / 2 - textBox.width / 2, windowSize.y / 2 - textBox.height / 2); } while (mainWindow.IsOpen()) { mainWindow.ProcessEvents(); systemGraph.Update(); } return EXIT_SUCCESS; }