static void set_window_for_amiga (void) { leave_graphics_mode (); enter_graphics_mode (vgamode); if (linear_mem != NULL && !need_dither) gfxvidinfo.bufmem = linear_mem; restore_vga_colors (); }
void handle_events (void) { int button = mouse_getbutton (); gui_requested = 0; keyboard_update (); mouse_update (); lastmx += mouse_getx (); lastmy += mouse_gety (); mouse_setposition (0, 0); buttonstate[0] = button & 4; buttonstate[1] = button & 2; buttonstate[2] = button & 1; #ifdef PICASSO96 if (screen_is_picasso && !picasso_vidinfo.extra_mem) { int i; char *addr = gfxmemory + (picasso96_state.Address - gfxmem_start); for (i = 0; i < picasso_vidinfo.height; i++, addr += picasso96_state.BytesPerRow) { if (!picasso_invalid_lines[i]) continue; picasso_invalid_lines[i] = 0; vga_drawscanline (i, addr); } } #endif if (!screen_is_picasso && gui_requested) { leave_graphics_mode (); gui_changesettings (); enter_graphics_mode (vgamode); if (linear_mem != NULL && !need_dither) gfxvidinfo.bufmem = linear_mem; restore_vga_colors (); notice_screen_contents_lost (); } }
int graphics_init (void) { int i; need_dither = 0; screen_is_picasso = 0; if (!select_mode_from_prefs ()) return 0; bitdepth = mode_bitdepth[currprefs.color_mode][0]; bit_unit = mode_bitdepth[currprefs.color_mode][1]; need_dither = mode_bitdepth[currprefs.color_mode][2]; modeinfo = *vga_getmodeinfo (vgamode); gfxvidinfo.pixbytes = modeinfo.bytesperpixel; if (!need_dither) { if (modeinfo.bytesperpixel == 0) { printf("Got a bogus value from SVGAlib...\n"); gfxvidinfo.pixbytes = 1; } } else { gfxvidinfo.pixbytes = 2; } using_linear = -1; if (!enter_graphics_mode (vgamode)) return 0; sleep(2); gfxvidinfo.maxblocklines = 0; gfxvidinfo.width = modeinfo.width; gfxvidinfo.height = modeinfo.height; if (linear_mem != NULL && !need_dither) { gfxvidinfo.bufmem = linear_mem; gfxvidinfo.rowbytes = modeinfo.linewidth; } else { gfxvidinfo.rowbytes = (modeinfo.width * gfxvidinfo.pixbytes + 3) & ~3; #if 1 gfxvidinfo.bufmem = malloc (gfxvidinfo.rowbytes); gfxvidinfo.linemem = gfxvidinfo.bufmem; memset (gfxvidinfo.bufmem, 0, gfxvidinfo.rowbytes); #else gfxvidinfo.bufmem = malloc(gfxvidinfo.rowbytes * modeinfo.height); memset (gfxvidinfo.bufmem, 0, gfxvidinfo.rowbytes * modeinfo.height); #endif gfxvidinfo.emergmem = 0; } printf ("rowbytes %d\n", gfxvidinfo.rowbytes); init_colors (); buttonstate[0] = buttonstate[1] = buttonstate[2] = 0; for(i = 0; i < 256; i++) keystate[i] = 0; lastmx = lastmy = 0; newmousecounters = 0; return 1; }