}/* refresh_text_style */ /* * set_window * * Set the current window. In V6 every window has its own set of window * properties such as colours, text style, cursor position and size. * */ static void set_window(zword win) { Buffer.flush_buffer(); main.cwin = win; cwp = wp[win]; update_attributes(); if (main.h_version == ZMachine.V6) { os_.set_colour(FastMem.LO(cwp.colour), FastMem.HI(cwp.colour)); if (os_.font_data(cwp.font, ref font_height, ref font_width)) os_.set_font(cwp.font); os_.set_text_style(cwp.style); } else refresh_text_style(); if (main.h_version != ZMachine.V6 && win != 0) { wp[win].y_cursor = 1; wp[win].x_cursor = 1; } update_cursor(); os_.set_active_window(win); }/* set_window */
}/* erase_screen */ ///* // * resize_screen // * // * Try to adapt the window properties to a new screen size. // * // */ //void resize_screen (void) //{ // if (h_version != V6) { // int h = wp[0].y_pos + wp[0].y_size; // wp[0].x_size = h_screen_width; // wp[1].x_size = h_screen_width; // wp[7].x_size = h_screen_width; // wp[0].y_size = h_screen_height - wp[1].y_size; // if (h_version <= V3) // wp[0].y_size -= hi (wp[7].font_size); // if (os_font_data (TEXT_FONT, &font_height, &font_width)) { // int i; // for (i = 0; i < 8; i++) // wp[i].font_size = (font_height << 8) | font_width; // } // if (cwin == 0) { // int lines = wp[0].y_cursor + font_height - wp[0].y_size - 1; // if (lines > 0) { // if (lines % font_height != 0) // lines += font_height; // lines /= font_height; // if (wp[0].y_cursor > (font_height * lines)) { // os_scroll_area (wp[0].y_pos, // wp[0].x_pos, // h - 1, // wp[0].x_pos + wp[0].x_size - 1, // font_height * lines); // wp[0].y_cursor -= (font_height * lines); // update_cursor (); // } // } // } // os_window_height (0, wp[0].y_size); // } //}/* resize_screen */ /* * restart_screen * * Prepare the screen for a new game. * */ internal static void restart_screen() { /* Use default settings */ os_.set_colour(main.h_default_foreground, main.h_default_background); if (os_.font_data(ZFont.TEXT_FONT, ref font_height, ref font_width)) os_.set_font(ZFont.TEXT_FONT); os_.set_text_style(0); cursor = true; /* Initialise window properties */ //mwin = 1; for (int i = 0; i < 8; i++) { wp[i] = new ZWindow(); wp[i].y_pos = 1; wp[i].x_pos = 1; wp[i].y_size = 0; wp[i].x_size = 0; wp[i].y_cursor = 1; wp[i].x_cursor = 1; wp[i].left = 0; wp[i].right = 0; wp[i].nl_routine = 0; wp[i].nl_countdown = 0; wp[i].style = 0; wp[i].colour = (ushort)((main.h_default_background << 8) | main.h_default_foreground); wp[i].font = ZFont.TEXT_FONT; wp[i].font_size = (ushort)((font_height << 8) | font_width); wp[i].attribute = 8; wp[i].true_fore = main.hx_fore_colour; wp[i].true_back = main.hx_back_colour; wp[i].index = i; } cwp = wp[0]; /* Prepare lower/upper windows and status line */ wp[0].attribute = 15; wp[0].left = main.option_left_margin; wp[0].right = main.option_right_margin; wp[0].x_size = main.h_screen_width; wp[1].x_size = main.h_screen_width; if (main.h_version <= ZMachine.V3) wp[7].x_size = main.h_screen_width; os_.restart_game(ZMachine.RESTART_WPROP_SET); /* Clear the screen, unsplit it and select window 0 */ Screen.erase_screen(ushort.MaxValue); }/* restart_screen */
/* * os_window_height * * Called when the height of a window is changed. * */ public static void set_window_size(int win, Frotz.Other.ZWindow wp) { _screen.SetWindowSize(win, wp.y_pos, wp.x_pos, wp.y_size, wp.x_size); }