static void load_pc8x16_font() { char fname[256]; int n; char *p; get_executable_name(fname, sizeof(fname)); n = strlen(fname); do n--; while (fname[n] !='\\' && fname[n] !='/'); fname[n] = '\0'; append_filename(fname, fname, "pc8x16.fnt", sizeof(fname)); font8x16 = load_font(fname, NULL, NULL); if (font8x16) return; p = getenv("ALLEGRO"); if (p) { strncpy(fname, p, sizeof(fname)); append_filename(fname, fname, "vitetris", sizeof(fname)); set_allegro_resource_path(5, fname); } #ifdef UNIX set_allegro_resource_path(4, "/usr/share/allegro/vitetris"); set_allegro_resource_path(3, "/usr/share/allegro"); set_allegro_resource_path(2, "/usr/local/share/allegro/vitetris"); set_allegro_resource_path(1, "/usr/local/share/allegro"); #endif if (find_allegro_resource(fname, "pc8x16.fnt", 0,0,0,0,0, sizeof(fname)) == 0) font8x16 = load_font(fname, NULL, NULL); }
void init_fonts(void) { TTF_Init(); _fonts.standard = load_font("gfx/LinBiolinum.ttf", 20); _fonts.mainmenu = load_font("gfx/immortal.ttf", 35); }
static void load_fonts (ModeInfo *mi) { pinion_configuration *pp = &pps[MI_SCREEN(mi)]; load_font (mi->dpy, "titleFont", &pp->xfont1, &pp->font1_dlist); load_font (mi->dpy, "titleFont2", &pp->xfont2, &pp->font2_dlist); load_font (mi->dpy, "titleFont3", &pp->xfont3, &pp->font3_dlist); }
static void load_fonts (ModeInfo *mi) { molecule_configuration *mc = &mcs[MI_SCREEN(mi)]; load_font (mi->dpy, "atomFont", &mc->xfont1, &mc->font1_dlist); load_font (mi->dpy, "atomFont2", &mc->xfont2, &mc->font2_dlist); load_font (mi->dpy, "titleFont", &mc->xfont3, &mc->font3_dlist); }
void load_fonts(void) { load_font(&font_asc_16); load_font(&font_hz_16); load_font(&font_asc_48); font16 = register_font(&font_hz_16, &font_asc_16); font48 = register_font(NULL, &font_asc_48); }
int init_fonts() { int i; max_fonts=0; for(i=0; i<10; i++) fonts[i]=NULL; load_font(0, "./textures/font.bmp"); load_font(1, "./textures/fontv.bmp"); //set the default font cur_font_num=0; font_text=fonts[0]->texture_id; return(0); }
Assets() : png_background(load_bitmap("res/imgs/Backgrounds/purple.png")), png_player(load_bitmap("res/imgs/Players/playerShip1_blue.png")), png_player_damage1(load_bitmap("res/imgs/Damage/playerShip1_damage1.png")), png_player_damage2(load_bitmap("res/imgs/Damage/playerShip1_damage2.png")), png_player_damage3(load_bitmap("res/imgs/Damage/playerShip1_damage3.png")), png_player_laser(load_bitmap("res/imgs/Lasers/laserBlue07.png")), png_meteor_brown_big1(load_bitmap("res/imgs/Meteors/meteorBrown_big1.png")), png_meteor_brown_big2(load_bitmap("res/imgs/Meteors/meteorBrown_big2.png")), png_meteor_brown_big3(load_bitmap("res/imgs/Meteors/meteorBrown_big3.png")), png_meteor_brown_big4(load_bitmap("res/imgs/Meteors/meteorBrown_big4.png")), png_meteor_brown_med1(load_bitmap("res/imgs/Meteors/meteorBrown_med1.png")), png_meteor_brown_med2(load_bitmap("res/imgs/Meteors/meteorBrown_med3.png")), png_meteor_brown_small1(load_bitmap("res/imgs/Meteors/meteorBrown_small1.png")), png_meteor_brown_small2(load_bitmap("res/imgs/Meteors/meteorBrown_small2.png")), png_meteor_brown_tiny1(load_bitmap("res/imgs/Meteors/meteorBrown_tiny1.png")), png_meteor_brown_tiny2(load_bitmap("res/imgs/Meteors/meteorBrown_tiny2.png")), png_meteor_grey_big1(load_bitmap("res/imgs/Meteors/meteorGrey_big1.png")), png_meteor_grey_big2(load_bitmap("res/imgs/Meteors/meteorGrey_big2.png")), png_meteor_grey_big3(load_bitmap("res/imgs/Meteors/meteorGrey_big3.png")), png_meteor_grey_big4(load_bitmap("res/imgs/Meteors/meteorGrey_big4.png")), png_meteor_grey_med1(load_bitmap("res/imgs/Meteors/meteorGrey_med1.png")), png_meteor_grey_med2(load_bitmap("res/imgs/Meteors/meteorGrey_med2.png")), png_meteor_grey_small1(load_bitmap("res/imgs/Meteors/meteorGrey_small1.png")), png_meteor_grey_small2(load_bitmap("res/imgs/Meteors/meteorGrey_small2.png")), png_meteor_grey_tiny1(load_bitmap("res/imgs/Meteors/meteorGrey_tiny1.png")), png_meteor_grey_tiny2(load_bitmap("res/imgs/Meteors/meteorGrey_tiny2.png")), png_enemy_black1(load_bitmap("res/imgs/Enemies/enemyBlack1.png")), png_enemy_black2(load_bitmap("res/imgs/Enemies/enemyBlack2.png")), png_enemy_black3(load_bitmap("res/imgs/Enemies/enemyBlack3.png")), png_enemy_black4(load_bitmap("res/imgs/Enemies/enemyBlack4.png")), png_enemy_blue1(load_bitmap("res/imgs/Enemies/enemyBlue1.png")), png_enemy_blue2(load_bitmap("res/imgs/Enemies/enemyBlue2.png")), png_enemy_blue3(load_bitmap("res/imgs/Enemies/enemyBlue3.png")), png_enemy_blue4(load_bitmap("res/imgs/Enemies/enemyBlue4.png")), png_enemy_green1(load_bitmap("res/imgs/Enemies/enemyGreen1.png")), png_enemy_green2(load_bitmap("res/imgs/Enemies/enemyGreen2.png")), png_enemy_green3(load_bitmap("res/imgs/Enemies/enemyGreen3.png")), png_enemy_green4(load_bitmap("res/imgs/Enemies/enemyGreen4.png")), png_enemy_red1(load_bitmap("res/imgs/Enemies/enemyRed1.png")), png_enemy_red2(load_bitmap("res/imgs/Enemies/enemyRed2.png")), png_enemy_red3(load_bitmap("res/imgs/Enemies/enemyRed3.png")), png_enemy_red4(load_bitmap("res/imgs/Enemies/enemyRed4.png")), png_enemy_laser(load_bitmap("res/imgs/Lasers/laserRed03.png")), png_player_life(load_bitmap("res/imgs/UI/playerLife1_blue.png")), fnt_title(load_font("res/fonts/kenvector_future.ttf", 70)), fnt_menu(load_font("res/fonts/kenvector_future.ttf", 40)) { }
Game *game_init() { Game *g = malloc(sizeof(Game)); g->point = 0; g->is_shooting = 0; g->nb_coffre = 0; g->arme_selected = 1; g->arme_double = NULL; g->lance_flamme = NULL; g->is_pause = 0; g->is_over = 0; g->is_credit = 0; g->vie = 3; g->hero_img = malloc(sizeof(BITMAP *) * 4); g->hero_img[DIRECTION_GAUCHE] = load_bitmap("img/heros/gauche.bmp", NULL); g->hero_img[DIRECTION_DROITE] = load_bitmap("img/heros/droite.bmp", NULL); g->hero_img[DIRECTION_HAUT] = load_bitmap("img/heros/dos.bmp", NULL); g->hero_img[DIRECTION_BAS] = load_bitmap("img/heros/face.bmp", NULL); g->sprite_img = malloc(sizeof(BITMAP *) * 4); g->sprite_img[DIRECTION_GAUCHE] = load_bitmap("img/ennemi/ennemi_gauche.bmp", NULL); g->sprite_img[DIRECTION_DROITE] = load_bitmap("img/ennemi/ennemi_droite.bmp", NULL); g->sprite_img[DIRECTION_HAUT] = load_bitmap("img/ennemi/ennemi_dos.bmp", NULL); g->sprite_img[DIRECTION_BAS] = load_bitmap("img/ennemi/ennemi_face.bmp", NULL); g->object_img = malloc(sizeof(BITMAP *) * NOMBRE_OBJECT); g->object_img[OBJECT_TYPE_FLEUR] = load_bitmap("img/object/flower.bmp", NULL); g->object_img[OBJECT_TYPE_COFFRE] = load_bitmap("img/object/coffre.bmp", NULL); font = load_font("data/font.pcx", NULL, NULL); return g; }
/************************************************************************** Create string16 struct with ptsize font. Font will be loaded or aliased with existing font of that size. pInTextString must be allocated in memory (MALLOC/fc_calloc) **************************************************************************/ SDL_String16 * create_string16(Uint16 *pInTextString, size_t n_alloc, Uint16 ptsize) { SDL_String16 *str = fc_calloc(1, sizeof(SDL_String16)); if (!ptsize) { str->ptsize = theme_default_font_size(theme); } else { str->ptsize = ptsize; } if ((str->font = load_font(str->ptsize)) == NULL) { log_error("create_string16: load_font failed"); FC_FREE(str); return str; } str->style = TTF_STYLE_NORMAL; str->bgcol = (SDL_Color) {0, 0, 0, 0}; str->fgcol = *get_game_colorRGB(COLOR_THEME_TEXT); str->render = 2; /* pInTextString must be allocated in memory (MALLOC/fc_calloc) */ str->text = pInTextString; str->n_alloc = n_alloc; return str; }
int main(int argc, char **argv) { int result,i; int i2c_fd; i2c_fd=init_i2c("/dev/i2c-1"); if (i2c_fd < 0) { fprintf(stderr,"Error opening device!\n"); return -1; } /* Init display */ if (init_display(i2c_fd,HT16K33_ADDRESS0,10)) { fprintf(stderr,"Error opening display\n"); return -1; } result=load_font("tbfont.tb1"); while(1) { for(i=32;i<127;i++) { result=put_letter(i,i2c_fd); usleep(500000); } } return result; }
UI_DATA::UI_DATA() : build_button(NULL) { // load building UI button data build_button = load_bitmap("data/gui/button.bmp", NULL); highlight_build_button = load_bitmap("data/gui/buttonh.bmp", NULL); if (!build_button || build_button->w != POPUP_SIZE || build_button->h != POPUP_SIZE) { printf("BUILDING_DATA: missing or small gui/button.bmp (%d x %dpx)\n", POPUP_SIZE, POPUP_SIZE); panic("bad/missing building UI chrome"); } if (!highlight_build_button || highlight_build_button->w != build_button->w || highlight_build_button->h != build_button->h) { printf("BUILDING_DATA: missing or unmatched size gui/buttonh.bmp (%d x %dpx)\n", POPUP_SIZE, POPUP_SIZE); panic("bad/missing building UI chrome"); } // generic image loads UI_DATA_LOAD(mouse_cursor, "data/gui/cursor.bmp"); UI_DATA_LOAD(resource_icon, "data/gui/resource_icon.bmp"); UI_DATA_LOAD(logo, "data/gui/logo.bmp"); // load font lfont = load_font("data/gui/font.bmp", NULL, NULL); if (!lfont) panic("missing the font for the gui (gui/font.bmp)"); game_font = lfont; font = lfont; // for allegro gui }
int main() { int x, y; atStart("Example 3", 80, 24); /* Create the window. */ /* Load custom characters. */ load_font(); /* Main loop. */ while (atIsRunning()) { /* Draw the map using custom characters. */ for (y = 0; y < 10; ++y) for (x = 0; x < 15; ++x) atDrawChar(x, y, ATC_GREEN, atGetBgColor(), CHAR_PINE); atDrawString(0, 10, ATC_WHITE, atGetBgColor(), "Pine trees!"); /* Update the window. */ atUpdate(); /* Clear the backbuffer. */ atClear(); /* Grab events to allow the user to close the window. */ atGetKey(); } atStop(); /* Close the window. */ return 0; }
/*! initialize console subsystem */ void console_init(void) { size_t i; /* allocate font list */ fonts = (font_t**)calloc(num_font_info, sizeof(font_t*)); if(fonts == NULL) return; /* load fonts */ for(i = 0; i < num_font_info; ++i) { font_info_t *info = &font_info[i]; fonts[num_fonts] = load_font(info->name, info->pt, info->render_data, *info->render_data_size, info->kerning_data, *info->kerning_data_size); if(fonts[num_fonts] != NULL) ++num_fonts; } /* sort the list for bsearch later */ qsort(fonts, num_fonts, sizeof(font_t*), font_cmp); }
ScoreScrollNode::ScoreScrollNode(Screen *screen): Node(screen) { _image = NULL; _pos.x = 175; _pos.y = 30; _pos.w = 160; _pos.h = 135; _name_color.r = _name_color.g = _name_color.b = 0xFF; _score_color.r = 0xF1; _score_color.g = 0x72; _score_color.b = 0xB7; _font = load_font(16); _scroll_rect.x = 0; _scroll_rect.y = 0; _scroll_rect.w = _pos.w; _scroll_rect.h = _pos.h; _bg_color.r = _bg_color.b = 0; _bg_color.g = 0; _font_height = TTF_FontHeight(_font); }
void CL_FontProvider_Freetype::load_font(const CL_StringRef &resource_id, CL_ResourceManager *resources) { CL_Resource resource = resources->get_resource(resource_id); if (resource.get_type() != "font") throw CL_Exception(cl_format("Resource '%1' is not of type 'font'", resource.get_name())); CL_DomElement freetype_element = resource.get_element().named_item("freetype").to_element(); if (freetype_element.is_null()) throw CL_Exception(cl_format("Font resource '%1' has no 'freetype' child element", resource.get_name())); CL_FontDescription desc; if (freetype_element.has_attribute("file")) desc.set_typeface_name(freetype_element.get_attribute("file")); else throw CL_Exception(cl_format("Font resource '%1' has no 'file' attribute", resource.get_name())); if (freetype_element.has_attribute("height")) desc.set_height(freetype_element.get_attribute_int("height", 0)); else throw CL_Exception(cl_format("Font resource '%1' has no 'height' attribute", resource.get_name())); if (freetype_element.has_attribute("average_width")) desc.set_average_width(freetype_element.get_attribute_int("average_width", 0)); if (freetype_element.has_attribute("anti_alias")) desc.set_anti_alias(freetype_element.get_attribute_bool("anti_alias", true)); if (freetype_element.has_attribute("subpixel")) desc.set_subpixel(freetype_element.get_attribute_bool("subpixel", true)); load_font(desc, resources->get_directory(resource)); }
static void force_setfontsize (int pointsize) { /* Valid point sizes are between 1 and MAX_FONT_SIZE */ if (pointsize < 1) pointsize = 1; else if (pointsize > MAX_FONT_SIZE) pointsize = MAX_FONT_SIZE; currentfontsize = pointsize; if (disp_type == SCREEN) { if (!font_is_loaded[pointsize]) { load_font (pointsize); font_is_loaded[pointsize] = 1; } XSetFont(display, gc, font_info[pointsize]->fid); } else { /* PostScript: set up font and centering function */ fprintf(ps,"%d setfontsize\n",pointsize); } }
void zaFont::initbyPath(const char * path ,int size) { m_dpi = bbutil_calculate_dpi(0); if (path ==NULL || path[0]==0) { if (access("/usr/fonts/font_repository/adobe/AdobeHeitiStd-Regular.otf",F_OK)>=0) { sprintf(m_path,"%s","/usr/fonts/font_repository/adobe/AdobeHeitiStd-Regular.otf"); } else if (access("/usr/fonts/font_repository/monotype/MHeiB.GB18030_200910.ttf",F_OK)>=0) { sprintf(m_path,"%s","/usr/fonts/font_repository/monotype/MHeiB.GB18030_200910.ttf"); } initFont(m_path); } else { sprintf(m_path,"%s",path); initFont(m_path); } m_size = size; char en_charmap[128*2]; for (int i = 0 ; i < 128; i ++) { en_charmap[i*2] = (char) (i % 256); en_charmap[i*2+1] =(char) (i/ 256); } load_font(en_charmap,128*2); }
static Errcode load_menu_font(Wscreen *s) { extern char *lrmenu_font_name; extern char *menu_font_name; extern char *hrmenu_font_name; char path[PATH_SIZE]; char *name; disable_textboxes(); free_menu_font(); if (s->wndo.width < 500) name = lrmenu_font_name; else if(s->wndo.width < 800) name = menu_font_name; else name = hrmenu_font_name; make_resource_name(name, path); if(load_font(path, &menufont,0,FALSE) >= Success) s->mufont = &menufont; else s->mufont = get_sys_font(); return(Success); }
void InputNode::loadFont(int size, Uint16 r, Uint16 g, Uint16 b) { _font = load_font(size); _foreground.r = r; _foreground.g = g; _foreground.b = b; }
TF3D::TF3D(std::string fname) { font = load_font(fname.c_str(), INTERPOLATION_LEVEL); if (font == NULL) { throw std::string("Failed to load font!"); } }
CL_Font_System::CL_Font_System( CL_GraphicContext &context, const CL_StringRef &typeface_name, int height) : CL_Font( new CL_FontProvider_System()) { CL_FontDescription desc; desc.set_typeface_name(typeface_name); desc.set_height(height); load_font(context, desc); }
// Interface High Score part interfaceHighScore::interfaceHighScore() { // Load background bitmap this->hsBackground = load_bitmap("highscore.pcx", NULL); // Load font hsFont = load_font("font-highscore.pcx", pallete, NULL); }
void CL_FontProvider_Freetype::load_font(const CL_FontDescription &desc) { CL_String path = CL_PathHelp::get_fullpath(desc.get_typeface_name(), CL_PathHelp::path_type_file); CL_String filename = CL_PathHelp::get_filename(desc.get_typeface_name(), CL_PathHelp::path_type_file); CL_VirtualFileSystem vfs(path); CL_IODevice file = vfs.get_root_directory().open_file_read(filename); load_font(desc, file); }
void setupFont() { load_font(my_font, 96); set_font_pal(14); SetFontColors(14, RGB(3, 3, 3), RGB(7, 7, 7), 0); SetFontColors(15, RGB(3, 3, 3), RGB(7, 0, 0), 0); }
void init_globals() { char temp[256]; MaxPlayer = 1; //TODO: Add multiple players option // getfont(); load_font(); // nosound(); init_random(); // OldHeapSize = memavail; // mark(OldHeapLimit); // getmem(tableground1,320*200); // getmem(tableground2,320*200); // getmem(tableground3,320*200); led_display = malloc(160*24); // getmem(arm_links,ArmBreiteLinks*ArmHoeheLinks*5); // getmem(arm_rechts,ArmBreiteRechts*ArmHoeheRechts*5); // getmem(arm_links_msk,ArmBreiteLinks*ArmHoeheLinks*5); // getmem(arm_rechts_msk,ArmBreiteRechts*ArmHoeheRechts*5); ball = malloc(256); ground = malloc(256); ball_sprite = malloc(256); underground = malloc(1024); tableground = malloc(9368); feder = malloc(480); // ledseg=seg(Led_display^); // armlinksseg:=seg(arm_links^); // armrechtsseg:=seg(arm_rechts^); // armlinks_mskseg:=seg(arm_links_msk^); // armrechts_mskseg:=seg(arm_rechts_msk^); // ballseg:=seg(ball^); // groundseg:=seg(ground^); // ballspriteseg:=seg(ball_Sprite^); // undergroundseg:=seg(underground^); // tablegroundseg:=seg(tableground^); // federseg:=seg(Feder^); led_hoehe=24; led_color_1=129; led_color_2=130; led_funktion=0; // {twix-mode 320x400 } // vga320x400Overscan(); //{setlinecomp(400-46);} load_table_tab(); load_table_gro(); load_feder(); init_colors(); sprintf(temp,"gfx/feder%c.mpa", tnr); load_mini_palette(temp); load_arm_links(); load_arm_rechts(); load_arm_links_msk(); load_arm_rechts_msk(); load_ball(); if (UseSound) init_soundkit(); }
struct font* create_font(const char* filepath, int cols, int rows) { struct font* f = malloc(sizeof(*f)); if (f != NULL && load_font(f, filepath, cols, rows) == -1) { free(f); return NULL; } return f; }
TFont_ttf::TFont_ttf(int size, char *font) : TFont::TFont(size,font) { if (size < min_font_size) size = min_font_size; if (size > max_font_size) size = max_font_size; ttf = NULL; charWidth = charHeight = size; // for loading... load_font(font); dimensions("M",&charWidth,&charHeight); }
static int ffi_load_font(lua_State *L) { const char *name = luaL_checkstring(L, 1); struct font *font = load_font(name); if (!font) return luaL_error(L, "cannot load font: %s", name); lua_pushlightuserdata(L, font); return 1; }
void rysuj_wynik(BITMAP * bufor, int wynik1, int wynik2) { FONT *myfont; PALETTE palette; myfont = load_font("24.pcx", palette, NULL); //rysujemy górny pasek i go wypełniamy kolorem textprintf_ex(bufor, myfont, 290, 7, makecol(200, 200, 200), -1, "%d : %d", wynik1, wynik2); }
static Bool load_fonts (ModeInfo *mi) { molecule_configuration *mc = &mcs[MI_SCREEN(mi)]; #ifdef STANDALONE if (!load_font (mi, (char *) "atomFont", &mc->xfont1, &mc->font1_dlist)) return False; if (!load_font (mi, (char *) "titleFont", &mc->xfont2, &mc->font2_dlist)) return False; #else if (!load_font (mi, (char *) "-*-times-bold-r-normal-*-240-*", &mc->xfont1, &mc->font1_dlist)) return False; if (!load_font (mi, (char *) "-*-times-bold-r-normal-*-180-*", &mc->xfont2, &mc->font2_dlist)) return False; #endif return True; }