1 /* aNetHack 0.0.1 winMS.h $ANH-Date: 1433806609 2015/06/08 23:36:49 $ $ANH-Branch: master $:$ANH-Revision: 1.29 $ */
2 /* Copyright (C) 2001 by Alex Kompel */
3 /* aNetHack may be freely redistributed. See license for details. */
8 #pragma warning(disable : 4142) /* benign redefinition of type */
10 #define WIN32_LEAN_AND_MEAN
18 #if defined(WIN_CE_POCKETPC)
23 #if defined(WIN_CE_SMARTPHONE)
33 #if defined(WIN_CE_PS2xx) || defined(WIN32_PLATFORM_HPCPRO)
37 /* Taskbar Menu height */
38 #define MENU_HEIGHT 26
40 /* Create an array to keep track of the various windows */
56 /* tiles per line in the bitmap */
57 #define TILES_PER_LINE 40
59 /* tile background color */
60 #define TILE_BK_COLOR RGB(71, 108, 108)
62 /* minimum/maximum font size (in points - 1/72 inch) */
63 #define NHFONT_DEFAULT_SIZE 9
64 #define NHFONT_STATUS_DEFAULT_SIZE 6
65 #define NHFONT_SIZE_MIN 3
66 #define NHFONT_SIZE_MAX 20
68 typedef struct mswin_nhwindow_data
{
72 } MSNHWinData
, *PMSNHWinData
;
74 /* global application data - alailable thour GetNHApp() */
75 typedef struct mswin_nhwindow_app
{
76 HINSTANCE hApp
; /* hInstance from WinMain */
77 int nCmdShow
; /* main window mode flag */
78 HWND hMainWnd
; /* main window handle */
79 HACCEL hAccelTable
; /* accelerator table */
80 HWND hPopupWnd
; /* active dialog window (anethack menu, text, etc) */
81 HWND hMenuBar
; /* menu bar */
83 MSNHWinData windowlist
[MAXWINDOWS
]; /* anethack windows array */
85 HBITMAP bmpTiles
; /* anethack tiles */
86 HBITMAP bmpPetMark
; /* pet mark Bitmap */
87 HBITMAP bmpMapTiles
; /* alternative map tiles */
88 int mapTile_X
; /* alt. tiles width */
89 int mapTile_Y
; /* alt. tiles height */
90 int mapTilesPerLine
; /* number of tile per row in the bitmap */
92 boolean bNoHScroll
; /* disable cliparound for horizontal grid (map) */
93 boolean bNoVScroll
; /* disable cliparound for vertical grid (map) */
95 int mapDisplayModeSave
; /* saved map display mode */
97 int bCmdPad
; /* command pad - on-screen keyboard */
98 HWND hCmdWnd
; /* handle of on-screen keyboard window */
101 boolean bWrapText
; /* format text to fit the window */
102 boolean bFullScreen
; /* run anethack in full-screen mode */
103 boolean bHideScrollBars
; /* hide scroll bars */
104 boolean bUseSIP
; /* use SIP (built-in software keyboard) for menus
106 } NHWinApp
, *PNHWinApp
;
107 extern PNHWinApp
GetNHApp();
111 E
struct window_procs mswin_procs
;
115 /* Some prototypes */
116 void mswin_init_nhwindows(int *argc
, char **argv
);
117 void mswin_player_selection(void);
118 void mswin_askname(void);
119 void mswin_get_nh_event(void);
120 void mswin_exit_nhwindows(const char *);
121 void mswin_suspend_nhwindows(const char *);
122 void mswin_resume_nhwindows(void);
123 winid
mswin_create_nhwindow(int type
);
124 void mswin_clear_nhwindow(winid wid
);
125 void mswin_display_nhwindow(winid wid
, BOOLEAN_P block
);
126 void mswin_destroy_nhwindow(winid wid
);
127 void mswin_curs(winid wid
, int x
, int y
);
128 void mswin_putstr(winid wid
, int attr
, const char *text
);
129 void mswin_putstr_ex(winid wid
, int attr
, const char *text
, boolean append
);
130 void mswin_display_file(const char *filename
, BOOLEAN_P must_exist
);
131 void mswin_start_menu(winid wid
);
132 void mswin_add_menu(winid wid
, int glyph
, const ANY_P
*identifier
,
133 CHAR_P accelerator
, CHAR_P group_accel
, int attr
,
134 const char *str
, BOOLEAN_P presel
);
135 void mswin_end_menu(winid wid
, const char *prompt
);
136 int mswin_select_menu(winid wid
, int how
, MENU_ITEM_P
**selected
);
137 void mswin_update_inventory(void);
138 void mswin_mark_synch(void);
139 void mswin_wait_synch(void);
140 void mswin_cliparound(int x
, int y
);
141 void mswin_print_glyph(winid wid
, XCHAR_P x
, XCHAR_P y
, int glyph
, int bkglyph
);
142 void mswin_raw_print(const char *str
);
143 void mswin_raw_print_bold(const char *str
);
144 int mswin_nhgetch(void);
145 int mswin_nh_poskey(int *x
, int *y
, int *mod
);
146 void mswin_nhbell(void);
147 int mswin_doprev_message(void);
148 char mswin_yn_function(const char *question
, const char *choices
, CHAR_P def
);
149 void mswin_getlin(const char *question
, char *input
);
150 int mswin_get_ext_cmd(void);
151 void mswin_number_pad(int state
);
152 void mswin_delay_output(void);
153 void mswin_change_color(void);
154 char *mswin_get_color_string(void);
155 void mswin_start_screen(void);
156 void mswin_end_screen(void);
157 void mswin_outrip(winid wid
, int how
, time_t when
);
158 void mswin_preference_update(const char *pref
);
160 /* helper function */
161 HWND
mswin_hwnd_from_winid(winid wid
);
162 winid
mswin_winid_from_type(int type
);
163 winid
mswin_winid_from_handle(HWND hWnd
);
164 void mswin_window_mark_dead(winid wid
);
165 void bail(const char *mesg
);
166 void nhapply_image_transparent(HDC hDC
, int x
, int y
, int width
, int height
,
167 HDC sourceDC
, int s_x
, int s_y
, int s_width
,
168 int s_height
, COLORREF cTransparent
);
169 void mswin_popup_display(HWND popup
, int *done_indicator
);
170 void mswin_popup_destroy(HWND popup
);
172 #if defined(WIN_CE_SMARTPHONE)
173 void NHSPhoneDialogSetup(HWND hDlg
, UINT nToolBarId
, BOOL is_edit
,
177 void mswin_read_reg(void);
178 void mswin_destroy_reg(void);
179 void mswin_write_reg(void);
181 BOOL
mswin_has_keyboard(void);
183 void mswin_set_fullscreen(BOOL is_fullscreen
);
185 extern winid WIN_STATUS
;
187 #endif /* WINmswin_H */