3#include "spark/base/Exception.h"
5#include "spark/mpl/typelist.h"
9 template <
typename... Tags>
16 template <
typename... Tags>
18 : m_settings(std::move(settings)) {}
20 template <
typename... Tags>
23 static_assert(!
spark::mpl::typelist<Tags...>::template contains<details::application_tags::set_name_called>,
"Cannot set application name twice.");
25 m_settings.name = std::move(name);
29 template <
typename... Tags>
32 static_assert(!
spark::mpl::typelist<Tags...>::template contains<details::application_tags::set_size_called>,
"Cannot set window size twice.");
34 m_settings.size.x = width;
35 m_settings.size.y = height;
39 template <
typename... Tags>
42 static_assert(!
spark::mpl::typelist<Tags...>::template contains<details::application_tags::set_resize_policy>,
"Cannot set resize policy twice.");
43 m_settings.resizable = resizable;
47 template <
typename... Tags>
50 static_assert(
spark::mpl::typelist<Tags...>::template contains<details::application_tags::set_name_called>,
"Cannot build application without setting the name.");
51 static_assert(
spark::mpl::typelist<Tags...>::template contains<details::application_tags::set_size_called>,
"Cannot build application without setting the window size.");
53 auto app = std::unique_ptr<Application>(
new Application(m_settings));
54 app->s_instance = app.get();
Exception thrown when trying to create multiple instances of an application, which is not allowed.
Definition Exception.h:91
Definition ApplicationBuilder.h:18
ApplicationBuilder< details::application_tags::set_resize_policy, Tags... > setResizable(bool resizable)
Sets whether the application window is resizable.
Definition ApplicationBuilder.h:40
ApplicationBuilder< details::application_tags::set_size_called, Tags... > setSize(unsigned int width, unsigned int height)
Sets the size of the application window.
Definition ApplicationBuilder.h:30
ApplicationBuilder< details::application_tags::set_name_called, Tags... > setName(std::string name)
Sets the name of the application.
Definition ApplicationBuilder.h:21
std::unique_ptr< Application > build()
Builds the application with the given settings.
Definition ApplicationBuilder.h:48
A class representing a SPARK application.
Definition Application.h:19
static Application * Instance()
Gets the instance of the application.
Definition Application.cpp:53
A struct containing the settings for the application.
Definition Application.h:30