-
Notifications
You must be signed in to change notification settings - Fork 0
/
n2DLib.h
executable file
·79 lines (70 loc) · 2.75 KB
/
n2DLib.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
72
73
74
75
76
77
78
79
#ifndef INCLUDE_GRAFX
#define INCLUDE_GRAFX
#include <os.h>
#include <stdarg.h>
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
typedef int Fixed;
typedef struct
{
int x;
int y;
int h;
int w;
} Rect;
#define itofix(x) ((x) << 8)
#define fixtoi(x) ((x) >> 8)
#define fixmul(x, y) ((x)* (y) >> 8)
#define fixdiv(x, y) (((x) << 8) / (y))
#define clamp(x, a, b) min(max(x, a), b)
#define sign(x) ((x) < 0)
#define fixsin(x) fixcos((x) - 64)
#ifdef __cplusplus
extern "C" {
#endif
extern Fixed fixcos(Fixed angle);
extern void rotate(int x, int y, int cx, int cy, Fixed angle, Rect* out);
extern void getBoundingBox(int x, int y, int w, int h, int cx, int cy, Fixed angle, Rect *out);
extern int sq(int);
extern Fixed fixsq(Fixed);
extern int cube(int);
extern Fixed fixcube(Fixed);
extern void initBuffering();
extern void updateScreen();
extern void deinitBuffering();
extern void timer_init(unsigned);
extern void timer_restore(unsigned);
extern void timer_load(unsigned, unsigned);
extern unsigned timer_read(unsigned);
extern void clearBufferB();
extern void clearBufferW();
extern void clearBuffer(unsigned short);
extern unsigned short getPixel(const unsigned short*, unsigned int, unsigned int);
extern void setPixelUnsafe(unsigned int, unsigned int, unsigned short);
extern void setPixel(unsigned int, unsigned int, unsigned short);
extern void setPixelRGB(unsigned int, unsigned int, unsigned char, unsigned char, unsigned char);
extern void drawHLine(int, int, int, unsigned short);
extern void drawVLine(int, int, int, unsigned short);
extern void fillRect(int, int, int, int, unsigned short);
extern void drawSprite(const unsigned short*, int, int);
extern void drawSpritePart(const unsigned short*, int, int, const Rect*);
extern void drawSpriteScaled(const unsigned short*, const Rect*);
extern void drawSpriteRotated(const unsigned short*, const Rect*, const Rect*, Fixed);
extern void drawLine(int, int, int, int, unsigned short);
extern void drawPolygon(unsigned short, int, ...);
extern void fillCircle(int, int, int, unsigned short);
extern void fillEllipse(int, int, int, int, unsigned short);
extern void drawString(int*, int*, int, const char*, unsigned short, unsigned short);
extern void drawDecimal(int*, int*, int, unsigned short, unsigned short);
extern void drawChar(int*, int*, int, char, unsigned short, unsigned short);
extern void drawStringF(int*, int*, int, unsigned short, unsigned short, const char*, ...);
extern int numberWidth(int);
extern int stringWidth(const char*);
extern int get_key_pressed(t_key*);
extern int isKey(t_key, t_key);
#define BUFF_BYTES_SIZE (320*240*2)
extern unsigned short *BUFF_BASE_ADDRESS;
#ifdef __cplusplus
}
#endif
#endif