void roadmap_sprite_initialize (void) { int max_point_count; const char *cursor; RoadMapSprite sprite; RoadMapFileContext file; for (cursor = roadmap_file_map ("config", "sprites", NULL, "r", &file); cursor != NULL; cursor = roadmap_file_map ("config", "sprites", cursor, "r", &file)) { roadmap_sprite_load (roadmap_file_base(file), roadmap_file_size(file)); roadmap_file_unmap (&file); } for (cursor = roadmap_file_map ("user", "sprites", NULL, "r", &file); cursor != NULL; cursor = roadmap_file_map ("user", "sprites", cursor, "r", &file)) { roadmap_sprite_load (roadmap_file_base(file), roadmap_file_size(file)); roadmap_file_unmap (&file); } RoadMapSpriteDefault = roadmap_sprite_search ("Default"); if (RoadMapSpriteDefault == NULL) { const char *hardcoded = "S Default\nF black 1\nP -4,-4 4,-4 4,4 -4,4\n"; roadmap_sprite_load (hardcoded, strlen(hardcoded)); RoadMapSpriteDefault = roadmap_sprite_search ("Default"); } /* Allocate the space required to draw any configured sprite: */ RoadMapSpritePointCount = roadmap_sprite_maxpoint (RoadMapSpriteDefault); for (sprite = RoadMapSpriteList; sprite != NULL; sprite = sprite->next) { max_point_count = roadmap_sprite_maxpoint (sprite); if (RoadMapSpritePointCount < max_point_count) { RoadMapSpritePointCount = max_point_count; } } RoadMapSpritePoints = calloc (RoadMapSpritePointCount, sizeof(*RoadMapSpritePoints)); }
static void roadmap_screen_obj_reload (void) { const char *cursor; RoadMapFileContext file; unsigned int i; int height = roadmap_canvas_height (); int width = roadmap_canvas_width(); const char *object_name = NULL; RoadMapObjectList = NULL; screen_height = height; screen_width = width; for (i=0; i<sizeof(RoadMapObjFiles)/sizeof(RoadMapObjFiles[0]); i++) { if (height >= RoadMapObjFiles[i].min_screen_height) { if (!strcmp(RoadMapObjFiles[i].name,"objects_wide") && (roadmap_softkeys_orientation() == SOFT_KEYS_ON_BOTTOM) ) object_name = "objects_wide_softkeys_buttom"; else object_name = RoadMapObjFiles[i].name; break; } } if (!object_name) { roadmap_log (ROADMAP_ERROR, "Can't find object file for screen height: %d", height); return; } if (current_object_name){ if (!strcmp(current_object_name, object_name)) road_screen_objects_delete(); else return; } for (cursor = roadmap_file_map ("skin", object_name, NULL, "r", &file); cursor != NULL; cursor = roadmap_file_map ("skin", object_name, cursor, "r", &file)) { roadmap_screen_obj_load (roadmap_file_base(file), roadmap_file_size(file)); roadmap_file_unmap (&file); return; } }
RoadMapSound roadmap_sound_load (const char *path, const char *file, int *mem) { char *full_name = roadmap_path_join (path, file); const char *seq; RoadMapFileContext sound; char sound_filename[MAX_SOUND_NAME]; return NULL; snprintf( sound_filename, sizeof(sound_filename), "%s.mp3", full_name); seq = roadmap_file_map (NULL, sound_filename, NULL, "r", &sound); roadmap_path_free (full_name); if (seq == NULL) { *mem = 0; return NULL; } *mem = roadmap_file_size (sound); return (RoadMapSound) sound; }
void roadmap_bar_initialize(void){ int width; int i; const char *cursor; RoadMapFileContext file; RoadMapImage topBarBgImg, bottomBarBgImg; TopBarObjectTable.count = 0; for (i=0; i< MAX_OBJECTS;i++){ TopBarObjectTable.object[i] = NULL; BottomBarObjectTable.object[i] = NULL; } TopBarObjectTable.draw_bg = TRUE; BottomBarObjectTable.draw_bg = TRUE; width = roadmap_canvas_width (); /* * The bar images not in cache (persistent). Possible memory optimization point * AGA */ topBarBgImg = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN|RES_NOCACHE, TOP_BAR_IMAGE); if (topBarBgImg == NULL){ return; } TopBarBgImageSize.width = roadmap_canvas_image_width( topBarBgImg ); TopBarBgImageSize.height = roadmap_canvas_image_height( topBarBgImg ); bottomBarBgImg = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN|RES_NOCACHE, BOTTOM_BAR_IMAGE); if (bottomBarBgImg == NULL){ return; } BottomBarBgImageSize.width = roadmap_canvas_image_width( bottomBarBgImg ); BottomBarBgImageSize.height = roadmap_canvas_image_height( bottomBarBgImg ); #ifdef TOUCH_SCREEN TopBarSelectedBg = ( RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN|RES_NOCACHE, TOP_BAR_SELECTED_BG_IMAGE ); #endif #if ! (defined(OPENGL)) // Draw directly TopBarFullBg = createBGImage( topBarBgImg ); BottomBarFullBg = createBGImage( bottomBarBgImg ); #endif /* * Deallocate the source images */ roadmap_canvas_free_image( topBarBgImg ); roadmap_canvas_free_image( bottomBarBgImg ); // Load top bar cursor = roadmap_file_map ("skin", "top_bar", NULL, "r", &file); if (cursor == NULL){ roadmap_log (ROADMAP_ERROR, "roadmap bar top_bar file is missing"); return; } roadmap_bar_load(roadmap_file_base(file), roadmap_file_size(file), &TopBarObjectTable); roadmap_file_unmap (&file); #ifndef J2ME // Load bottom bar cursor = roadmap_file_map ("skin", "bottom_bar", NULL, "r", &file); if (cursor == NULL){ roadmap_log (ROADMAP_ERROR, "roadmap bottom top_bar file is missing"); return; } roadmap_bar_load(roadmap_file_base(file), roadmap_file_size(file), &BottomBarObjectTable); roadmap_file_unmap (&file); #endif roadmap_bar_set_mode(TOPBAR_FLAG); roadmap_pointer_register_short_click (roadmap_bar_short_click, POINTER_HIGH); roadmap_pointer_register_long_click (roadmap_bar_long_click, POINTER_HIGH); roadmap_pointer_register_pressed (roadmap_bar_obj_pressed, POINTER_HIGH); roadmap_pointer_register_drag_start (roadmap_bar_drag_start, POINTER_HIGHEST); roadmap_pointer_register_released (roadmap_bar_obj_released, POINTER_HIGH); roadmap_skin_register (roadmap_bar_switch_skins); #ifdef ANDROID roadmap_androidmenu_initialize(); #endif bar_initialized = TRUE; }
void roadmap_bar_initialize(void){ int width; int image_width; int i; const char *cursor; RoadMapFileContext file; TopBarObjectTable.count = 0; for (i=0; i< MAX_OBJECTS;i++){ TopBarObjectTable.object[i] = NULL; BottomBarObjectTable.object[i] = NULL; } TopBarObjectTable.draw_bg = TRUE; BottomBarObjectTable.draw_bg = TRUE; width = roadmap_canvas_width (); TopBarBgImage = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, TOP_BAR_IMAGE); if (TopBarBgImage == NULL){ return; } BottomBarBgImage = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, BOTTOM_BAR_IMAGE); if (BottomBarBgImage == NULL){ return; } // Load top bar cursor = roadmap_file_map ("skin", "top_bar", NULL, "r", &file); if (cursor == NULL){ roadmap_log (ROADMAP_ERROR, "roadmap bar top_bar file is missing"); return; } roadmap_bar_load(roadmap_file_base(file), roadmap_file_size(file), &TopBarObjectTable); roadmap_file_unmap (&file); // Load bottom bar cursor = roadmap_file_map ("skin", "bottom_bar", NULL, "r", &file); if (cursor == NULL){ roadmap_log (ROADMAP_ERROR, "roadmap bottom top_bar file is missing"); return; } roadmap_bar_load(roadmap_file_base(file), roadmap_file_size(file), &BottomBarObjectTable); roadmap_file_unmap (&file); image_width = roadmap_canvas_image_width(TopBarBgImage); roadmap_bar_set_mode(TOPBAR_FLAG); roadmap_pointer_register_short_click (roadmap_bar_short_click, POINTER_HIGH); roadmap_pointer_register_long_click (roadmap_bar_long_click, POINTER_HIGH); roadmap_pointer_register_pressed (roadmap_bar_obj_pressed, POINTER_HIGH); roadmap_pointer_register_released (roadmap_bar_obj_released, POINTER_HIGH); roadmap_skin_register (roadmap_bar_switch_skins); bar_initialized = TRUE; }