1 #include "Rogue.h"
2 
3 #define U_MIDDLE_DOT  0x00b7
4 #define U_FOUR_DOTS  0x2237
5 #define U_DIAMOND  0x25c7
6 #define U_FLIPPED_V  0x22CF
7 #define U_ARIES  0x2648
8 #define U_ESZETT  0x00df
9 #define U_ANKH  0x2640
10 #define U_MUSIC_NOTE  0x266A
11 #define U_CIRCLE  0x26AA
12 #define U_LIGHTNING_BOLT  0x03DF
13 #define U_FILLED_CIRCLE  0x25cf
14 #define U_NEUTER  0x26b2
15 #define U_U_ACUTE  0x00da
16 #define U_CURRENCY 0x00A4
17 #define U_UP_ARROW  0x2191
18 #define U_DOWN_ARROW  0x2193
19 #define U_LEFT_ARROW  0x2190
20 #define U_RIGHT_ARROW  0x2192
21 #define U_OMEGA  0x03A9
22 #define U_CIRCLE_BARS  0x29F2
23 #define U_FILLED_CIRCLE_BARS  0x29F3
24 
25 // #define U_UP_TRIANGLE  0x2206
26 // #define U_DOWN_TRIANGLE  0x2207
27 // #define U_THETA  0x03B8
28 // #define U_LAMDA  0x03BB
29 // #define U_KOPPA  0x03DE
30 // #define U_LOZENGE  0x29EB
31 // #define U_CROSS_PRODUCT  0x2A2F
32 
33 struct brogueConsole {
34     /*
35     The platform entrypoint, called by the main function. Should initialize
36     and then call rogueMain.
37     */
38     void (*gameLoop)();
39 
40     /*
41     Pause the game, returning a boolean specifying whether an input event
42     is available for receiving with nextKeyOrMouseEvent.
43     */
44     boolean (*pauseForMilliseconds)(short milliseconds);
45 
46     /*
47     Block until an event is available and then update returnEvent with
48     its details. textInput is true iff a text-entry box is active. See
49     sdl2-platform.c for the boilerplate for colorsDance.
50     */
51     void (*nextKeyOrMouseEvent)(rogueEvent *returnEvent, boolean textInput, boolean colorsDance);
52 
53     /*
54     Draw a character at a location with a specific color.
55     */
56     void (*plotChar)(
57         enum displayGlyph inputChar,
58         short x, short y,
59         short foreRed, short foreGreen, short foreBlue,
60         short backRed, short backGreen, short backBlue
61     );
62 
63     void (*remap)(const char *, const char *);
64 
65     /*
66     Returns whether a keyboard modifier is active -- 0 for Shift, 1 for Ctrl.
67     */
68     boolean (*modifierHeld)(int modifier);
69 
70     /*
71     Optional. Notifies the platform code of an event during the game - e.g. victory
72     */
73     void (*notifyEvent)(short eventId, int data1, int data2, const char *str1, const char *str2);
74 
75     /*
76     Optional. Take a screenshot in current working directory
77     */
78     boolean (*takeScreenshot)();
79 
80     /*
81     Optional. Enables or disables graphical tiles, returning the new state. This
82     is called when the user changes the option in-game. It is also called at the
83     very start of the program, even before .gameLoop, to set the initial value.
84     */
85     enum graphicsModes (*setGraphicsMode)(enum graphicsModes mode);
86 };
87 
88 // defined in platform
89 void loadKeymap();
90 void dumpScores();
91 unsigned int glyphToUnicode(enum displayGlyph glyph);
92 boolean isEnvironmentGlyph(enum displayGlyph glyph);
93 
94 #ifdef BROGUE_SDL
95 extern struct brogueConsole sdlConsole;
96 extern int windowWidth;
97 extern int windowHeight;
98 extern boolean fullScreen;
99 extern boolean softwareRendering;
100 #endif
101 
102 #ifdef BROGUE_CURSES
103 extern struct brogueConsole cursesConsole;
104 #endif
105 
106 #ifdef BROGUE_WEB
107 extern struct brogueConsole webConsole;
108 #endif
109 
110 extern struct brogueConsole currentConsole;
111 extern boolean noMenu;
112 extern char dataDirectory[];
113 
114 // defined in brogue
115 extern playerCharacter rogue;
116 
117