Пример #1
0
static int fb_write(int c) {
    uint16 *t = fb;

    if(!t)
        t = vram_s;

    if(c != '\n') {
        bfont_draw(t + cur_y * fb_w + cur_x, fb_w, 1, c);
        cur_x += FONT_CHAR_WIDTH;
    }

    /* If we have a newline or we've gone past the end of the line, advance down
       one line. */
    if(c == '\n' || cur_x + FONT_CHAR_WIDTH > max_x) {
        cur_y += FONT_CHAR_HEIGHT;
        cur_x = min_x;

        /* If going down a line put us over the edge of the screen, move
           everything up a line, fixing the problem. */
        if(cur_y + FONT_CHAR_HEIGHT > max_y) {
            memcpy2(t + min_y * fb_w, t + (min_y + FONT_CHAR_HEIGHT) * fb_w,
                    (cur_y - min_y - FONT_CHAR_HEIGHT) * fb_w * 2);
            cur_y -= FONT_CHAR_HEIGHT;
            memset2(t + cur_y * fb_w, 0, FONT_CHAR_HEIGHT * fb_w * 2);
        }
    }

    return 1;
}
Пример #2
0
/* initialize draw stuff: get our texture of the font, etc */
void conio_draw_init() {
	uint16 *vram;
	int x, y;

	font_texture = pvr_mem_malloc(256*256*2);
	vram = (uint16 *)font_texture;

	for (y = 0; y < 8; y++) {
		for (x = 0; x < 16; x++) {
			bfont_draw(vram, 256, 0, y*16 + x);
			vram += 16;
		}
		vram += 23*256;
	}
}
Пример #3
0
Файл: assert.c Проект: quad/voot
static void assert_puts (const char *in_str)
{
    uint16     *vram_index;
    static char null_string[] = "NULL";

    if (!in_str)
        in_str = null_string;

    /*
        STAGE: Position our text correctly.
        
        Assumes 640x - but then, so does bfont.
    */

    vram_index  = VIDEO_VRAM_START;
    vram_index += INDENT_BYTES;
    vram_index += (VCON_FIRST_PIXEL + (vc_line * LINE_SPACING)) * 640;

    /* STAGE: Make sure we handle '\n's. */

    while (*in_str)
    {
        if (*in_str == '\n')
        {
            vc_line++;
            in_str++;

            vram_index  = VIDEO_VRAM_START;
            vram_index += INDENT_BYTES;
            vram_index += (VCON_FIRST_PIXEL + (vc_line * LINE_SPACING)) * 640;

            continue;
        }

        /*
            STAGE: If the biosfont library is locked, just blank the screen.
            
            The fact we clear multiple times is not a bug. It's just
            laziness on the coder's part.
        */

        if (!(bfont_draw (vram_index += 12, 640, *in_str++)))
            return video_clear (100, 0, 0);
    }

    vc_line++;
}
Пример #4
0
void setup_util_texture() {
	uint16	*vram;
	int	x, y;
	pvr_poly_cxt_t	cxt;

	util_texture = pvr_mem_malloc(256*256*2);
	printf("util_texture at %08x\n", util_texture);
	vram = (uint16 *)util_texture;
	
	/* First dump in the mouse cursor */
	for (y=0; y<16; y++) {
		for (x=0; x<10; x++) {
			if (mouse1_xpm[y*10+x] == '.')
				*vram = 0xffff;
			else if (mouse1_xpm[y*10+x] == '+')
				*vram = 0xf000;
			else
				*vram = 0x0000;
			vram++;
		}
		vram += 256 - 10;
	}
	
	/* Now add the rest as ASCII characters */
	vram = (uint16 *)util_texture;
	for (y=0; y<8; y++) {
		for (x=0; x<16; x++) {
			/* Skip the first (it's a mouse pointer) */
			if (x != 0 || y != 0) 
				bfont_draw(vram, 256, 0, y*16+x);
			vram += 16;
		}
		vram += 23*256;
	}

	/* Setup a polygon header for the util texture */
	pvr_poly_cxt_txr(&cxt, PVR_LIST_TR_POLY, PVR_TXRFMT_ARGB4444 | PVR_TXRFMT_NONTWIDDLED,
		256, 256, util_texture, PVR_FILTER_NONE);
	pvr_poly_compile(&util_txr_hdr, &cxt);
}