archeus/src/graphics/sdl/window.c
2023-03-11 01:21:36 -07:00

34 lines
965 B
C

#ifdef ARC_SDL
#include "arc/graphics/window.h"
#include "arc/graphics/sdl/window.h"
#include "arc/std/errno.h"
#include <SDL.h>
void ARC_Window_Create(ARC_Window **window, ARC_WindowInfo *info){
if(!info){
arc_errno = ARC_ERRNO_NULL;
ARC_DEBUG_ERR("ARC_Window_Create(**window, NULL)");
return;
}
if(SDL_Init(SDL_INIT_VIDEO) < 0){
arc_errno = ARC_ERRNO_INIT;
printf("Error: initializing SDL\nSDL Error: %s\n", SDL_GetError());
return;
}
*window = (ARC_Window *)SDL_CreateWindow((const char *)info->title, info->x, info->y, info->w, info->h, info->flags);
if(!*window){
arc_errno = ARC_ERRNO_NULL;
ARC_DEBUG_LOG(arc_errno, "SDL_CreateWindow(%s, %d, %d, %d, %d, %x);", info->title, info->x, info->y, info->w, info->h, info->flags);
free(window);
}
}
void ARC_Window_Destroy(ARC_Window *window){
SDL_DestroyWindow((SDL_Window *) window);
}
#endif //ARC_SDL