allow using custom class for window in application

This commit is contained in:
hippoz 2022-10-28 23:58:07 +03:00
parent 9b2655beb2
commit 55b19a3834
No known key found for this signature in database
GPG key ID: 7C52899193467641
2 changed files with 5 additions and 5 deletions

View file

@ -17,9 +17,9 @@ public:
int turn();
int run();
template<class... Args>
std::shared_ptr<Window> add_window(Args&&... args) {
std::shared_ptr<Window> child = std::make_shared<Window>(std::forward<Args>(args)...);
template<typename T, class... Args>
std::shared_ptr<T> add_window(Args&&... args) {
std::shared_ptr<T> child = std::make_shared<T>(std::forward<Args>(args)...);
add_window(child);
return child;
}

View file

@ -23,8 +23,8 @@
int main() {
Raven::Application application {};
auto window = application.add_window();
auto test_window = application.add_window();
auto window = application.add_window<Raven::Window>();
auto test_window = application.add_window<Raven::Window>();
window->spawn_window();
test_window->spawn_window();