-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphics.c
53 lines (43 loc) · 1.47 KB
/
graphics.c
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
#include "graphics.h"
#include <math.h>
#include <string.h>
#include "glout.h"
#include "message.h"
OutType outType = OT_SDLOPENGL;
typedef struct
{
OutLoadBitmapFunc loadBitmap;
OutInitSubsystemFunc initSubsystem;
OutBlitBitmapFunc blitBitmap;
OutSetBackground setBackground;
OutClearBuffer clearBuffer;
OutBlitBuffer blitBuffer;
OutSetFadeColor setFadeColor;
OutDrawRectangle drawRectangle;
OutBlitPartBitmap blitPartBitmap;
} OutFuncs;
OutFuncs outFuncs[OT_LAST] = {
{
loadBitmap: &gloutLoadBitmap,
initSubsystem: &gloutInitSubsystem,
blitBitmap: &gloutBlitBitmap,
setBackground: &gloutSetBackground,
clearBuffer: &gloutClearBuffer,
blitBuffer: &gloutBlitBuffer,
setFadeColor: &gloutSetFadeColor,
drawRectangle: &gloutDrawRectangle,
blitPartBitmap: &gloutBlitPartBitmap,
},
};
void graphics_Init(int screen_width, int screen_height)
{
outFuncs[outType].initSubsystem(screen_width, screen_height);
graphics_LoadBitmap = outFuncs[outType].loadBitmap;
graphics_BlitBitmap = outFuncs[outType].blitBitmap;
graphics_BlitPartBitmap = outFuncs[outType].blitPartBitmap;
graphics_SetBackground = outFuncs[outType].setBackground;
graphics_ClearBuffer = outFuncs[outType].clearBuffer;
graphics_BlitBuffer = outFuncs[outType].blitBuffer;
graphics_SetFadeColor = outFuncs[outType].setFadeColor;
graphics_DrawRectangle = outFuncs[outType].drawRectangle;
}