aboutsummaryrefslogtreecommitdiffstats
path: root/doc/cpp/world.rst
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-06 23:53:31 +0100
committerDavid Robillard <d@drobilla.net>2021-01-06 23:53:31 +0100
commitd2a6fd3f725f7f174535c49d78d07567e12c84d8 (patch)
tree8ebbe1d224363f94610e64af167a2592390787b4 /doc/cpp/world.rst
parent31d059bf849045f45c8c9db361efd093e88a109c (diff)
downloadpugl-d2a6fd3f725f7f174535c49d78d07567e12c84d8.tar.gz
pugl-d2a6fd3f725f7f174535c49d78d07567e12c84d8.tar.bz2
pugl-d2a6fd3f725f7f174535c49d78d07567e12c84d8.zip
Split overview into multiple documents
Diffstat (limited to 'doc/cpp/world.rst')
-rw-r--r--doc/cpp/world.rst41
1 files changed, 41 insertions, 0 deletions
diff --git a/doc/cpp/world.rst b/doc/cpp/world.rst
new file mode 100644
index 0000000..1a3b432
--- /dev/null
+++ b/doc/cpp/world.rst
@@ -0,0 +1,41 @@
+.. default-domain:: cpp
+.. highlight:: cpp
+.. namespace:: pugl
+
+################
+Creating a World
+################
+
+The world is the top-level object which represents an instance of Pugl.
+It handles the connection to the window system,
+and manages views and the event loop.
+
+An application typically has a single world,
+which is constructed once on startup and used to drive the main event loop.
+
+************
+Construction
+************
+
+A world must be created before any views, and it must outlive all of its views.
+The world constructor requires an argument to specify the application type:
+
+.. code-block:: cpp
+
+ pugl::World world{pugl::WorldType::program};
+
+For a plugin, specify :enumerator:`WorldType::module` instead.
+In some cases, it is necessary to pass additional flags.
+For example, Vulkan requires thread support:
+
+.. code-block:: cpp
+
+ pugl::World world{pugl::WorldType::program, pugl::WorldFlag::threads};
+
+It is a good idea to set a class name for your project with :func:`World::setClassName`.
+This allows the window system to distinguish different applications and,
+for example, users to set up rules to manage their windows nicely:
+
+.. code-block:: cpp
+
+ world.setClassName("MyAwesomeProject");