-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChartMerge.cpp
More file actions
36 lines (35 loc) · 1.18 KB
/
ChartMerge.cpp
File metadata and controls
36 lines (35 loc) · 1.18 KB
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
#define SDL_MAIN_USE_CALLBACKS 1
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include "EventHandler.h"
#include "Renderer.h"
static SDL_Window *window = NULL;
static SDL_Renderer *renderer = NULL;
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) {
SDL_SetAppMetadata("ChartMerge", "1.0", "com.mcpsde.chartmerge");
if (!SDL_Init(SDL_INIT_VIDEO)) {
SDL_Log("无法初始化 SDL: %s", SDL_GetError());
return SDL_APP_FAILURE;
}
if (!SDL_CreateWindowAndRenderer(
"ChartMerge",
640, 480, SDL_WINDOW_RESIZABLE, &window, &renderer)) {
SDL_Log("无法创建窗口/渲染器: %s", SDL_GetError());
return SDL_APP_FAILURE;
}
SDL_SetRenderLogicalPresentation(renderer, 640, 480, SDL_LOGICAL_PRESENTATION_LETTERBOX);
return SDL_APP_CONTINUE;
}
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {
if (event->type == SDL_EVENT_QUIT) {
return SDL_APP_SUCCESS;
}
return HandleEvent(event);
}
SDL_AppResult SDL_AppIterate(void *appstate) {
RenderFrame(renderer);
SDL_RenderPresent(renderer);
return SDL_APP_CONTINUE;
}
void SDL_AppQuit(void *appstate, SDL_AppResult result) {
}