libc8
CHIP-8 utility library
Loading...
Searching...
No Matches
graphics.c File Reference
#include "graphics.h"
#include <stdio.h>

Functions

void c8_beep (void)
 Play sound.
 
void c8_deinit_graphics (void)
 Deinitialize graphics system.
 
uint8_t c8_init_graphics (void)
 Initialize graphics system.
 
void c8_render (c8_display_t *display, int *colors)
 Render graphics.
 
int c8_tick (int *key)
 Grab current keypresses and delay execution to match clockspeed.
 
uint8_t * c8_get_pixel (c8_display_t *display, int x, int y)
 Get the value of (x,y) from display
 

Detailed Description

Backend-agnostic graphics-related functions

Function Documentation

◆ c8_beep()

void c8_beep ( void  )

Play sound.

This function is weak and is overridden by internal/graphics_sdl.c by default. This can also be overridden by the user when compiling without SDL2 support.

◆ c8_deinit_graphics()

void c8_deinit_graphics ( void  )

Deinitialize graphics system.

This function is weak and is overridden by internal/graphics_sdl.c by default. This can also be overridden by the user when compiling without SDL2 support.

◆ c8_get_pixel()

uint8_t * c8_get_pixel ( c8_display_t display,
int  x,
int  y 
)

Get the value of (x,y) from display

Parameters
displaydisplay_t to get pixel from
xthe x value
ythe y value
Returns
pointer to value of (x,y) in display

◆ c8_init_graphics()

uint8_t c8_init_graphics ( void  )

Initialize graphics system.

This function is weak and is overridden by internal/graphics_sdl.c by default. This can also be overridden by the user when compiling without SDL2 support.

◆ c8_render()

void c8_render ( c8_display_t display,
int *  colors 
)

Render graphics.

This function is weak and is overridden by internal/graphics_sdl.c by default. This can also be overridden by the user when compiling without SDL2 support.

◆ c8_tick()

int c8_tick ( int *  key)

Grab current keypresses and delay execution to match clockspeed.

This function is weak and is overridden by internal/graphics_sdl.c by default. This can also be overridden by the user when compiling without SDL2 support.