input and handler possibly fixed

This commit is contained in:
herbglitch 2022-11-11 01:15:33 -07:00
parent 31b8730a61
commit d6281e8eac
11 changed files with 84 additions and 59 deletions

View file

@ -17,9 +17,10 @@ void ARC_Renderer_Create(ARC_Renderer **renderer, ARC_RenderInfo *info){
*renderer = (ARC_Renderer *)malloc(sizeof(ARC_Renderer));
(*renderer)->renderer = SDL_CreateRenderer((SDL_Window *)info->window, info->index, info->flags);
if(!renderer){
if(!(*renderer)->renderer){
arc_errno = ARC_ERRNO_NULL;
ARC_DEBUG_LOG(arc_errno, "SDL_CreateRenderer(%p, %d, %u);", info->window, info->index, info->flags);
free(renderer);
}
}

View file

@ -12,13 +12,19 @@ void ARC_Window_Create(ARC_Window **window, ARC_WindowInfo *info){
return;
}
// (*window)->window = SDL_CreateWindow((const char *)info->title, info->x, info->y, info->w, info->h, info->flags);
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 *)malloc(sizeof(ARC_Window));
(*window)->window = SDL_CreateWindow((const char *)info->title, info->x, info->y, info->w, info->h, info->flags);
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);
free(window);
}
}