[71876b9] | 1 | #include <SDL2/SDL.h>
|
---|
| 2 | #include <SDL2/SDL_vulkan.h>
|
---|
| 3 |
|
---|
| 4 | #define _USE_MATH_DEFINES // Will be needed when/if I need to # include <cmath>
|
---|
| 5 |
|
---|
| 6 | #define GLM_FORCE_RADIANS
|
---|
| 7 | #define GLM_FORCE_DEPTH_ZERO_TO_ONE
|
---|
| 8 | #include <glm/vec4.hpp>
|
---|
| 9 | #include <glm/mat4x4.hpp>
|
---|
| 10 |
|
---|
| 11 | #include <iostream>
|
---|
| 12 | #include <vector>
|
---|
| 13 |
|
---|
| 14 | using namespace std;
|
---|
| 15 | using namespace glm;
|
---|
| 16 |
|
---|
| 17 | const int SCREEN_WIDTH = 800;
|
---|
| 18 | const int SCREEN_HEIGHT = 600;
|
---|
| 19 |
|
---|
| 20 | int main(int argc, char* argv[]) {
|
---|
| 21 | cout << "Starting Vulkan SDL game..." << endl;
|
---|
| 22 |
|
---|
| 23 | SDL_Window* window = nullptr;
|
---|
| 24 | //SDL_Surface* screenSurface = nullptr;
|
---|
| 25 |
|
---|
| 26 | if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
---|
| 27 | cout << "SDL could not initialize! SDL_Error: " << SDL_GetError() << endl;
|
---|
| 28 | } else {
|
---|
| 29 | window = SDL_CreateWindow("Vulkan Game",
|
---|
| 30 | SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
---|
| 31 | SCREEN_WIDTH, SCREEN_HEIGHT,
|
---|
| 32 | SDL_WINDOW_VULKAN);
|
---|
| 33 |
|
---|
| 34 | if (window == nullptr) {
|
---|
| 35 | cout << "Window could not be created! SDL_Error: " << SDL_GetError() << endl;
|
---|
| 36 | } else {
|
---|
| 37 | //screenSurface = SDL_GetWindowSurface(window);
|
---|
| 38 |
|
---|
| 39 | //SDL_FillRect(screenSurface, nullptr, SDL_MapRGB(screenSurface->format, 0xFF, 0xFF, 0xFF));
|
---|
| 40 |
|
---|
| 41 | SDL_UpdateWindowSurface(window);
|
---|
| 42 |
|
---|
| 43 | uint32_t extensionCount;
|
---|
| 44 |
|
---|
| 45 | vkEnumerateInstanceExtensionProperties(nullptr, &extensionCount, nullptr);
|
---|
| 46 |
|
---|
| 47 | cout << "Vulkan extensions (" << extensionCount << "):" << endl;
|
---|
| 48 | cout << endl;
|
---|
| 49 |
|
---|
| 50 | SDL_Vulkan_GetInstanceExtensions(window, &extensionCount, nullptr);
|
---|
| 51 |
|
---|
| 52 | vector<const char*> extensionNames(extensionCount);
|
---|
| 53 | SDL_Vulkan_GetInstanceExtensions(window, &extensionCount, extensionNames.data());
|
---|
| 54 |
|
---|
| 55 | `cout << "SDL Vulkan extensions (" << extensionCount << "):" << endl;
|
---|
| 56 |
|
---|
| 57 | for (vector<const char*>::iterator it = extensionNames.begin(); it != extensionNames.end(); it++) {
|
---|
| 58 | cout << *it << endl;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | SDL_Delay(2000);
|
---|
| 62 | }
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | SDL_DestroyWindow( window );
|
---|
| 66 |
|
---|
| 67 | SDL_Quit();
|
---|
| 68 |
|
---|
| 69 | cout << "Finished" << endl;
|
---|
| 70 |
|
---|
| 71 | exit(0);
|
---|
| 72 | }
|
---|