-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMinVsgApp.cpp
62 lines (48 loc) · 1.01 KB
/
MinVsgApp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// You should include this only when a directory name is needed.
#include "config_dir.h"
#include "MinVsgApp.h"
#include <format>
#include <SDL3/SDL.h>
MinVsgApp::Status MinVsgApp::init(const std::string& title)
{
try {
initSdlVideo(title);
initVsg();
} catch(Status status) {
return status;
}
return {};
}
void MinVsgApp::initSdlVideo(const std::string& title)
{
if(SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_EVENTS) != 0) {
throw Status{SDL_GetError()};
}
SDL_WindowFlags wflags = SDL_WINDOW_RESIZABLE;
sdlWindow = SDL_CreateWindow(title.c_str(), width, height, wflags);
if(!sdlWindow) {
throw Status{SDL_GetError()};
}
}
void MinVsgApp::initVsg()
{
}
MinVsgApp::Status MinVsgApp::processEvent(const SDL_Event* event)
{
switch(event->type) {
case SDL_EVENT_QUIT:
shallQuit = true;
}
return {};
}
MinVsgApp::Status MinVsgApp::iterate()
{
return {};
}
MinVsgApp::~MinVsgApp()
{
if(sdlWindow) {
SDL_DestroyWindow(sdlWindow);
sdlWindow = nullptr;
}
}