1 /* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
2 /* NetHack may be freely redistributed. See license for details. */
7 #define WIN32_LEAN_AND_MEAN
13 /* Create an array to keep track of the various windows */
26 #define TILES_PER_LINE 40
28 /* tile background color */
29 #define TILE_BK_COLOR RGB(71, 108, 108)
31 /* minimum/maximum font size (in points - 1/72 inch) */
32 #define NHFONT_DEFAULT_SIZE 9
33 #define NHFONT_SIZE_MIN 3
34 #define NHFONT_SIZE_MAX 20
36 #define MAX_LOADSTRING 100
38 typedef struct mswin_nhwindow_data {
42 } MSNHWinData, *PMSNHWinData;
44 typedef struct mswin_nhwindow_app {
48 HWND hPopupWnd; /* current popup window */
50 MSNHWinData windowlist[MAXWINDOWS];
54 HBITMAP bmpMapTiles; /* custom tiles bitmap */
57 int mapTile_X; /* tile width */
58 int mapTile_Y; /* tile height */
59 int mapTilesPerLine; /* number of tile per row in the bitmap */
61 boolean bNoHScroll; /* disable cliparound for horizontal grid (map) */
62 boolean bNoVScroll; /* disable cliparound for vertical grid (map) */
64 int mapDisplayModeSave; /* saved map display mode */
68 DWORD saveRegistrySettings; /* Flag if we should save this time */
69 DWORD regNetHackMode; /* NetHack mode means no Windows keys in some places */
79 DWORD regMainShowState;
80 } NHWinApp, *PNHWinApp;
84 E PNHWinApp GetNHApp(void);
85 E struct window_procs mswin_procs;
90 void mswin_init_nhwindows(int* argc, char** argv);
91 void mswin_player_selection(void);
92 void mswin_askname(void);
93 void mswin_get_nh_event(void);
94 void mswin_exit_nhwindows(const char *);
95 void mswin_suspend_nhwindows(const char *);
96 void mswin_resume_nhwindows(void);
97 winid mswin_create_nhwindow(int type);
98 void mswin_clear_nhwindow(winid wid);
99 void mswin_display_nhwindow(winid wid, BOOLEAN_P block);
100 void mswin_destroy_nhwindow(winid wid);
101 void mswin_curs(winid wid, int x, int y);
102 void mswin_putstr(winid wid, int attr, const char *text);
103 void mswin_putstr_ex(winid wid, int attr, const char *text, int);
104 void mswin_display_file(const char *filename,BOOLEAN_P must_exist);
105 void mswin_start_menu(winid wid);
106 void mswin_add_menu(winid wid, int glyph, const ANY_P * identifier,
107 CHAR_P accelerator, CHAR_P group_accel, int attr,
108 const char *str, BOOLEAN_P presel);
109 void mswin_end_menu(winid wid, const char *prompt);
110 int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected);
111 void mswin_update_inventory(void);
112 void mswin_mark_synch(void);
113 void mswin_wait_synch(void);
114 void mswin_cliparound(int x, int y);
115 void mswin_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph);
116 void mswin_raw_print(const char *str);
117 void mswin_raw_print_bold(const char *str);
118 int mswin_nhgetch(void);
119 int mswin_nh_poskey(int *x, int *y, int *mod);
120 void mswin_nhbell(void);
121 int mswin_doprev_message(void);
122 char mswin_yn_function(const char *question, const char *choices,
124 void mswin_getlin(const char *question, char *input);
125 int mswin_get_ext_cmd(void);
126 void mswin_number_pad(int state);
127 void mswin_delay_output(void);
128 void mswin_change_color(void);
129 char *mswin_get_color_string(void);
130 void mswin_start_screen(void);
131 void mswin_end_screen(void);
132 void mswin_outrip(winid wid, int how);
133 void mswin_preference_update(const char *pref);
135 /* helper function */
136 HWND mswin_hwnd_from_winid(winid wid);
137 winid mswin_winid_from_type(int type);
138 winid mswin_winid_from_handle(HWND hWnd);
139 void mswin_window_mark_dead(winid wid);
140 void bail(const char *mesg);
141 void nhapply_image_transparent(
142 HDC hDC, int x, int y, int width, int height,
143 HDC sourceDC, int s_x, int s_y, int s_width, int s_height,
144 COLORREF cTransparent
147 void mswin_popup_display(HWND popup, int* done_indicator);
148 void mswin_popup_destroy(HWND popup);
150 void mswin_read_reg(void);
151 void mswin_destroy_reg(void);
152 void mswin_write_reg(void);
154 int NHMessageBox(HWND hWnd, LPCTSTR text, UINT type);
156 extern HBRUSH menu_bg_brush;
157 extern HBRUSH menu_fg_brush;
158 extern HBRUSH text_bg_brush;
159 extern HBRUSH text_fg_brush;
160 extern HBRUSH status_bg_brush;
161 extern HBRUSH status_fg_brush;
162 extern HBRUSH message_bg_brush;
163 extern HBRUSH message_fg_brush;
165 extern COLORREF menu_bg_color;
166 extern COLORREF menu_fg_color;
167 extern COLORREF text_bg_color;
168 extern COLORREF text_fg_color;
169 extern COLORREF status_bg_color;
170 extern COLORREF status_fg_color;
171 extern COLORREF message_bg_color;
172 extern COLORREF message_fg_color;
175 #define SYSCLR_TO_BRUSH(x) ((HBRUSH)((x) + 1))
179 #define NH_W2A(w, a, cb) ( WideCharToMultiByte( \
189 #define NH_A2W(a, w, cb) ( MultiByteToWideChar( \
197 #define NH_W2A(w, a, cb) (strncpy((a), (w), (cb)))
199 #define NH_A2W(a, w, cb) (strncpy((w), (a), (cb)))
202 #endif /* WINmswin_H */