static void draw_text_error(void) { int x = 0; int y = 0; int dx = text_size_x(); int dy = text_size_y(); text_clear(); draw_text_center(x, y, dx, "ERROR! An error occurred in your last action!" , COLOR_REVERSE); ++y; ++y; y = draw_text_para(x, y, dx, dy, "Your action has generated an error. Probably you have requested an " "unsupported feature by your hardware or software." , COLOR_NORMAL); if (*error_get()) { y = draw_text_para(x, y, dx, dy-y, "\nThe video software reports this error:", COLOR_NORMAL); log_std(("v: error \"%s\"\n", error_get())); y = draw_text_para(x, y, dx, dy-y, error_get(), COLOR_ERROR); } y = draw_text_para(x, y, dx, dy-y, "\nPress ESC", COLOR_NORMAL); video_wait_vsync(); do { target_idle(); os_poll(); } while (inputb_get()==INPUTB_NONE); }
int main(void) { tga_init(128,64); ucg_Init(&ucg, &ucg_dev_tga, ucg_ext_none, (ucg_com_fnptr)0); ucg_SetFontMode(&ucg, UCG_FONT_MODE_TRANSPARENT); ucg_SetColor(&ucg, 0, 0, 0, 0); ucg_DrawBox(&ucg, 0, 0, 128, 64); ucg_SetFont(&ucg, ucg_font_ncenB18_tf); ucg_SetColor(&ucg, 0, 0, 0, 255); ucg_DrawPixel(&ucg, 70,20); ucg_SetColor(&ucg, 0, 255, 0, 0); //ucg_SetFontPosBottom(&ucg); /* ucg_DrawGlyph(&ucg, 70, 20, 0, 'A'); ucg_DrawGlyph(&ucg, 70, 20, 1, 'A'); ucg_DrawGlyph(&ucg, 70, 20, 2, 'A'); ucg_DrawGlyph(&ucg, 70, 20, 3, 'A'); ucg_SetColor(&ucg, 0, 255, 255, 255); vrule(&ucg, 30, 0, 20, 1); vrule(&ucg, 30, 0, 20, 0); */ //pos(&ucg, 70, 20, 0); //hrule(&ucg, 0, 20, 70, 1); //hrule(&ucg, 0, 20, 70, 0); ucg_SetColor(&ucg, 0, 255, 0, 0); ucg_SetColor(&ucg, 1, 0, 255, 0); ucg_SetColor(&ucg, 2, 255, 0, 255); ucg_SetColor(&ucg, 3, 0, 255, 255); ucg_DrawGradientLine(&ucg, 10, 40, 100, 0); ucg_DrawGradientBox(&ucg, 10, 43, 100, 20); tga_save("test.tga"); draw_pixel(&ucg); draw_hline(&ucg); draw_vline(&ucg); set_clip_range(&ucg); draw_text_baseline(&ucg); draw_text_bottom(&ucg); draw_text_top(&ucg); draw_text_center(&ucg); draw_text_ascent_descent(&ucg); draw_text_dir1(&ucg); draw_box(&ucg); draw_frame(&ucg); draw_rbox(&ucg); draw_rframe(&ucg); draw_gradient_box(&ucg); draw_gradient_line(&ucg); draw_disc(&ucg); draw_circle(&ucg); draw_triangle(&ucg); set_scale2x2(&ucg); set_font_mode_1(&ucg); set_font_mode_2(&ucg); solid_font_variants(&ucg); string_overwrite(&ucg, 1); string_overwrite(&ucg, 5); string_overwrite(&ucg, 10); return 0; }