]> Shamusworld >> Repos - apple2/blob - src/gui/guimisc.h
Added missing files. :-P
[apple2] / src / gui / guimisc.h
1 //
2 // GUIMISC.H
3 //
4 // Graphical User Interface support functions
5 //
6
7 #ifndef __GUIMISC_H__
8 #define __GUIMISC_H__
9
10 #include <SDL.h>
11 #include <stdarg.h>
12 #include <stdint.h>
13
14 // Useful structs
15
16 struct Font
17 {
18         Font(uint8_t * d = NULL, uint32_t w = 0, uint32_t h = 0): data(d), width(w), height(h) {}
19
20         uint8_t * data;
21         uint32_t width, height;
22 };
23
24 // Okay, this is ugly but works and I can't think of any better way to handle this. So what
25 // we do when we pass the GIMP bitmaps into a function is pass them as a (void *) and then
26 // cast them as type (Bitmap *) in order to use them. Yes, it's ugly. Come up with something
27 // better!
28
29 /*struct Bitmap {
30         unsigned int width;
31         unsigned int height;
32         unsigned int bytesPerPixel;                                     // 3:RGB, 4:RGBA
33         unsigned char pixelData[];
34 };*/
35
36 // A better way is just to use the following format:
37 // bytes 0-1: width (HI/LO)
38 // bytes 2-3: height (HI/LO)
39 // bytes 4-n: pixel data in RGBA format
40
41 // Global functions
42
43 //void SetFont(uint8_t *, uint32_t, uint32_t);
44 void SetNewFont(Font);
45 void RestoreOldFont(void);
46 uint32_t GetFontWidth(void);
47 uint32_t GetFontHeight(void);
48 void DrawStringTrans(SDL_Surface * screen, uint32_t x, uint32_t y, uint32_t color, const char * text, ...);
49 void DrawStringOpaque(SDL_Surface * screen, uint32_t x, uint32_t y, uint32_t fg, uint32_t bg, const char * text, ...);
50
51 //Not sure these belong here, but there you go...
52 bool RectanglesIntersect(SDL_Rect r1, SDL_Rect r2);
53 bool RectangleFirstInsideSecond(SDL_Rect r1, SDL_Rect r2);
54
55 // GUI bitmaps (exported)
56
57 extern uint8_t closeBox[];
58 extern uint8_t closeBoxDown[];
59 extern uint8_t closeBoxHover[];
60 extern uint8_t floppyDiskImg[];
61
62 #endif  // __GUIMISC_H__