1
0
mirror of https://github.com/simh/simh.git synced 2026-02-01 22:33:25 +00:00

VIDEO: Allow more than one window.

New sim_video APIs have been added to make it possible for a simulator
to open multiple windows.  Two slightly updated functions are:

t_stat vid_open_window (VID_DISPLAY **vptr, DEVICE *dptr, const char *title, uint32 width, uint32 height, int flags);

Like vid_open, but return a dynamically allocated VID_DISPLAY struct
and return it in *vptr.

t_stat vid_close_all (void);

Close all currently opened windows.

In addition, these new functions correspond completely to the old set
of sim_video functions, except the first argument is a VID_DISPLAY
pointer: vid_close_window, vid_map_rgb_window, vid_draw_window,
vid_refresh_window, vid_set_cursor_window, vid_show_video_window,
vid_is_fullscreen_window, vid_set_fullscreen_window,
vid_set_cursor_position_window.
This commit is contained in:
Lars Brinkhoff
2020-11-24 13:24:43 +01:00
parent 983b3ae278
commit 3fc46f3b57
3 changed files with 499 additions and 287 deletions

View File

@@ -157,6 +157,8 @@ extern "C" {
#define SIM_KEY_UNKNOWN 200
typedef struct VID_DISPLAY VID_DISPLAY;
struct mouse_event {
int32 x_rel; /* X axis relative motion */
int32 y_rel; /* Y axis relative motion */
@@ -165,11 +167,15 @@ struct mouse_event {
t_bool b1_state; /* state of button 1 */
t_bool b2_state; /* state of button 2 */
t_bool b3_state; /* state of button 3 */
DEVICE *dev; /* which device */
VID_DISPLAY *vptr; /* which display */
};
struct key_event {
uint32 key; /* key sym */
uint32 state; /* key state change */
DEVICE *dev; /* which device */
VID_DISPLAY *vptr; /* which display */
};
typedef struct mouse_event SIM_MOUSE_EVENT;
@@ -201,9 +207,21 @@ t_stat vid_screenshot (const char *filename);
t_bool vid_is_fullscreen (void);
t_stat vid_set_fullscreen (t_bool flag);
extern t_bool vid_active;
extern int vid_active;
void vid_set_cursor_position (int32 x, int32 y); /* cursor position (set by calling code) */
t_stat vid_open_window (VID_DISPLAY **vptr, DEVICE *dptr, const char *title, uint32 width, uint32 height, int flags);
t_stat vid_close_window (VID_DISPLAY *vptr);
t_stat vid_close_all (void);
uint32 vid_map_rgb_window (VID_DISPLAY *vptr, uint8 r, uint8 g, uint8 b);
void vid_draw_window (VID_DISPLAY *vptr, int32 x, int32 y, int32 w, int32 h, uint32 *buf);
void vid_refresh_window (VID_DISPLAY *vptr);
t_stat vid_set_cursor_window (VID_DISPLAY *vptr, t_bool visible, uint32 width, uint32 height, uint8 *data, uint8 *mask, uint32 hot_x, uint32 hot_y);
t_stat vid_show_video_window (VID_DISPLAY *vptr, FILE* st, UNIT* uptr, int32 val, CONST void* desc);
t_bool vid_is_fullscreen_window (VID_DISPLAY *vptr);
t_stat vid_set_fullscreen_window (VID_DISPLAY *vptr, t_bool flag);
void vid_set_cursor_position_window (VID_DISPLAY *vptr, int32 x, int32 y); /* cursor position (set by calling code) */
/* A device simulator can optionally set the vid_display_kb_event_process
* routine pointer to the address of a routine.
* Simulator code which uses the display library which processes window