Example #1
0
void BSODPrint(const char *aLine)
{
    if (G_bsodActive) {
        swim_put_text(&G_bsodWin, aLine);
        swim_put_newline(&G_bsodWin);
    }
}
Example #2
0
/***********************************************************************
 *
 * Function: swim_put_text_horizontal_centered
 *
 * Purpose: Put a horizontal centered text message at a Y pixel 
 *    coordinate  on the screen
 *
 * Processing:
 *     Set the virtual (upper left) text position in the window and
 *     render the text string at this position.
 *
 * Parameters:
 *          win  : Window identifier
 *          text : Text string to output in window
 *  displayWidth : Total width of the display
 *          y    : Virtual Y position of start of text
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes:
 *     Y coords are in virtual pixels!
 *
 **********************************************************************/
void swim_put_text_horizontal_centered(
    SWIM_WINDOW_T *win,
    const CHAR *text,
    INT_32 displayWidth,
    INT_32 y)
{
    INT_32 charindex;
    INT_32 i = 0;
    INT_32 stringWidth = 0;

    /* Walk through entire string until newline or NULL char*/
    while (text[i] != '\0') {
        if (text[i] == '\n') {
            break; /* Only centers single row strings */
        } else if (((UNS_8)text[i] >= win->font->first_char)
            && ((UNS_8)text[i] <= win->font->last_char)) {
            /* Determine char index in font*/
            charindex = (INT_32)text[i] - (INT_32)win->font->first_char;
            /* Find character width then add to total width of single row string */
            stringWidth += (INT_32)win->font->font_width_table[charindex];
        }
        i++;
    }

    /* Convert centered virtual x, y positon to physical position */
    swim_set_xy(win, (displayWidth / 2) - (stringWidth / 2), y);

    /* Display text string */
    swim_put_text(win, text);
}
Example #3
0
/***********************************************************************
 *
 * Function: swim_put_text_xy
 *
 * Purpose: Put text at x, y (char) position on screen
 *
 * Processing:
 *     Set the virtual (upper left) text position in the window and
 *     render the text string at this position.
 *
 * Parameters:
 *     win  : Window identifier
 *     text : Text string to output in window
 *     x    : Virtual X position of start of text
 *     y    : Virtual Y position of start of text
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes:
 *     X, Y coords are in virtual pixels!
 *
 **********************************************************************/
void swim_put_text_xy(SWIM_WINDOW_T *win, const CHAR *text, INT_32 x, INT_32 y)
{
    /* Convert virtual x, y positon to physical position */
    swim_set_xy(win, x, y);

    /* Display text string */
    swim_put_text(win, text);
}
/* Creates a title bar for the window */
void swim_set_title(SWIM_WINDOW_T *win,
					const CHAR *title,
					COLOR_T ttlbkcolor)
{
	COLOR_T savedf, savedp, savedb;
	int32_t savedt;

	/* Is present font height larger than window client height? */
	if ((swim_get_font_height(win) < (4 + win->yvsize)) &&
		(title != (CHAR *) 0)) {
		/* There is enough room for title bar, so continue */

		/* Save original colors and font transparentcy flag */
		savedf = win->fill;
		savedp = win->pen;
		savedb = win->bkg;
		savedt = win->tfont;

		/* Set fill color to background color (temporarily)
		   used with box function */
		win->fill = ttlbkcolor;
		win->bkg = ttlbkcolor;
		win->pen = win->bkg;

		/* Draw the background for the title bar */
		swim_put_box(win, 0, 0, win->xvsize,
					 (4 + swim_get_font_height(win) - 2));

		/* Reset text starting position for title string */
		win->xvpos = win->xpvmin + 2;
		win->yvpos = win->ypvmin + 1;

		/* Restore original pen color (used for text color) */
		win->pen = savedp;

		/* Restore the original colors */
		win->fill = savedf;
		win->bkg = savedb;

		/* Put string in title bar area (with transparent background) */
		win->tfont = 0;
		swim_put_text(win, title);
		win->tfont = savedt;

		/* Draw a line under the title bar, but before the
		   (new) client area */
		swim_put_line(win, 0,
					  (4 + swim_get_font_height(win) - 1),
					  win->xpvmax, (4 + swim_get_font_height(win) - 1));

		/* Adjust client height of window (virtual and physcal) */
		win->ypmin = win->ypmin + swim_get_font_height(win) + 4;
		win->ypvmin = win->ypvmin + swim_get_font_height(win) + 4;

		/* Resize y dimension */
		win->yvsize = win->yvsize - swim_get_font_height(win) + 4;

		/* Reset text starting position to new client area */
		win->xvpos = win->xpvmin;
		win->yvpos = win->ypvmin;
	}
}
Example #5
0
void print(const char *aString)
{
    swim_put_text(&G_win, aString);
    printf("%s", aString);
}