Пример #1
0
void DrawStringB(int x, int y, int r, int g, int b, char *str)
{
	int len = 0;
	uint32_t color = 0;
				
	len = MeasureString(str);
	len *= 5;
	
	color = graphics_make_color(r, g, b, 0xff);
	
    graphics_draw_box(__dc, x, y-1, len + 3, fh, graphics_make_color(0, 0, 0, 0));
	graphics_set_color(color, 0x00000000);
	graphics_draw_text(__dc, x, y, str);
}
Пример #2
0
void DrawString(int x, int y, int r, int g, int b, char *str)
{
	uint32_t color = 0;

	color = graphics_make_color(r, g, b, 0xff);
	graphics_set_color(color, 0x00000000);
	graphics_draw_text(__dc, x, y, str);
}
Пример #3
0
/* main code entry point */
int main(void)
{
    display_context_t _dc;
    char temp[128];
	int res = 0;
	unsigned short buttons, previous = 0;

    init_n64();

    while (1)
    {
		int j;
		int width[4] = { 320, 640, 256, 512 };
		int height[4] = { 240, 480, 240, 480 };
		unsigned int color;

        _dc = lockVideo(1);
		color = graphics_make_color(0xCC, 0xCC, 0xCC, 0xFF);
		graphics_fill_screen(_dc, color);

		color = graphics_make_color(0xFF, 0xFF, 0xFF, 0xFF);
		graphics_draw_line(_dc, 0, 0, width[res]-1, 0, color);
		graphics_draw_line(_dc, width[res]-1, 0, width[res]-1, height[res]-1, color);
		graphics_draw_line(_dc, width[res]-1, height[res]-1, 0, height[res]-1, color);
		graphics_draw_line(_dc, 0, height[res]-1, 0, 0, color);

		graphics_draw_line(_dc, 0, 0, width[res]-1, height[res]-1, color);
		graphics_draw_line(_dc, 0, height[res]-1, width[res]-1, 0, color);

		color = graphics_make_color(0x00, 0x00, 0x00, 0xFF);
		graphics_set_color(color, 0);

        printText(_dc, "Video Resolution Test", width[res]/16 - 10, 3);
		switch (res)
		{
			case 0:
				printText(_dc, "320x240", width[res]/16 - 3, 5);
				break;
			case 1:
				printText(_dc, "640x480", width[res]/16 - 3, 5);
				break;
			case 2:
				printText(_dc, "256x240", width[res]/16 - 3, 5);
				break;
			case 3:
				printText(_dc, "512x480", width[res]/16 - 3, 5);
				break;
		}

		for (j=0; j<8; j++)
		{
			sprintf(temp, "Line %d", j);
			printText(_dc, temp, 3, j);
			sprintf(temp, "Line %d", height[res]/8 - j - 1);
			printText(_dc, temp, 3, height[res]/8 - j - 1);
		}
		printText(_dc, "0123456789", 0, 16);
		printText(_dc, "9876543210", width[res]/8 - 10, 16);

        unlockVideo(_dc);

        while (1)
        {
            // wait for change in buttons
            buttons = getButtons(0);
            if (buttons ^ previous)
                break;
            delay(1);
        }

        if (A_BUTTON(buttons ^ previous))
        {
            // A changed
            if (!A_BUTTON(buttons))
			{
				resolution_t mode[4] = { RESOLUTION_320x240, RESOLUTION_640x480, RESOLUTION_256x240, RESOLUTION_512x480 };
				res = (res+1) & 3;
				display_close();
				display_init(mode[res], DEPTH_16_BPP, 2, GAMMA_NONE, ANTIALIAS_RESAMPLE);
			}
		}

        previous = buttons;
    }

    return 0;
}