source: opengl-game/game-gui-glfw.cpp@ 0e6ecf3

feature/imgui-sdl points-test
Last change on this file since 0e6ecf3 was 0e6ecf3, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago

Create a game gui implementation using glfw3 and move window create/destruction and Vulkan surface creation to the game gui

  • Property mode set to 100644
File size: 776 bytes
Line 
1#include "game-gui-glfw.hpp"
2
3bool GameGui_GLFW::Init() {
4 return glfwInit() == GLFW_TRUE ? RTWO_SUCCESS : RTWO_SUCCESS;
5}
6
7void GameGui_GLFW::Shutdown() {
8 glfwTerminate();
9}
10
11void* GameGui_GLFW::CreateWindow(const string& title, unsigned int width, unsigned int height) {
12 glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
13
14 window = glfwCreateWindow(width, height, title.c_str(), nullptr, nullptr);
15
16 return window;
17}
18
19void GameGui_GLFW::DestroyWindow() {
20 // TODO: This function can throw some errors. They should be handled
21 glfwDestroyWindow(window);
22}
23
24bool GameGui_GLFW::CreateVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) {
25 return glfwCreateWindowSurface(instance, window, nullptr, surface) == VK_SUCCESS ?
26 RTWO_SUCCESS : RTWO_ERROR;
27}
Note: See TracBrowser for help on using the repository browser.