Changeset 0e6ecf3 in opengl-game for game-gui-sdl.cpp


Ignore:
Timestamp:
Jul 19, 2019, 8:50:06 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
8667f76
Parents:
75108ef
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • game-gui-sdl.cpp

    r75108ef r0e6ecf3  
    11#include "game-gui-sdl.hpp"
    2 
    3 #include <SDL2/SDL.h>
    4 
    5 #include <iostream>
    6 
    7 using namespace std;
    82
    93bool GameGui_SDL::Init() {
     
    2216   SDL_Quit();
    2317}
     18
     19void* GameGui_SDL::CreateWindow(const string& title, unsigned int width, unsigned int height) {
     20   // On Apple's OS X you must set the NSHighResolutionCapable Info.plist property to YES,
     21   // otherwise you will not receive a High DPI OpenGL canvas.
     22   window = SDL_CreateWindow(title.c_str(),
     23               SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
     24               width, height,
     25               SDL_WINDOW_VULKAN | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
     26
     27   return window;
     28}
     29
     30void GameGui_SDL::DestroyWindow() {
     31   // TODO: This function can throw some errors. They should be handled
     32   SDL_DestroyWindow(window);
     33}
     34
     35bool GameGui_SDL::CreateVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) {
     36   return SDL_Vulkan_CreateSurface(window, instance, surface) ?
     37      RTWO_SUCCESS : RTWO_ERROR;
     38}
Note: See TracChangeset for help on using the changeset viewer.