Skip to content
Snippets Groups Projects
Commit 36a15f81 authored by ARMAGAN OMER-ALI's avatar ARMAGAN OMER-ALI :rabbit2:
Browse files

sdl2.c

parent 2e7259e0
Branches
No related merge requests found
......@@ -3,6 +3,15 @@
SDLContext context;
/**
* @fn void sdl_init
* @brief Initializes the SDL library for graphical rendering and creates a window
with the specified dimensions.
* @return void
*/
void sdl_init() {
// function implementation
}
void sdl_init()
{
int const width = 1280;
......@@ -25,6 +34,11 @@ void sdl_init()
context = (SDLContext){
.window = window, .renderer = renderer, .width = width, .height = height};
}
/**
* @brief Nettoie et detruit le SDL fenetre et retourne les objects
* @return void
*/
void sdl_quit()
{
SDL_DestroyWindow(context.window);
......@@ -34,6 +48,13 @@ void sdl_quit()
SDL_Quit();
}
/**
* @brief Affiche l'etat courant du jeu grid en utilisant la bibliotheque SDL2
*
* @param grid Un pointeur vers la structure Grid representat l'etat courant du jeu grid
*
* @return void
*/
void display_sdl2(struct Grid* grid)
{
float x = 0;
......@@ -103,7 +124,12 @@ void display_sdl2(struct Grid* grid)
}
SDL_RenderPresent(context.renderer);
}
/**
* @brief Cela attend pour un evenement de l'utilisateur et retourne une action correspandant Event
*
* @return Un Event enum represantant l'action correspandant a l'Event ou bien 'NON' si cela n'est pas se produit.
*
*/
Event event_sdl2()
{
SDL_Event event;
......@@ -157,6 +183,12 @@ Event event_sdl2()
return action;
}
/**
* @brief Cela attend pour l'Event prochain disponible et renvoie l'action qui correspond.
*
* @return L'action qui corresponde a l'event prochain disponible de l'entree standarde.
*
*/
Event event()
{
Event action;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment