mirror of
https://github.com/david-schmidt/gsport.git
synced 2025-02-08 01:31:10 +00:00
Allow Windows users to hide the debug status lines with Shift-F10.
This commit is contained in:
parent
571afca835
commit
e8c512a898
@ -121,6 +121,7 @@ F8: Toggle pointer hiding on/off.
|
||||
F9: Invert the sense of the joystick.
|
||||
Shift-F9: Swap x and y joystick/paddle axes.
|
||||
F10: Attempt to change the a2vid_palette (only useful on 256-color displays)
|
||||
Shift-F10: Toggle visibility of the debug status lines (on Windows only)
|
||||
F11: Full screen mode (on Mac OS X and Windows).
|
||||
F12: Alias of Pause/Break which is treated as Reset
|
||||
|
||||
|
@ -1776,7 +1776,14 @@ adb_physical_key_update(int a2code, int is_up)
|
||||
}
|
||||
break;
|
||||
case 0x0a: /* F10 - change a2vid paletter */
|
||||
change_a2vid_palette((g_a2vid_palette + 1) & 0xf);
|
||||
if (SHIFT_DOWN) {
|
||||
#ifdef WIN32
|
||||
extern void x_toggle_status_lines();
|
||||
x_toggle_status_lines();
|
||||
#endif
|
||||
} else {
|
||||
change_a2vid_palette((g_a2vid_palette + 1) & 0xf);
|
||||
}
|
||||
break;
|
||||
case 0x0b: /* F11 - full screen */
|
||||
g_fullscreen = !g_fullscreen;
|
||||
|
@ -36,6 +36,7 @@ extern HWND g_hwnd_main;
|
||||
|
||||
extern char *g_status_ptrs[MAX_STATUS_LINES];
|
||||
extern int g_win_status_debug;
|
||||
extern int g_win_fullscreen_state;
|
||||
|
||||
int
|
||||
win_nonblock_read_stdin(int fd, char *bufptr, int len)
|
||||
@ -79,15 +80,37 @@ x_show_alert(int is_fatal, const char *str)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void get_default_window_size(LPRECT rect)
|
||||
void get_default_window_size(LPSIZE size)
|
||||
{
|
||||
rect->left = 0;
|
||||
rect->top = 0;
|
||||
rect->bottom = X_A2_WINDOW_HEIGHT;
|
||||
// Calculate the window client dimensions.
|
||||
RECT rect;
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.bottom = X_A2_WINDOW_HEIGHT;
|
||||
if (g_win_status_debug)
|
||||
rect->bottom += (MAX_STATUS_LINES * 16) + 32;
|
||||
rect->right = X_A2_WINDOW_WIDTH;
|
||||
AdjustWindowRect(rect, WS_TILED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, FALSE);
|
||||
rect.bottom += (MAX_STATUS_LINES * 16);
|
||||
rect.right = X_A2_WINDOW_WIDTH;
|
||||
|
||||
// Calculate the window rectangle, which is the client area plus non-client area (e.g. frame and caption).
|
||||
AdjustWindowRect(&rect, WS_TILED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, FALSE);
|
||||
|
||||
// Return the window size.
|
||||
size->cx = rect.right - rect.left;
|
||||
size->cy = rect.bottom - rect.top;
|
||||
}
|
||||
|
||||
void x_toggle_status_lines()
|
||||
{
|
||||
SIZE size;
|
||||
|
||||
if (!g_win_fullscreen_state)
|
||||
{
|
||||
g_win_status_debug = !g_win_status_debug;
|
||||
|
||||
get_default_window_size(&size);
|
||||
SetWindowPos(g_hwnd_main, NULL, 0, 0, size.cx, size.cy, SWP_NOMOVE | SWP_NOZORDER);
|
||||
x_redraw_status_lines();
|
||||
}
|
||||
}
|
||||
|
||||
int WINAPI WinMain (
|
||||
@ -105,6 +128,7 @@ main(int argc, char **argv)
|
||||
// InitCommonControls();
|
||||
|
||||
WNDCLASS wndclass;
|
||||
SIZE size;
|
||||
RECT rect;
|
||||
|
||||
wndclass.style = 0;
|
||||
@ -125,15 +149,15 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
// Create the window.
|
||||
get_default_window_size(&rect);
|
||||
get_default_window_size(&size);
|
||||
|
||||
HWND hwnd = CreateWindowEx(WS_EX_ACCEPTFILES, "gsport", "GSport - Apple //gs Emulator",
|
||||
WS_TILED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
rect.right, rect.bottom,
|
||||
size.cx, size.cy,
|
||||
NULL, NULL, GetModuleHandle(NULL), NULL);
|
||||
|
||||
printf("g_hwnd_main = %p, height = %d\n", hwnd, rect.bottom);
|
||||
printf("g_hwnd_main = %p, height = %d\n", hwnd, size.cx);
|
||||
GetWindowRect(hwnd, &rect);
|
||||
printf("...rect is: %ld, %ld, %ld, %ld\n", rect.left, rect.top,
|
||||
rect.right, rect.bottom);
|
||||
|
Loading…
x
Reference in New Issue
Block a user