Hi,
I am new to C Lang and SDL development.
I am working on Windows 10, with Visual Studio 2019 and the SDL2 installed via vcpkg.
So I wanted to do a first test with a main.c
which only displays a window and which waits for it to close by pressing the X button.
I therefore notice that the value of the event is in int 12
. (via a printf in the console)
Here is my code:
#include <stdio.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
int main(int argc, char* argv[])
{
SDL_Window* screen = NULL;
SDL_Event event;
int continuer = 1;
// Démarrage et chargement du système vidéo
if (SDL_Init(SDL_INIT_VIDEO) == -1)
{
fprintf(stderr, "Erreur au chargement de la lib SDL - %s!\n", SDL_GetError());
exit(EXIT_FAILURE);
}
screen = SDL_CreateWindow(
"Ma fenêtre en SDL2",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
1920,
1080,
SDL_WINDOW_OPENGL
);
if (screen == NULL) {
fprintf(stderr, "Screen is not created - %s\n", SDL_GetError());
exit(EXIT_FAILURE);
}
while (continuer)
{
SDL_WaitEvent(&event);
printf("%d\n", event.type);
switch (event.type)
{
case SDL_QUIT:
continuer = 0;
break;
}
}
SDL_Quit();
return EXIT_SUCCESS;
}
But when I look at the value of the enumerated for SDL_QUIT
it is equal to 0x100
in hex or 256
in int.
This image comes from the SDL_events.h
file
So I would like to know if the value comes from a fault in my configuration or have I misunderstood something?
Thank you