sdl initializing and deinitializing with temp code
This commit is contained in:
parent
df8c7f7ff1
commit
c0780b7188
9 changed files with 102 additions and 41 deletions
|
|
@ -1,28 +1,30 @@
|
|||
#ifdef ARC_SDL
|
||||
#include "arc/graphics/window.h"
|
||||
#include "arc/graphics/sdl/window.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include "arc/std/errno.h"
|
||||
|
||||
typedef SDL_Window ARC_Window;
|
||||
|
||||
void ARC_Window_Create(ARC_Window **window, void *data){
|
||||
if(!data){
|
||||
void ARC_Window_Create(ARC_Window **window, ARC_WindowInfo *info){
|
||||
if(!info){
|
||||
arc_errno = ARC_ERRNO_NULL;
|
||||
ARC_DEBUG_ERR(arc_errno, "ARC_Window_Create(**window, NULL)");
|
||||
ARC_DEBUG_ERR("ARC_Window_Create(**window, NULL)");
|
||||
return;
|
||||
}
|
||||
|
||||
ARC_WindowInfo *info = (ARC_WindowInfo *)data;
|
||||
// (*window)->window = SDL_CreateWindow((const char *)info->title, info->x, info->y, info->w, info->h, info->flags);
|
||||
*window = (ARC_Window *)malloc(sizeof(ARC_Window));
|
||||
(*window)->window = SDL_CreateWindow((const char *)info->title, info->x, info->y, info->w, info->h, info->flags);
|
||||
|
||||
*window = SDL_CreateWindow((const char *)info->title, info->x, info->y, info->w, info->h, info->flags);
|
||||
|
||||
if(!window){
|
||||
if(!(*window)->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);
|
||||
}
|
||||
}
|
||||
|
||||
void ARC_Window_Destroy(ARC_Window *window){
|
||||
SDL_DestroyWindow((SDL_Window *) window);
|
||||
SDL_DestroyWindow((SDL_Window *) window->window);
|
||||
free(window);
|
||||
}
|
||||
|
||||
#endif //ARC_SDL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue