Exemple #1
0
/***********************************************************
* view pic
************************************************************/
void view_pic(fb_info fb_inf, char name[4][20])
{
	display_one("background/view.jpg",fb_inf);
    
	int size = 32 * fb_inf.w/1024;
	
	if(init_ft("font/type.ttf", size) != 0)
	{
		fprintf(stderr, "Error initial font\n");
		return;
	}

	int x = fb_inf.w/4 - size * 3/2;
	int y = fb_inf.h - 20 * fb_inf.h/768;

	display_string("上一页", x, y, fb_inf, COLOR);
	display_string("下一页", x + fb_inf.w/2, y, fb_inf, COLOR);

	int i;
   
	for(i = 0; i < 4; i++)
	{
		char path[128]="image/";
		strncat(path,name[i],strlen(name[i]) - 1);
		if(strstr(path,".jpg") != NULL)
			show(path, fb_inf, i);
	}  
	
}
Exemple #2
0
int		expose(t_sticks *c)
{
	char	*lives;

	lives = ft_itoa(c->life[0]);
	mlx_clear_window(c->mlx, c->win);
	get_colour(c, 0);
	draw(0, 0, c, 0);
	mlx_string_put(c->mlx, c->win, 240, 20, c->act_co, lives);
	free(lives);
	display_one(c);
	display_two(c);
	display_three(c);
	display_four(c);
	display_five(c);
	lives = ft_itoa(c->life[6]);
	get_colour(c, 6);
	draw(65, 135, c, 6);
	mlx_string_put(c->mlx, c->win, 460, 135, c->act_co, lives);
	free(lives);
	return (0);
}
Exemple #3
0
int main()
{
    char s[80];
    student a[50], key, res;
    unsigned ch, n, pos;
    n=0;
    do{
        puts("What would you like to do?");
        puts(" ( 0) Exit");
        puts(" ( 1) Enter details");
        puts(" ( 2) Show details");
        puts(" ( 3) Insert an element");
        puts(" ( 4) Delete an element");
        puts(" ( 5) Sort by Name");
        puts(" ( 6) Sort by City");
        puts(" ( 7) Sort by Roll");
        puts(" ( 8) Sort by Mark");
        puts(" ( 9) Search by Name");
        puts(" (10) Search by City");
        puts(" (11) Search by Roll");
        puts(" (12) Search by Mark");
        scanf(" %u%*c", &ch);
        switch(ch){
        case 0:
            puts("Bye!");
            break;
        case 1:
            n=accept(a, n);
            break;
        case 2:
            display(a, n);
            break;
        case 3:
            puts("Enter the following details:");
            printf(" - Name : ");
            gets(s);
            strcpy(key.name, s);

            printf(" - City : ");
            gets(s);
            strcpy(key.city, s);

            printf(" - Roll : ");
            scanf(" %u%*c", &key.roll);

            printf(" - Mark : ");
            scanf(" %u%*c", &key.mark);

            puts("Position?");
            scanf(" %u%*c", &pos);
            putchar('\n');

            insert(a, &n, pos, key);
            display(a, n);
            break;
        case 4:
            puts("Position?");
            scanf(" %u%*c", &pos);
            delet(a, &n, pos);
            display(a, n);
            break;
        case 5:
            sort_name(a, n);
            display(a, n);
            break;
        case 6:
            sort_city(a, n);
            display(a, n);
            break;
        case 7:
            sort_roll(a, n);
            display(a, n);
            break;
        case 8:
            sort_mark(a, n);
            display(a, n);
            break;
        case 9:
            puts("Name?");
            gets(s);
            res=srch_name(a, n, s);
            if(is_equal(res, error)) display_one(res);
            else puts("Not Found.");
            break;
        case 10:
            puts("City?");
            gets(s);
            res=srch_city(a, n, s);
            if(is_equal(res, error)) display_one(res);
            else puts("Not Found.");
            break;
        case 11:
            puts("Roll?");
            scanf(" %u%*c", &pos);
            res=srch_roll(a, n, pos);
            if(is_equal(res, error)) display_one(res);
            else puts("Not Found.");
            break;
        case 12:
            puts("Mark?");
            scanf(" %u%*c", &pos);
            res=srch_mark(a, n, pos);
            if(is_equal(res, error)) display_one(res);
            else puts("Not Found.");
            break;
        default:
            puts("Incorrect Choice!");
            break;
        }
        putchar('\n');
    } while(ch);
    return 0;
}