libc8
CHIP-8 utility library
Loading...
Searching...
No Matches
graphics.h
Go to the documentation of this file.
1
10#ifndef C8_GRAPHICS_H
11#define C8_GRAPHICS_H
12
13#include <stdint.h>
14
18#define C8_LOW_DISPLAY_WIDTH 64
19
23#define C8_LOW_DISPLAY_HEIGHT 32
24
28#define C8_HIGH_DISPLAY_WIDTH 128
29
33#define C8_HIGH_DISPLAY_HEIGHT 64
34
38#define C8_DEFAULT_WINDOW_WIDTH 800
39
43#define C8_DEFAULT_WINDOW_HEIGHT 400
44
48#define C8_WINDOW_SCALE_X (C8_DEFAULT_WINDOW_WIDTH / C8_LOW_DISPLAY_WIDTH)
49
53#define C8_WINDOW_SCALE_Y (C8_DEFAULT_WINDOW_HEIGHT / C8_LOW_DISPLAY_HEIGHT)
54
58#define C8_DISPLAYMODE_LOW 0
59
63#define C8_DISPLAYMODE_HIGH 1
64
70typedef struct {
72 uint8_t mode;
73 uint8_t x;
74 uint8_t y;
76
77uint8_t* c8_get_pixel(C8_Display*, int, int);
78
79extern void c8_beep(void);
80extern void c8_deinit_graphics(void);
81extern uint8_t c8_init_graphics(void);
82extern void c8_render(C8_Display*, int*);
83extern int c8_tick(int*);
84
85#endif
int c8_tick(int *)
Grab current keypresses and delay execution to match clockspeed.
Definition: graphics.c:61
void c8_deinit_graphics(void)
Deinitialize graphics system.
Definition: graphics.c:27
uint8_t c8_init_graphics(void)
Initialize graphics system.
Definition: graphics.c:38
void c8_render(C8_Display *, int *)
Render graphics.
Definition: graphics.c:50
void c8_beep(void)
Play sound.
Definition: graphics.c:18
uint8_t * c8_get_pixel(C8_Display *, int, int)
Get the value of (x,y) from display
Definition: graphics.c:75
#define C8_HIGH_DISPLAY_HEIGHT
Height of the high-resolution display.
Definition: graphics.h:33
#define C8_HIGH_DISPLAY_WIDTH
Width of the high-resolution display.
Definition: graphics.h:28
Represents a graphics display.
Definition: graphics.h:70
uint8_t x
Offset (for C8_DISPLAYMODE_LOW)
Definition: graphics.h:73
uint8_t y
Offset (for C8_DISPLAYMODE_HIGH)
Definition: graphics.h:74
uint8_t mode
Display mode (C8_DISPLAYMODE_LOW or C8_DISPLAYMODE_HIGH)
Definition: graphics.h:72