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:
parent
983b3ae278
commit
3fc46f3b57
3 changed files with 499 additions and 287 deletions
15
scp.c
15
scp.c
|
@ -1567,9 +1567,7 @@ static const char simh_help2[] =
|
|||
"+sh{ow} ethernet show ethernet devices\n"
|
||||
"+sh{ow} serial show serial devices\n"
|
||||
"+sh{ow} multiplexer {dev} show open multiplexer device info\n"
|
||||
#if defined(USE_SIM_VIDEO)
|
||||
"+sh{ow} video show video capabilities\n"
|
||||
#endif
|
||||
"+sh{ow} clocks show calibrated timer information\n"
|
||||
"+sh{ow} throttle show throttle info\n"
|
||||
"+sh{ow} on show on condition actions\n"
|
||||
|
@ -2416,7 +2414,7 @@ static const char simh_help2[] =
|
|||
/***************** 80 character line width template *************************/
|
||||
#define HLP_SCREENSHOT "*Commands Screenshot_Video_Window"
|
||||
"2Screenshot Video Window\n"
|
||||
" Simulators with Video devices display the simulated video in a window\n"
|
||||
" Simulators with Video devices display the simulated video in a window(s)\n"
|
||||
" on the local system. The contents of that display can be saved in a\n"
|
||||
" file with the SCREENSHOT command:\n\n"
|
||||
"++SCREENSHOT screenshotfile\n\n"
|
||||
|
@ -2546,9 +2544,7 @@ static CTAB cmd_table[] = {
|
|||
{ "SLEEP", &sleep_cmd, 0, HLP_SLEEP, NULL, NULL },
|
||||
{ "!", &spawn_cmd, 0, HLP_SPAWN, NULL, NULL },
|
||||
{ "HELP", &help_cmd, 0, HLP_HELP, NULL, NULL },
|
||||
#if defined(USE_SIM_VIDEO)
|
||||
{ "SCREENSHOT", &screenshot_cmd,0, HLP_SCREENSHOT, NULL, NULL },
|
||||
#endif
|
||||
{ "TAR", &tar_cmd, 0, HLP_TAR, NULL, NULL },
|
||||
{ "CURL", &curl_cmd, 0, HLP_CURL, NULL, NULL },
|
||||
{ "RUNLIMIT", &runlimit_cmd, 1, HLP_RUNLIMIT, NULL, NULL },
|
||||
|
@ -2640,9 +2636,7 @@ static SHTAB show_glob_tab[] = {
|
|||
{ "SERIAL", &sim_show_serial, 0, HLP_SHOW_SERIAL },
|
||||
{ "MULTIPLEXER", &tmxr_show_open_devices, 0, HLP_SHOW_MULTIPLEXER },
|
||||
{ "MUX", &tmxr_show_open_devices, 0, HLP_SHOW_MULTIPLEXER },
|
||||
#if defined(USE_SIM_VIDEO)
|
||||
{ "VIDEO", &vid_show, 0, HLP_SHOW_VIDEO },
|
||||
#endif
|
||||
{ "CLOCKS", &sim_show_timers, 0, HLP_SHOW_CLOCKS },
|
||||
{ "SEND", &sim_show_send, 0, HLP_SHOW_SEND },
|
||||
{ "EXPECT", &sim_show_expect, 0, HLP_SHOW_EXPECT },
|
||||
|
@ -2911,7 +2905,7 @@ detach_all (0, TRUE); /* close files */
|
|||
sim_set_deboff (0, NULL); /* close debug */
|
||||
sim_set_logoff (0, NULL); /* close log */
|
||||
sim_set_notelnet (0, NULL); /* close Telnet */
|
||||
vid_close (); /* close video */
|
||||
vid_close_all (); /* close video */
|
||||
sim_ttclose (); /* close console */
|
||||
AIO_CLEANUP; /* Asynch I/O */
|
||||
sim_cleanup_sock (); /* cleanup sockets */
|
||||
|
@ -3706,12 +3700,7 @@ t_stat screenshot_cmd (int32 flag, CONST char *cptr)
|
|||
{
|
||||
if ((cptr == NULL) || (strlen (cptr) == 0))
|
||||
return sim_messagef (SCPE_ARG, "Missing screen shot filename\n");
|
||||
#if defined (USE_SIM_VIDEO)
|
||||
return vid_screenshot (cptr);
|
||||
#else
|
||||
sim_printf ("No video device\n");
|
||||
return SCPE_UNK|SCPE_NOMESSAGE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Echo command */
|
||||
|
|
751
sim_video.c
751
sim_video.c
File diff suppressed because it is too large
Load diff
20
sim_video.h
20
sim_video.h
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue