|
libc8
CHIP-8 utility library
|
#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | C8_Display |
| Represents a graphics display. More... | |
Macros | |
| #define | C8_LOW_DISPLAY_WIDTH 64 |
| Width of the low-resolution display. | |
| #define | C8_LOW_DISPLAY_HEIGHT 32 |
| Height of the low-resolution display. | |
| #define | C8_HIGH_DISPLAY_WIDTH 128 |
| Width of the high-resolution display. | |
| #define | C8_HIGH_DISPLAY_HEIGHT 64 |
| Height of the high-resolution display. | |
| #define | C8_DEFAULT_WINDOW_WIDTH 800 |
| Default window width. | |
| #define | C8_DEFAULT_WINDOW_HEIGHT 400 |
| Default window height. | |
| #define | C8_DISPLAYMODE_LOW 0 |
| Low resolution display mode. | |
| #define | C8_DISPLAYMODE_HIGH 1 |
| High resolution display mode. | |
Functions | |
| uint8_t * | c8_get_pixel (C8_Display *, int, int) |
Get the value of (x,y) from display | |
| int | c8_sound_play (void) |
| Stop sound. | |
| int | c8_sound_stop (void) |
| Play sound. | |
| int | c8_deinit_graphics (void) |
| Deinitialize graphics system. | |
| int | c8_init_graphics (void) |
| Initialize graphics system. | |
| int | c8_render (C8_Display *, int *) |
| Render graphics. | |
| int | c8_tick (int *) |
| Grab current keypresses and delay execution to match clockspeed. | |
Function declarations for graphics display are here.
Only get_pixel is strongly defined in graphics.c. Declarations are library agnostic so a different graphics backend can be used.
| #define C8_DEFAULT_WINDOW_HEIGHT 400 |
Default window height.
| #define C8_DEFAULT_WINDOW_WIDTH 800 |
Default window width.
| #define C8_DISPLAYMODE_HIGH 1 |
High resolution display mode.
| #define C8_DISPLAYMODE_LOW 0 |
Low resolution display mode.
| #define C8_HIGH_DISPLAY_HEIGHT 64 |
Height of the high-resolution display.
| #define C8_HIGH_DISPLAY_WIDTH 128 |
Width of the high-resolution display.
| #define C8_LOW_DISPLAY_HEIGHT 32 |
Height of the low-resolution display.
| #define C8_LOW_DISPLAY_WIDTH 64 |
Width of the low-resolution display.
| int 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.
This function should return 0 on success and a negative value on failure.
Deinitialize graphics system.
| uint8_t * c8_get_pixel | ( | C8_Display * | display, |
| int | x, | ||
| int | y | ||
| ) |
Get the value of (x,y) from display
| display | C8_Display to get pixel from |
| x | the x value |
| y | the y value |
display | int 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.
This function should return 0 on success and a negative value on failure.
Initialize graphics system.
| int c8_render | ( | C8_Display * | 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.
This function should return 0 on success and a negative value on failure.
Render the given display to the ncurses window.
| display | C8_Display to render |
| colors | colors to render (UNUSED) |
Render the given display to the SDL2 window.
| display | C8_Display to render |
| colors | colors to render |
| int c8_sound_play | ( | void | ) |
Stop 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.
This function should return 0 on success and a negative value on failure.
Stop sound.
Stop sound.
| int c8_sound_stop | ( | 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.
This function should return 0 on success and a negative value on failure.
Play sound.
Play sound.
| 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.
This function should return -2 if quitting, -1 if no key was released, or the key index of the first key released since the last call.
Grab current keypresses and delay execution to match clockspeed.
If a relevant key is pressed or released (see c8_keyMap in this file), this function will update keys accordingly.
| keys | pointer to int arr of keys |
Grab current keypresses and delay execution to match clockspeed.
If a relevant key is pressed or released (see c8_keyMap in this file), this function will update key accordingly.
| key | pointer to int arr of keys |