window creation
This commit is contained in:
@@ -15,12 +15,27 @@ void App::init() {
|
||||
|
||||
utils::debugPrint(__FUNCTION__, __LINE__, "Init app.");
|
||||
|
||||
window_ = new Window();
|
||||
|
||||
}
|
||||
|
||||
int App::run() {
|
||||
|
||||
utils::debugPrint(__FUNCTION__, __LINE__, "Run app.");
|
||||
|
||||
bool quit = false;
|
||||
while (!quit) {
|
||||
// app loop for as long as the window is open
|
||||
// poll events here
|
||||
// other threads might be able to change quit to true to auto close
|
||||
|
||||
while( SDL_PollEvent( &e ) != 0 ) {
|
||||
if( e.type == SDL_QUIT ) {
|
||||
// Ctrl + C in console !
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Window.hpp"
|
||||
|
||||
class App {
|
||||
|
||||
public:
|
||||
@@ -16,4 +18,6 @@ private:
|
||||
// things like creating a window, creating the rendering engine, etc.
|
||||
void init();
|
||||
|
||||
Window* window_;
|
||||
|
||||
};
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Window::Window() {
|
||||
|
||||
init();
|
||||
(void)init();
|
||||
|
||||
}
|
||||
|
||||
@@ -11,4 +11,6 @@ int Window::init() {
|
||||
|
||||
window_ = SDL_CreateWindow("How to Vulkan", 1280u, 720u, SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "SDL3/SDL.h"
|
||||
#include "SDL3/SDL_Vulkan.h"
|
||||
|
||||
// reference: https://wiki.libsdl.org/SDL3/SDL_CreateWindow
|
||||
|
||||
class Window {
|
||||
|
||||
public:
|
||||
@@ -17,5 +19,4 @@ private:
|
||||
|
||||
SDL_Window* window_;
|
||||
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user