Make window centered and borderless
This commit is contained in:
parent
5aa52b2fcc
commit
83d22f4cee
11
src/main.c
11
src/main.c
|
@ -102,11 +102,12 @@ init_SDL(const char* path)
|
||||||
char caption[7 + strlen(path)];
|
char caption[7 + strlen(path)];
|
||||||
sprintf(caption, "CHIP-8 - %s", path);
|
sprintf(caption, "CHIP-8 - %s", path);
|
||||||
w = SDL_CreateWindow(caption,
|
w = SDL_CreateWindow(caption,
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_CENTERED,
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_CENTERED,
|
||||||
64 * SCALE,
|
64 * SCALE,
|
||||||
32 * SCALE,
|
32 * SCALE,
|
||||||
SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
|
SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI |
|
||||||
|
SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_GRABBED);
|
||||||
|
|
||||||
if (!w) {
|
if (!w) {
|
||||||
fputs("ERROR: Failed to create a window\n", stderr);
|
fputs("ERROR: Failed to create a window\n", stderr);
|
||||||
|
@ -291,7 +292,9 @@ event_handler(void)
|
||||||
case SDLK_ESCAPE:
|
case SDLK_ESCAPE:
|
||||||
exit(0);
|
exit(0);
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "WARNING: Unhandled input detected: %s\n", SDL_GetKeyName(e.key.keysym.sym));
|
fprintf(stderr,
|
||||||
|
"WARNING: Unhandled input detected: %s\n",
|
||||||
|
SDL_GetKeyName(e.key.keysym.sym));
|
||||||
}
|
}
|
||||||
} else if (e.type == SDL_KEYUP) {
|
} else if (e.type == SDL_KEYUP) {
|
||||||
switch (e.key.keysym.sym) {
|
switch (e.key.keysym.sym) {
|
||||||
|
|
Loading…
Reference in New Issue