/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #include "PlatformGLFW.hpp" #include "WindowGLFW.hpp" #include namespace openVulkanoCpp::GLFW { PlatformGLFW::~PlatformGLFW() { if (IsInitialized()) { Close(); } } void PlatformGLFW::Init() { if (!glfwInit()) throw PlatformInitFailedException("Failed to initialize glfw"); inputProvider.Init(); initialized = true; } void PlatformGLFW::Tick() { inputProvider.PreTick(); glfwPollEvents(); inputProvider.Tick(); } void PlatformGLFW::Close() { for(const IWindow* window : windows) { delete window; } windows.clear(); inputProvider.Close(); glfwTerminate(); } IWindow* PlatformGLFW::MakeWindow() { WindowGLFW* window = new WindowGLFW(inputProvider); windows.push_back(window); return window; } }