Loading...
Searching...
No Matches
window.c File Reference
`#include "arc/graphics/window.h"`
`#include "window.h"`
`#include "arc/std/errno.h"`
`#include <SDL.h>`

Go to the source code of this file.

## Functions

void | ARC_Window_Create (ARC_Window **window, ARC_WindowInfo *info)
| creates ARC_Window type
void | ARC_Window_Destroy (ARC_Window *window)
| destroys ARC_Window type

## Function Documentation

## ARC_Window_Create()

void ARC_Window_Create | ( | ARC_Window ** | window,
|  | ARC_WindowInfo * | info )

creates ARC_Window type

Note
  the parameter data is determined by which graphics library you are using please refer to the graphics library section to see what needs to be passed

Parameters

  window | ARC_Window to initialize
  info | Info on how to create ARC_Window

Definition at line 7 of file window.c.

{
if(!info){
arc_errno = ARC_ERRNO_NULL;
ARC_DEBUG_LOG_ERROR("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_ERROR_WITH_VARIABLES("SDL_CreateWindow(%s, %d, %d, %d, %d, %x);", info->title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, info->w, info->h, 0);
free(window);
}
}
arc_errno
int32_t arc_errno
Definition errno.c:5
ARC_ERRNO_INIT
#define ARC_ERRNO_INIT
Definition errno.h:11
ARC_DEBUG_LOG_ERROR_WITH_VARIABLES
#define ARC_DEBUG_LOG_ERROR_WITH_VARIABLES(STR,...)
Definition errno.h:40
ARC_ERRNO_NULL
#define ARC_ERRNO_NULL
Definition errno.h:6
ARC_DEBUG_LOG_ERROR
#define ARC_DEBUG_LOG_ERROR(STR)
Definition errno.h:39
ARC_Window
struct ARC_WindowType ARC_Window
Definition window.h:13
ARC_WindowInfo::h
int32_t h
Definition window.h:21
ARC_WindowInfo::title
char * title
Definition window.h:19
ARC_WindowInfo::w
int32_t w
Definition window.h:20

References ARC_DEBUG_LOG_ERROR, ARC_DEBUG_LOG_ERROR_WITH_VARIABLES, arc_errno, ARC_ERRNO_INIT, ARC_ERRNO_NULL, ARC_WindowInfo::h, ARC_WindowInfo::title, and ARC_WindowInfo::w.

Referenced by ARC_EngineData_Create().

## ARC_Window_Destroy()

void ARC_Window_Destroy | ( | ARC_Window * | window | ) |

destroys ARC_Window type

Definition at line 29 of file window.c.

{
SDL_DestroyWindow((SDL_Window *) window);
}

Referenced by ARC_EngineData_Create(), and ARC_EngineData_Destroy().