@@ -21,7 +21,7 @@ typedef int (*getx_fn)();
2121typedef int (*gety_fn)();
2222typedef void (*setxy_fn)(int x, int y);
2323typedef void (*write_fn)(const char *str);
24- typedef int (*events_fn)(int );
24+ typedef int (*events_fn)(int , int *, int * );
2525typedef void (*setcolor_fn)(long color);
2626typedef void (*line_fn)(int x1, int y1, int x2, int y2);
2727typedef void (*ellipse_fn)(int xc, int yc, int xr, int yr, int fill);
@@ -117,19 +117,14 @@ int osd_devinit() {
117117 init_fn devinit = (init_fn)slib_get_func (" sblib_devinit" );
118118 if (devinit) {
119119 devinit (prog_file, opt_pref_width, opt_pref_height);
120- os_graf_mx = opt_pref_width;
121- os_graf_my = opt_pref_height;
122- } else {
123- os_graf_mx = 80 ;
124- os_graf_my = 25 ;
125120 }
121+ os_graf_mx = opt_pref_width;
122+ os_graf_my = opt_pref_height;
126123
127124 if (p_write == NULL ) {
128125 p_write = default_write;
129126 }
130127
131- os_color_depth = 1 ;
132- osd_cls ();
133128 return 1 ;
134129}
135130
@@ -209,7 +204,17 @@ void osd_write(const char *str) {
209204int osd_events (int wait_flag) {
210205 int result = 0 ;
211206 if (p_events) {
212- result = p_events (wait_flag);
207+ int x = os_graf_mx;
208+ int y = os_graf_my;
209+ result = p_events (wait_flag, &x, &y);
210+ if (x != os_graf_mx || y != os_graf_my) {
211+ os_graf_mx = x;
212+ os_graf_my = y;
213+ dev_viewport (0 , 0 , 0 , 0 );
214+ dev_window (0 , 0 , 0 , 0 );
215+ setsysvar_int (SYSVAR_XMAX, os_graf_mx);
216+ setsysvar_int (SYSVAR_YMAX, os_graf_my);
217+ }
213218 }
214219 return result;
215220}
0 commit comments