예제 #1
0
파일: app.cpp 프로젝트: ouadev/Tangram
//mode_createur
void mode_createur(){
	puts("hello");
	mode_devel=1;
	
	init_pieces();
	actualiser_ecran();

	SDL_Flip(_ecran);
	int continuer = 1;
	SDL_Event event;
	while (continuer)
	{
		SDL_WaitEvent(&event);
		switch(event.type)
		{
		case SDL_QUIT:
			continuer = 0;
			break;
		case SDL_MOUSEBUTTONUP:
			int xm=event.button.x,ym=event.button.y;
			if(xm<=209 && xm>=115 && ym<=39 && ym>=0){
				exit(0);
				acceuil();
			}
			break;
		}
	}

}
예제 #2
0
파일: app.cpp 프로젝트: ouadev/Tangram
//pause_instructions
void pause_instructions(){
	SDL_Surface* inst=SDL_LoadBMP("pieces/instructions.tg");
	SDL_Rect rect={0,0};
	SDL_BlitSurface(inst,NULL,_ecran,&rect);
	SDL_Flip(_ecran);
	int continuer = 1;
	SDL_Event event;
	while (continuer)
	{
		SDL_WaitEvent(&event);
		switch(event.type)
		{
		case SDL_QUIT:
			continuer = 0;
			break;
		case SDL_MOUSEBUTTONUP:
			int xm=event.button.x,ym=event.button.y;
			if(xm<=315 && xm>=196 && ym<=452 && ym>=414){
				acceuil();
			}
			break;
		}
	}

}
예제 #3
0
파일: app.cpp 프로젝트: ouadev/Tangram
//jouer
void jouer(){
	SDL_Init(SDL_INIT_VIDEO);  
	_ecran = SDL_SetVideoMode(WIDTH, HEIGHT, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
	
	
	acceuil();
}
예제 #4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{

    ui->setupUi(this);
    connect(ui->pushButton_2,SIGNAL(clicked()),this,SLOT(acceuil()));
    connect(ui->pushButton_3,SIGNAL(clicked()),this,SLOT(ajoutcours()));
    i=0;
}
예제 #5
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{

    ui->setupUi(this);
    connect(ui->pushButton_2,SIGNAL(clicked()),this,SLOT(acceuil()));
    connect(ui->pushButton_3,SIGNAL(clicked()),this,SLOT(ajoutcours()));
    connect(ui->pushButton_4,SIGNAL(clicked()),this,SLOT(listeCours()));
    connect(ui->pushButton_5,SIGNAL(clicked()),this,SLOT(coursAttente()));
    connect(ui->pushButton_6,SIGNAL(clicked()),this,SLOT(Conncexion()));
    connect(ui->pushButton_7,SIGNAL(clicked()),this,SLOT(inscription()));
    i=0;
}
예제 #6
0
파일: serveurtcp.c 프로젝트: jalcim/libft
void servershell(int pid)
{
	t_server *server;

	signal(SIGINT, ft_serv_end);

	write(1, "server\n", 7);
	server = ft_serv_init();
	recup(server);
	ft_socktcp(&server->sock, PORT, server->server);
	new_connect(server);

//	server->pid = 1;
//	while (server->pid)
		acceuil(server, pid);
//	waitpid(server->pid, NULL, 0);
}
예제 #7
0
파일: app.cpp 프로젝트: ouadev/Tangram
//pause_jouer()
void pause_jouer(){
	int continuer = 1;
	int suivre=0;
	int debug=0;
	int posee=0;
	Point premier_clique={0,0};
	Point precedent_motion={0,0};
	Point actuel_motion={0,0};
	SDL_Rect pos;
	SDL_Event event;
	while (continuer)
	{
		SDL_WaitEvent(&event);
		switch(event.type)
		{
		case SDL_QUIT:
			continuer = 0;
			exit(0);
			break;
		case SDL_KEYDOWN:

			if(event.key.keysym.sym==SDLK_a){continuer=0;exit(0);}
			else if(event.key.keysym.sym==SDLK_d){test();}
			 if(event.key.keysym.sym==SDLK_u){
				pieces=lire_solution(7);
				actualiser_ecran();
			}
			break;

		case SDL_MOUSEBUTTONUP:
			premier_clique.x=event.button.x;
			premier_clique.y=event.button.y;
			
			if(event.button.button==SDL_BUTTON_LEFT){
				//menu
					if(premier_clique.x<=102 && premier_clique.x>=5 && premier_clique.y<=39){
						if(stage<nbr_stages) stage++;
						else stage=1;
						
						init_stage(stage);
						
					}
					if(premier_clique.x<=208 && premier_clique.x>=114 && premier_clique.y<=39){
						Piece* sol=lire_solution(stage);
						if(sol) pieces=sol;
						actualiser_ecran();
					}
					if(premier_clique.x<=312 && premier_clique.x>=216 && premier_clique.y<=39){
						acceuil();
					}
					if(premier_clique.x<=419 && premier_clique.x>=324 && premier_clique.y<=39){
						exit(0);
					}
				
				//movements
				if(!suivre){
					puts("........Transporter........");
					piece_mobile=transporter(event.button.x,event.button.y);
					if(piece_mobile!=NULL){
						suivre=1;
						if(premier_clique.x<TABLE_WIDTH) dans_table=1;else dans_table=0;
					}
					actualiser_ecran();
				}else{
					puts("........Poser.........");
					posee=poser(piece_mobile,event.button.x,event.button.y);
					if(posee){
						piece_mobile=NULL;
						dans_table=0;
						actualiser_ecran();
						suivre=0;
						
					}
				}
				puts("........................................");
			}
			else if(event.button.button=SDL_BUTTON_RIGHT){
				if(suivre){
					puts(".....rotating....");
					Point centre={event.button.x,event.button.y};
					rotate_forme(piece_mobile->forme,centre);
					actualiser_ecran();
				}
			}
			break;

		case SDL_MOUSEMOTION:
			int xm=event.motion.x,ym=event.motion.y;
			actuel_motion.x=xm;
			actuel_motion.y=ym;
			if(xm<TABLE_WIDTH) dans_table=1; else dans_table=0;
			if(suivre){
				if(piece_mobile==NULL){
					puts("probleme dans l'operation de glissage");
					exit(0);
				}
				translater_forme(piece_mobile->forme,precedent_motion,actuel_motion);
				actualiser_ecran();
			}else{
				dans_table=0;
			}
			precedent_motion.x=xm;
			precedent_motion.y=ym;

		}

		if(nbr_pieces_posees==7){
			if(!mode_devel) {
				if(stage<nbr_stages) stage++; else stage=1;
				init_stage(stage);
			continuer=0;
			}
		}
	}
}