f***ed up and needed to rework packages
This commit is contained in:
parent
b43ab1702f
commit
f7a87d7519
78 changed files with 3713 additions and 0 deletions
31
packages/graphics/sdl/window.c
Normal file
31
packages/graphics/sdl/window.c
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include "arc/graphics/window.h"
|
||||
|
||||
#include "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 | SDL_INIT_AUDIO) < 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, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, info->w, info->h, 0);
|
||||
|
||||
if(!*window){
|
||||
arc_errno = ARC_ERRNO_NULL;
|
||||
ARC_DEBUG_LOG(arc_errno, "SDL_CreateWindow(%s, %d, %d, %d, %d, %x);", info->title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, info->w, info->h, 0);
|
||||
free(window);
|
||||
}
|
||||
}
|
||||
|
||||
void ARC_Window_Destroy(ARC_Window *window){
|
||||
SDL_DestroyWindow((SDL_Window *) window);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue