-
Notifications
You must be signed in to change notification settings - Fork 3
/
DxLib.h
162 lines (128 loc) · 3.47 KB
/
DxLib.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
//This file is a reverse engineered "DxLib.h" to the extent that
//Syobon Action uses it. Minor functions are just replaced with SDL
//counterparts.
#include <SDL.h>
#include <SDL_mixer.h>
#include "sdlgfx/SDL_gfxPrimitives.h"
#include <time.h>
#include <stdio.h>
#include <math.h>
#include <stdarg.h>
#include <string.h>
#ifdef _WIN32
#ifdef _MSC_VER
#pragma warning (disable:4312)
#pragma warning (disable:4996)
#define strcasecmp _strcmpi
#else
#define strcasecmp strcmpi
#endif
#endif
#include <string>
#if defined __IOS__
extern "C" const char *IOS_BasePath();
#define PREFIX IOS_BasePath()
#define BGM_PREFIX PREFIX
#define RES_PREFIX PREFIX
#define SE_PREFIX PREFIX
#else
#ifndef PREFIX
#ifdef _MACOSX
#define PREFIX "./SyobonAction.app/Contents/Resources/data/"
#else
#define PREFIX "./data/"
#endif
#endif
#ifndef BGM_PREFIX
#define BGM_PREFIX PREFIX "bgm/"
#endif
#ifndef RES_PREFIX
#define RES_PREFIX PREFIX "res/"
#endif
#ifndef SE_PREFIX
#define SE_PREFIX PREFIX "se/"
#endif
#endif
#include "joyconfig.h"
#define TRUE 1
#define FALSE 0
#define byte unsigned char
#if SDL_MAJOR_VERSION >= 2
#define __SDL2__ 1
#endif
#ifdef __SDL2__
void ScreenFlip();
#else
#define ScreenFlip() SDL_Flip(screen)
#define SDL_INIT_EVENTS 0
#endif
#define GetNowCount() SDL_GetTicks()
//UNIMPLEMENTED - macro substitution
#define StopSoundMem(s);
#define ChangeVolumeSoundMem(s, v);
//Sound
#define DX_PLAYTYPE_LOOP -1
#define DX_PLAYTYPE_BACK 0
void PlaySoundMem (Mix_Chunk * s, int l);
Mix_Chunk *LoadSoundMem (const char *f);
Mix_Music *LoadMusicMem (const char *f);
#define CheckSoundMem(s) !s
int DxLib_Init ();
#ifdef __SDL2__
extern SDL_Renderer *renderer;
extern SDL_Window *window;
extern SDL_Texture *texture;
#endif
//Main screen
extern SDL_Surface *screen;
//Strings & fonts
#define DX_FONTTYPE_NORMAL 0
#define DX_FONTTYPE_EDGE 1
void ChangeFontType (byte type);
void DrawString (int a, int b, const char *x, Uint32 c);
void DrawFormatString (int a, int b, Uint32 color, const char *str, ...);
//Key Aliases
#define KEY_INPUT_ESCAPE SDLK_ESCAPE
#define KEY_INPUT_LEFT SDLK_LEFT
#define KEY_INPUT_RIGHT SDLK_RIGHT
#define KEY_INPUT_DOWN SDLK_DOWN
#define KEY_INPUT_UP SDLK_UP
#define KEY_INPUT_F1 SDLK_F1
#define KEY_INPUT_N SDLK_n
#define KEY_INPUT_O SDLK_o
#define KEY_INPUT_Z SDLK_z
#define KEY_INPUT_RETURN SDLK_RETURN
#define KEY_INPUT_SPACE SDLK_SPACE
#define KEY_INPUT_1 SDLK_1
#define KEY_INPUT_2 SDLK_2
#define KEY_INPUT_3 SDLK_3
#define KEY_INPUT_4 SDLK_4
#define KEY_INPUT_5 SDLK_5
#define KEY_INPUT_6 SDLK_6
#define KEY_INPUT_7 SDLK_7
#define KEY_INPUT_8 SDLK_8
#define KEY_INPUT_9 SDLK_9
#define KEY_INPUT_0 SDLK_0
#ifdef SDL_JOYSTICK_DISABLED
#define SDL_JoystickOpen(a) NULL
#define SDL_JoystickClose(a)
#define SDL_JoystickName(a) ""
#define SDL_JoystickGetButton(a,b) 0
#define SDL_NumJoysticks() 0
#define SDL_Joystick int
#endif
extern SDL_Joystick *joystick;
void UpdateKeys ();
byte ProcessMessage ();
byte CheckHitKey (int key);
void WaitKey ();
#define GetColor(r, g, b) SDL_MapRGB(screen->format, r, g, b)
#define DrawGraph(a, b, mx, z) DrawGraphZ(a, b, mx)
void DrawGraphZ (int a, int b, SDL_Surface * mx);
#define DrawTurnGraph(a, b, mx, z) DrawTurnGraphZ(a, b, mx)
void DrawTurnGraphZ (int a, int b, SDL_Surface * mx);
void DrawVertTurnGraph (int a, int b, SDL_Surface * mx);
SDL_Surface *DerivationGraph (int srcx, int srcy, int width, int height,
SDL_Surface * src);
//Noticably different than the original
SDL_Surface *LoadGraph (const char *filename);