MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / con_Create

Function con_Create

win32/wincon.cpp:216–262  ·  view source on GitHub ↗

console window helper functions

Source from the content-addressed store, hash-verified

214
215// console window helper functions
216void con_Create(HWND hWnd, LPCREATESTRUCT lpcs) {
217 oeWin32Application *app = (oeWin32Application *)lpcs->lpCreateParams;
218 HDC hdc;
219 HFONT oldfont;
220 RECT rect;
221 TEXTMETRIC tm;
222
223 // create console region
224 Con_row = 0;
225 Con_col = 0;
226 Con_buffer = new char[CON_SCROLL_ROWS * (CON_SCROLL_COLS + 1)];
227 Con_read_buf[0] = 0;
228 Con_inp_pos = 0;
229 memset(Con_inp_buf, 0, sizeof(Con_inp_buf));
230 memset(Con_buffer, 0, CON_SCROLL_ROWS * (CON_SCROLL_COLS + 1));
231 memset(Con_last_command, 0, sizeof(Con_last_command));
232
233 con_Puts("Outrage PC Console v1.0\n");
234
235 Con_newline = true;
236
237 // get font width and height
238 hdc = GetDC(hWnd);
239 oldfont = (HFONT)SelectObject(hdc, (HFONT)GetStockObject(ANSI_FIXED_FONT));
240 GetTextMetrics(hdc, &tm);
241 Con_ch_w = tm.tmMaxCharWidth;
242 Con_ch_h = tm.tmHeight;
243 rect.left = lpcs->x;
244 rect.top = lpcs->y;
245 rect.right = rect.left + Con_ch_w * CON_SCROLL_COLS;
246 rect.bottom = rect.top + Con_ch_h * CON_SCROLL_ROWS;
247
248 AdjustWindowRect(&rect, lpcs->style, FALSE);
249 MoveWindow(hWnd, lpcs->x, lpcs->y, rect.right - rect.left, rect.bottom - rect.top, TRUE);
250
251 app->m_X = lpcs->x;
252 app->m_Y = lpcs->y;
253 app->m_W = rect.right - rect.left;
254 app->m_H = rect.bottom - rect.top;
255
256 SelectObject(hdc, oldfont);
257 ReleaseDC(hWnd, hdc);
258
259 EnableMenuItem(GetSystemMenu(hWnd, FALSE), SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
260
261 hConWnd = hWnd;
262}
263
264void con_Paint(HWND hWnd) {
265 PAINTSTRUCT ps;

Callers 1

MyConProcFunction · 0.70

Calls 2

con_PutsFunction · 0.85
SelectObjectFunction · 0.85

Tested by

no test coverage detected