Пример #1
0
static void load_images()
{
	 menu_bg = ttk_load_image ("/opt/Zillae/ZacZilla/Data/bg.gif");
	 menu_sbg = ttk_load_image ("/opt/Zillae/ZacZilla/Data/sbg.gif");
	 menu_wheel = ttk_load_image ("/opt/Zillae/ZacZilla/Data/wheel.gif");
	 	 
}
Пример #2
0
static void load_car()
{
        FILE *fp; 
	int x;
	char filename[15];
	char file[30];
	 
    		sprintf(filename, "%sc1/",direc);

	 	 if(!(fp = fopen(filename, "r"))){
       		  	new_message_window("Could not Open");
		 }

	 fp = fopen(filename, "r");

	 for(x=0;x<12;x++){
   	 	sprintf(file, "%s%d.gif",filename,x);
    		car[x] = ttk_load_image(file);
	 }
	    

}
Пример #3
0
PzWindow *new_mymodule_window()
{
    static int calledyet = 0;
    PzWindow *ret;
    FILE *fp;
    
    if (!calledyet) {
	calledyet++;
	pz_message ("Select again to see the fun stuff.");
	return TTK_MENU_DONOTHING;
    }

    image = ttk_load_image (pz_module_get_datapath (module, "image.png"));
    if (!image) {
	pz_error ("Could not load %s: %s", pz_module_get_datapath (module, "image.png"),
		  strerror (errno));
	return TTK_MENU_DONOTHING;
    }
    ttk_surface_get_dimen (image, &imgw, &imgh);

    fp = fopen (pz_module_get_datapath (module, "message.txt"), "r");
    if (!fp) {
	pz_warning ("Could not read from %s: %s.", pz_module_get_datapath (module, "message.txt"),
		    strerror (errno));
	text = (char *)strdup ("Hi! I forgot to supply a message!");
    } else {
	long len;
	fseek (fp, 0, SEEK_END);
	len = ftell (fp);
	fseek (fp, 0, SEEK_SET);
	text = malloc (len + 1);
	fread (text, 1, len, fp);
	text[len] = 0;
    }

    ret = pz_new_window ("MyModule", PZ_WINDOW_NORMAL);
    pz_add_widget (ret, draw_mymodule, event_mymodule);
    return pz_finish_window (ret);
}
Пример #4
0
static void load_map()
{
   	 FILE *fp;
	 char buffer[120],filename[30];
	 int x = 0,t = 0 ;
	 
	 if(mapc == 0) { mapc=1; }	 
	 else if(mapc == 5) { mapc=4;}	

		sprintf(filename, "%smap%d.ipr",direc,mapc);

	 	 if(!(fp = fopen(filename, "r"))){
       		  	new_message_window("Could not Open map");
		 }

	for(t=0;t<3;t++){ //flush times incase == 0 for no high time.
		map.cc50[t] = 0;
		map.cc100[t] = 0;
		map.cc150[t] = 0;
	}

	 fp = fopen(filename, "r");

	while(!feof(fp)) {	//Loading *.ipr into pointers

		 fgets(buffer, 80, fp);
		 buffer[strlen(buffer)-1] = '\0';


	 switch(x) {
         case 0: map.author = strdup(buffer); break;
   	 case 1: map.mapname = strdup(buffer); break;
   	 case 2: map.difficulty = atoi(buffer); break;
   	 case 3: map.xstart = atoi(buffer); break;
	 case 4: map.ystart = atoi(buffer); break;
	 case 5: map.cstart = atoi(buffer); break;
	 case 6: map.cc50[0] = atof(buffer); break;
	 case 7: map.cc50[1] = atof(buffer); break;
	 case 8: map.cc50[2] = atof(buffer); break;
	 case 9: map.cc100[0] = atof(buffer); break;
	 case 10: map.cc100[1] = atof(buffer); break;
	 case 11: map.cc100[2] = atof(buffer); break;
	 case 12: map.cc150[0] = atof(buffer); break;
	 case 13: map.cc150[1] = atof(buffer); break;
	 case 14: map.cc150[2] = atof(buffer); break;
   	 }
   	 x++;
   	 if(x == 15) break;
	}

	switch(settings.cc){
     	  case 2: timed=map.cc150[settings.laps]; break; //150cc
      	  case 1: timed=map.cc100[settings.laps]; break; //100cc
       	  case 0: timed=map.cc50[settings.laps]; break;  //50cc;
   	}

    	sprintf(map.imgpath, "%smap%d.gif",direc,mapc);


	 	 if(!(fp = fopen(map.imgpath, "r"))){
       		  	new_message_window("Could not Open map image");
		 }
	 
	map.image = ttk_load_image(map.imgpath);

	switch (ttk_screen->w){ 

	 case 220: 	ipod=0.6875;
			break;
	
	 case 176: 	ipod=0.55;
			break;
	 case 160: 	
			ipod=0.5;
			break;
	case 138: 	
			ipod=0.43125;
			break;
	}

	map.image = ttk_scale_surface(map.image,ipod);

	fclose(fp);
		
	cpos=map.cstart; //give track direction 
		  
}
Пример #5
0
static void duckhunt_setup()
{
    int i;
    char file[20];
    reset_duckhunt();
    /* for(i=0;i<8;i++) { sprintf (file, "/mnt/aj/duckhunt/dog%d.gif", i+1); dogw[i] = ttk_load_image (file); }
     for(i=0;i<3;i++) { sprintf (file, "/mnt/aj/duckhunt/duck%d.gif", i+1); duck[i] = ttk_load_image (file); }
    *///new_message_window("BIBI");
    sprintf (file, "/mnt/aj/duckhunt/dog1.gif");
    dogw[0] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/dog2.gif");
    dogw[1] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/dog3.gif");
    dogw[2] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/dog4.gif");
    dogw[3] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/dog5.gif");
    dogw[4] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/dog6.gif");
    dogw[5] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/dog7.gif");
    dogw[6] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/dog8.gif");
    dogw[7] = ttk_load_image (file);


    sprintf (file, "/mnt/aj/duckhunt/duck1.gif");
    duck[0] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/duck2.gif");
    duck[1] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/duck3.gif");
    duck[2] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/duck4.gif");
    duck[3] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/duck5.gif");
    duck[4] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/duck6.gif");
    duck[5] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/duck7.gif");
    duck[6] = ttk_load_image (file);
    sprintf (file, "/mnt/aj/duckhunt/duck8.gif");
    duck[7] = ttk_load_image (file);
    duckhunt_lose_bg = ttk_load_image ("/mnt/aj/duckhunt/duckhunt_lose_bg.gif");
    dog_laugh[0] = ttk_load_image ("/mnt/aj/duckhunt/dog_laugh1.gif");
    dog_laugh[1] = ttk_load_image ("/mnt/aj/duckhunt/dog_laugh2.gif");
    duckhunt_ss = ttk_load_image ("/mnt/aj/duckhunt/duckhunt_ss.gif");
    duckhunt_bg = ttk_load_image ("/mnt/aj/duckhunt/duckhunt_bg.gif");
    dead_duck = ttk_load_image ("/mnt/aj/duckhunt/dead_duck.gif");
    dog_duck = ttk_load_image ("/mnt/aj/duckhunt/dog_duck.gif");
    dd_fall = ttk_load_image ("/mnt/aj/duckhunt/dd_fall.gif");
    // new_message_window("HI");
    s_ducks[0] = ttk_load_image ("/mnt/aj/duckhunt/s_duckw.gif");
    s_ducks[1] = ttk_load_image ("/mnt/aj/duckhunt/s_duckr.gif");
    //  new_message_window("HIHI");
    if(ttk_screen->w <= 220) {
        duckhunt_lose_bg = ttk_scale_surface(duckhunt_lose_bg,dim);
        dog_laugh[0] = ttk_scale_surface(dog_laugh[0],dim);
        dog_laugh[1] = ttk_scale_surface(dog_laugh[1],dim);
        duckhunt_ss = ttk_scale_surface(duckhunt_ss,dim);
        duckhunt_bg = ttk_scale_surface(duckhunt_bg,dim);
        dead_duck = ttk_scale_surface(dead_duck,dim);
        dog_duck = ttk_scale_surface(dog_duck,dim);
        dd_fall = ttk_scale_surface(dd_fall,dim);
        s_ducks[0] = ttk_scale_surface(s_ducks[0],dim);
        s_ducks[1] = ttk_scale_surface(s_ducks[1],dim);
        for(i=0; i<3; i++) duck[i] = ttk_scale_surface(duck[i],dim);
        for(i=0; i<8; i++) dogw[i] = ttk_scale_surface(dogw[i],dim);
        mid = 87;
    }
    // new_message_window("BIHI");
    if(ttk_screen->w >= 220) {
        mid = 116;
        dim=1.45454545;
        duckhunt_lose_bg = ttk_scale_surface(duckhunt_lose_bg,dim);
        dog_laugh[0] = ttk_scale_surface(dog_laugh[0],dim);
        dog_laugh[1] = ttk_scale_surface(dog_laugh[1],dim);
        duckhunt_ss = ttk_scale_surface(duckhunt_ss,dim);
        duckhunt_bg = ttk_scale_surface(duckhunt_bg,dim);
        dead_duck = ttk_scale_surface(dead_duck,dim);
        dog_duck = ttk_scale_surface(dog_duck,dim);
        dd_fall = ttk_scale_surface(dd_fall,dim);
        s_ducks[0] = ttk_scale_surface(s_ducks[0],dim);
        s_ducks[1] = ttk_scale_surface(s_ducks[1],dim);
        for(i=0; i<3; i++) duck[i] = ttk_scale_surface(duck[i],dim);
        for(i=0; i<8; i++) dogw[i] = ttk_scale_surface(dogw[i],dim);
    }


    ttk_surface_get_dimen (duckhunt_ss, &imgw, &imgh);
    ttk_surface_get_dimen (duckhunt_bg, &bg_w, &bg_h);
    ttk_surface_get_dimen (duck[0], &duck_w, &duck_h);
    srandom((unsigned)time(NULL));
    aimerx = WIDTH/2;
    aimery = HEIGHT/2;
    // new_message_window("BIBIHI");
    duckhunt_srf = ttk_new_surface (bg_w, bg_h, ttk_screen->bpp);
}
Пример #6
0
ttk_surface iconui_get_icon(char * name)
{
	static int mnt_na = 1; /* 1 - unchecked, 0 - not accessible, 2 - accessible */
	static int hp_na = 1;
	static int share_na = 1;
	static int icons_na = 1;
#ifdef NEVER
	static int cs_na = 1;
	static int epoch = 0;
#endif
	char path[256];
	char * s = iconui_munge(name);
	int iconcache = ipod_get_setting((76));
	ttk_surface iconsrf;
#ifdef NEVER
	if (ttk_epoch > epoch) {
		cs_na = 1;
		epoch = ttk_epoch;
	}
#endif
	if (iconcache && (iconsrf = iconui_cache_get(s))) {
		return iconsrf;
	}
#ifdef NEVER
	if (cs_na) {
		char * p = realpath(COLOR_SCHEME_PATH, path);
		if (!p) {
			cs_na = 0;
		} else {
			path[strlen(path)-3] = 0;
			strcat(path, "-icons/");
			if (cs_na == 1 && access(path, R_OK)) {
				cs_na = 0;
			} else {
				cs_na = 2;
				strcat(path, s);
				strcat(path, ".png");
				if (!access(path, R_OK)) {
					if (iconcache) {
						iconsrf = iconui_cache_set(s, ttk_load_image((const char *)path) );
					} else {
						iconsrf = ttk_load_image((const char *)path);
					}
					free(s);
					return iconsrf;
				}
			}
		}
	}
#endif
	if (mnt_na) {
		strcpy(path, "/mnt/icons/");
		if (mnt_na == 1 && access(path, R_OK)) {
			mnt_na = 0;
		} else {
			mnt_na = 2;
			strcat(path, s);
			strcat(path, ".png");
			if (!access(path, R_OK)) {
				if (iconcache) {
					iconsrf = iconui_cache_set(s, ttk_load_image((const char *)path) );
				} else {
					iconsrf = ttk_load_image((const char *)path);
				}
				free(s);
				return iconsrf;
			}
		}
	}
	if (hp_na) {
		strcpy(path, "/hp/icons/");
		if (hp_na == 1 && access(path, R_OK)) {
			hp_na = 0;
		} else {
			hp_na = 2;
			strcat(path, s);
			strcat(path, ".png");
			if (!access(path, R_OK)) {
				if (iconcache) {
					iconsrf = iconui_cache_set(s, ttk_load_image((const char *)path) );
				} else {
					iconsrf = ttk_load_image((const char *)path);
				}
				free(s);
				return iconsrf;
			}
		}
	}
	if (share_na) {
		strcpy(path, "/usr/share/icons/");
		if (share_na == 1 && access(path, R_OK)) {
			share_na = 0;
		} else {
			share_na = 2;
			strcat(path, s);
			strcat(path, ".png");
			if (!access(path, R_OK)) {
				if (iconcache) {
					iconsrf = iconui_cache_set(s, ttk_load_image((const char *)path) );
				} else {
					iconsrf = ttk_load_image((const char *)path);
				}
				free(s);
				return iconsrf;
			}
		}
	}
	if (icons_na) {
		strcpy(path, "/mnt/aj/icons/");
		if (icons_na == 1 && access(path, R_OK)) {
			icons_na = 0;
		} else {
			icons_na = 2;
			strcat(path, s);
			strcat(path, ".png");
			if (!access(path, R_OK)) {
				if (iconcache) {
					iconsrf = iconui_cache_set(s, ttk_load_image((const char *)path) );
				} else {
					iconsrf = ttk_load_image((const char *)path);
				}
				free(s);
				return iconsrf;
			}
		}
	}
	sprintf(path,"/mnt/aj/icons/%c", s);
	strcat(path, ".png");
	if (!access(path, R_OK)) {
		if (iconcache) {
			iconsrf = iconui_cache_set(s, ttk_load_image((const char *)path) );
		} else {
			iconsrf = ttk_load_image((const char *)path);
		}
		free(s);
		return iconsrf;
	}
#ifdef NEVER
	if (cs_na) {
		char * p = realpath(COLOR_SCHEME_PATH, path);
		if (p) {
			path[strlen(path)-3] = 0;
			strcat(path, "-icons/Default.png");
			if (!access(path, R_OK)) {
				if (iconcache) {
					iconsrf = iconui_cache_set(s, ttk_load_image((const char *)path) );
				} else {
					iconsrf = ttk_load_image((const char *)path);
				}
				free(s);
				return iconsrf;
			}
		}
	}
#endif
	if (mnt_na) {
		strcpy(path, "/mnt/icons/Default.png");
		if (!access(path, R_OK)) {
			if (iconcache) {
				iconsrf = iconui_cache_set(s, ttk_load_image((const char *)path) );
			} else {
				iconsrf = ttk_load_image((const char *)path);
			}
			free(s);
			return iconsrf;
		}
	}
	if (hp_na) {
		strcpy(path, "/hp/icons/Default.png");
		if (!access(path, R_OK)) {
			if (iconcache) {
				iconsrf = iconui_cache_set(s, ttk_load_image((const char *)path) );
			} else {
				iconsrf = ttk_load_image((const char *)path);
			}
			free(s);
			return iconsrf;
		}
	}
	if (share_na) {
		strcpy(path, "/usr/share/icons/Default.png");
		if (!access(path, R_OK)) {
			if (iconcache) {
				iconsrf = iconui_cache_set(s, ttk_load_image((const char *)path) );
			} else {
				iconsrf = ttk_load_image((const char *)path);
			}
			free(s);
			return iconsrf;
		}
	}
	if (icons_na) {
		sprintf(path, "/mnt/aj/icons/Default.png");
		if (!access(path, R_OK)) {
			if (iconcache) {
				iconsrf = iconui_cache_set(s, ttk_load_image((const char *)path) );
			} else {
				iconsrf = ttk_load_image((const char *)path);
			}
			free(s);
			return iconsrf;
		}
	}
	strcpy(path, "/mnt/aj/icons/Default.png");
	if (!access(path, R_OK)) {
		if (iconcache) {
			iconsrf = iconui_cache_set(s, ttk_load_image((const char *)path) );
		} else {
			iconsrf = ttk_load_image((const char *)path);
		}
		free(s);
		return iconsrf;
	}
	free(s);
	return ttk_new_surface(32, 32, ttk_screen->bpp);
}