Loading...
Searching...
No Matches
renderer.h File Reference

Go to the source code of this file.

## Typedefs

typedef struct ARC_RendererType | ARC_Renderer

## Functions

void | ARC_Renderer_CreateWithEngineData (ARC_Renderer **renderer, ARC_EngineData *data)
| creates ARC_Renderer type with ARC_EngineData
void | ARC_Renderer_Destroy (ARC_Renderer *renderer)
| destroys ARC_Renderer type
void | ARC_Renderer_Clear (ARC_Renderer *renderer)
void | ARC_Renderer_Render (ARC_Renderer *renderer)
| renders the renderer

## Typedef Documentation

## ARC_Renderer

typedef struct ARC_RendererType ARC_Renderer

Note
  ARC_RendererType is determined by which window library you are using

Definition at line 16 of file renderer.h.

## Function Documentation

## ARC_Renderer_Clear()

void ARC_Renderer_Clear | ( | ARC_Renderer * | renderer | ) |

@breif clears the renderer

Parameters

  renderer | the renderer to clear

Definition at line 32 of file renderer.c.

{
//TODO: changed for school, also need to add the ability to change render draw color
//SDL_SetRenderDrawColor((SDL_Renderer *)renderer, 0x1c, 0x2c, 0x3c, 0x00);
SDL_SetRenderDrawColor((SDL_Renderer *)renderer, 0x15, 0x2a, 0x26, 0x00);
SDL_RenderClear((SDL_Renderer *)renderer);
}

Referenced by ARC_Engine_RunUncapped().

## ARC_Renderer_CreateWithEngineData()

void ARC_Renderer_CreateWithEngineData | ( | ARC_Renderer ** | renderer,
|  | ARC_EngineData * | data )

creates ARC_Renderer type with ARC_EngineData

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

  renderer | ARC_Renderer to initialize
  data | the engine data to create from

Definition at line 10 of file renderer.c.

{
if(!data){
arc_errno = ARC_ERRNO_NULL;
ARC_DEBUG_LOG_ERROR("ARC_Renderer_CreateWithEngineData(**renderer, NULL)");
return;
}
*renderer = (ARC_Renderer *)SDL_CreateRenderer((SDL_Window *)(data->window), -1, SDL_RENDERER_ACCELERATED);
if(!*renderer){
arc_errno = ARC_ERRNO_NULL;
ARC_DEBUG_LOG_ERROR_WITH_VARIABLES("SDL_CreateRenderer(%p, %d, %u);", data->window, -1, SDL_RENDERER_ACCELERATED);
free(renderer);
}
SDL_SetRenderDrawBlendMode((SDL_Renderer *)*renderer, SDL_BLENDMODE_BLEND);
}
arc_errno
int32_t arc_errno
Definition errno.c:5
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_Renderer
struct ARC_RendererType ARC_Renderer
Definition renderer.h:16
ARC_EngineData::window
ARC_Window * window
Definition engine.h:18

References ARC_DEBUG_LOG_ERROR, ARC_DEBUG_LOG_ERROR_WITH_VARIABLES, arc_errno, ARC_ERRNO_NULL, and ARC_EngineData::window.

Referenced by ARC_EngineData_Create().

## ARC_Renderer_Destroy()

void ARC_Renderer_Destroy | ( | ARC_Renderer * | renderer | ) |

destroys ARC_Renderer type

Parameters

  renderer | ARC_Renderer to destory

Definition at line 28 of file renderer.c.

{
SDL_DestroyRenderer((SDL_Renderer *) renderer);
}

Referenced by ARC_EngineData_Destroy().

## ARC_Renderer_Render()

void ARC_Renderer_Render | ( | ARC_Renderer * | renderer | ) |

renders the renderer

Note
  the renderer will most likely be drawn to from ARC_EngineData

Parameters

  renderer | the renderer to render

Definition at line 39 of file renderer.c.

{
SDL_RenderPresent((SDL_Renderer *)renderer);
}

Referenced by ARC_Engine_RunUncapped().