-
Notifications
You must be signed in to change notification settings - Fork 0
/
gfx.h
71 lines (49 loc) · 1.91 KB
/
gfx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
A simple graphics library for CSE 20211 by Douglas Thain
For course assignments, you should not change this file.
For complete documentation, see:
http://www.nd.edu/~dthain/courses/cse20211/fall2011/gfx
version 4, 01/29/2020 - Added missing window size functions and fixed key lookup.
Version 3, 11/07/2012 - Now much faster at changing colors rapidly.
Version 2, 9/23/2011 - Fixes a bug that could result in jerky animation.
*/
#ifndef GFX_H
#define GFX_H
/* Open a new graphics window. */
void gfx_open( int width, int height, const char *title );
/* Draw a point at (x,y) */
void gfx_point( int x, int y );
/* Draw a line from (x1,y1) to (x2,y2) */
void gfx_line( int x1, int y1, int x2, int y2 );
/* Change the current drawing color. */
void gfx_color( int red, int green, int blue );
/* Clear the graphics window to the background color. */
void gfx_clear();
/* Change the current background color. */
void gfx_clear_color( int red, int green, int blue );
/* Wait for the user to press a key or mouse button. */
int gfx_wait();
/* Return the X and Y coordinates of the last event. */
int gfx_xpos();
int gfx_ypos();
/* Return the X and Y dimensions of the window. */
int gfx_xsize();
int gfx_ysize();
/* Check to see if an event is waiting. */
int gfx_event_waiting();
/* Flush all previous output to the window. */
void gfx_flush();
//Added later not included in original gfx
/*Return pixel value in 24 bits */
int get_pixel(int x,int y);
/* Converts keyboard inputs to chip-8 inputs */
int convert_key(int key_value);
/* Returns the number of events in the event queue. */
int check_queue();
/* Removes the event that is waiting in the queue. */
int remove_event();
/* The difference from the gfx_wait function is that itreads events from the Xlib queue without removing them. */
int get_key();
/*Takes an event from the event queue, allowing only one event to be present in the queue. */
int get_keyboard_event();
#endif