예제 #1
0
void main()
{
	int menu;
	for (ciclo = 0; ciclo == 0)
	{

		cout << "0. Presentacion";
		cout << "1. Indicaciones";
		cout << "2. Juego";
		cout << "3. Salir";
		cin >> menu;
		switch (menu)
		{
			case 0: presentacion();
					breack();

			case 1: indicaciones();
					breack();

			case 2: juego();
					breack();

			case 3: salir();
				    breack();
		}
	}
}
예제 #2
0
void escribir_socket() {
  int c;
  char outbuffer;
  
  strcat(usuario, "\n");
  write(sockfd, usuario, strlen(usuario));
  
  //en este if se escribe si se ha introducido algún archivo
  if (aflag) {
    FILE *file;
    char *line = NULL;
    size_t len;
    ssize_t read;

    file = fopen(archivo, "r");

    if (file == NULL)
        fatalerror("Error en el archivo de entrada.\n");

    while((read = getline(&line, &len, file)) != -1){
        write(sockfd, line, strlen(line));
    }

    fclose(file);
  }

  while ((c = getchar()) != EOF) {
    /*Se escriben los caracteres en el socket*/
    outbuffer = c;
    if (write(sockfd, &outbuffer, 1) != 1)
      fatalerror("No se pudo escribir al socket\n");
  }
  salir();
}
예제 #3
0
ArchivoRegVars::ArchivoRegVars(char *url){ //ctor
    strcpy(&filename[0],url);
    if(r_file_exists()==1){
        cout << "El archivo no existe!" << endl;
        if(r_create()==0){
            cout << "El archivo ha sido creado con exito!" << endl;
        } else {
            cout << "Error al intentar crear el archivo!" << endl;
            salir("",ERROR_DE_CREACION);
        }
    }
    if(r_open("r+b")==0){
        cout << "El archivo se ha abierto exitosamente!" << endl;
    } else {
        salir("",ERROR_DE_APERTURA);
    }
}
예제 #4
0
파일: squeeze.cpp 프로젝트: adlh/lemonpos
squeeze::squeeze()
    : KXmlGuiWindow( ),
      m_view(new squeezeView(this)),
      m_printer(0)
{
    setObjectName(QLatin1String("squeeze"));
    // accept dnd
    setAcceptDrops(false);

    // tell the KXmlGuiWindow that this is indeed the main widget
    setCentralWidget(m_view);

    // then, setup our actions
    setupActions();
    //Add some widgets to status bar
    led = new KLed;
    led->off();
    statusBar()->addWidget(led); //FIXME: Que cuando se escriba algo en la barra de status, quede el LED ahi tambien.
    // add a status bar
    statusBar()->show();

    // Add typical actions and save size/toolbars/statusbar
    setupGUI();
    disableUI();
    // allow the view to change the statusbar and caption
    connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)),
            this,   SLOT(changeStatusbar(const QString&)));
    connect(m_view, SIGNAL(signalChangeCaption(const QString&)),
            this,   SLOT(changeCaption(const QString&)));

    connect(m_view, SIGNAL(signalDisconnected()), this, SLOT(setDisconnected()));
    connect(m_view, SIGNAL(signalConnected()), this, SLOT(setConnected()));

    connect(m_view, SIGNAL(signalShowPrefs()), SLOT(optionsPreferences()) );

    connect(m_view, SIGNAL(signalSalir() ), SLOT(salir() ));

    connect(m_view, SIGNAL(signalShowDbConfig()), this, SLOT(showDBConfigDialog()));


    connect(m_view, SIGNAL(signalAdminLoggedOn()), this, SLOT(enableUI()));
    connect(m_view, SIGNAL(signalAdminLoggedOff()), this, SLOT(disableUI()));
    connect(m_view, SIGNAL(signalSupervisorLoggedOn()), this, SLOT(enableUI()));


    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(fixGeom()));
    timer->setInterval(5000);
    timer->start();
    

    loadStyle();
}
예제 #5
0
int main()
{
    EPersona lista[C];
    char seguir='s';
    int opcion=0, flag=0;

    inicializar(lista);

    while(seguir=='s')
    {
        system("cls");
        opcion=menu();

        switch(opcion)
        {
            case 1:
                altas(lista);
                flag=1;
                system("pause");
                break;
            case 2:
                if(flag==1)
                {
                    bajas(lista);
                }
                system("pause");
                break;
            case 3:
                if(flag==1)
                {
                    imprimir(lista);
                }
                system("pause");
                break;
            case 4:
                if(flag==1)
                {
                    grafico(lista);
                }
                printf("\n");
                system("pause");
                break;
            case 5:
                seguir = salir(lista);
                break;
        }
    }

    return 0;
}
예제 #6
0
t_offset ArchivoRegVars::get_offset(t_num_ref i_referencia){
    t_offset index_reg=-1;
    if( i_referencia >= 0 && i_referencia <=size() ){
        fseek(f_i_handler, sizeof(t_index_size)+i_referencia*sizeof(t_offset), SEEK_SET);

        fread(&index_reg, 1, sizeof(t_offset), f_i_handler);
        if(ferror(f_i_handler)!=0){
            salir("",ERROR_DE_LECTURA_INDICE);
        }
    } else {
        return -1;
    }
return index_reg;
}
예제 #7
0
t_num_ref ArchivoRegVars::append_index(t_offset offset){
    t_index_size index_size = size()+1;
    // Actualizo contador
    fseek(f_i_handler, 0, SEEK_SET);
    fwrite(&index_size, 1, sizeof(t_index_size), f_i_handler);
    // Agrego offset
    fseek(f_i_handler, 0, SEEK_END);
    fwrite(&offset, 1, sizeof(t_offset), f_i_handler);
    fflush(f_i_handler);

    if(ferror(f_i_handler)!=0){
        salir("",ERROR_DE_ESCRITURA_INDICE);
    }
return index_size;
}
예제 #8
0
t_num_ref ArchivoRegVars::add(string data){
        fseek(f_d_handler, 0, SEEK_END);
        t_reg_var_size data_length=data.length();
        // Almaceno el offset donde se va a escribir
        t_offset offset= ftell(f_d_handler);
        fwrite(&data_length,1, sizeof(t_reg_var_size), f_d_handler);
        fwrite(data.c_str(), 1, data.length(), f_d_handler);
        fflush(f_d_handler);
        if(ferror(f_d_handler)==0){
            append_index(offset);
        } else {
            salir("",ERROR_DE_ESCRITURA_DATOS);
        }
return ferror(f_d_handler);
}
예제 #9
0
string ArchivoRegVars::get(t_num_ref n){
    t_reg_var_size reg_size;
    int bytes_para_campo_longitud=sizeof(t_reg_var_size);

    t_offset offset=get_offset(n);
    fseek(f_d_handler, offset, SEEK_SET);
    fread(&reg_size, 1, bytes_para_campo_longitud, f_d_handler);
    char* buffer= (char*) malloc(reg_size+1);
    fread(buffer, 1, reg_size, f_d_handler);
    *(buffer+reg_size)='\0';

    if(ferror(f_d_handler)!=0){
        salir("",ERROR_DE_LECTURA_DATOS);
    }
    string data=buffer;
    free(buffer);
return data;
}
예제 #10
0
int main()
{
    Persona lista[C];
    char cont='N';
    int i;

    for(i=0; i<C; i++)
    {
        lista[i].estado=0;
        lista[i].edad=0;
    }

    do
    {
        switch(menu())
        {
        case '1':
            system("cls");
            alta(lista);
            break;
        case '2':
            system("cls");
            baja(lista);
            break;
        case '3':
            system("cls");
            ordAlfa(lista);
            break;
        case '4':
            system("cls");
            graf(lista);
            break;
        case '5':
            cont=salir();
            break;
        default:
            notOp();
        }
    }while(cont=='N');

    return 0;
}
예제 #11
0
int main(){system("color 2f");
           system("cls");
           int  i=20,con=0;  
           char opc,cadena[i][4][30];
           for(int q=0;q==0;){ 
                  printf("*******************************************************************************\n\t\t\t\tSUPER AGENDA 2011\n");
                  printf("*******************************************************************************\n\n");
                  printf("1) INGRESAR NUEVO REGISTRO\n2) BORRAR REGISTRO\n3) VER AGENDA \n4) VER REGISTRO\n5) MODIFICAR REGISTRO\n6) BORRAR AGENDA\n7) SALIR\n ");
                  printf("\nSELECCIONE UNA OPCION: ");
                  opc=getche();
                  system("cls");
                  switch(opc){
                        case '1':con=nuevoreg(cadena,i,con);break;
                        case '2':con=boreg(cadena,i,con);break; 
                        case '3':verag(cadena,i,con);break;
                        case '4':verreg(cadena,i,con);break;
                        case '5':modreg(cadena,i,con);break;
                        case '6':con=borag(con);break;
                        case '7':salir();break;
                        default:printf("\aOPCION INVALIDA\n\n");}}}
예제 #12
0
파일: shell.c 프로젝트: oscar932/shell
int ejecutar(char *cmd){
  char *fout=out(cmd);
  if(fout!='\0'){
    char *s;
    s = strstr(cmd, ">");
    char *buffer = malloc(sizeof(char) * 1024); 
    strncpy ( buffer, cmd, s - cmd);
    cmd=buffer;
  }
  char *fin=in(cmd);
  if(fin!='\0'){
    char *s;
    s = strstr(cmd, "<");
    char *buffer = malloc(sizeof(char) * 1024); 
    strncpy ( buffer, cmd, s - cmd);
    cmd=buffer;
  }
  char **varg = parse(cmd);
  if(strcmp(*varg, "cd") == 0)
    return cd(varg);

  else if(strcmp(*varg, "exit") == 0)
      salir();

  else if(strcmp(*varg, "help") == 0){
    printf("CTI2003 yash, versión 1.0.0 (x86_64-pc).\n");
    printf("Este es un programa informático donde se ejerce una interacción entre el usuario con el sistema operativo mediante una ventana que espera órdenes escritas por el usuario desde el teclado (entrada de texto).\n");
    printf("\n");
    printf("Autores: Oscar Morales (omorales) - David Reyes (dreyes).\n");
    printf("\n");
    return 1;
  }

  else{
    pid_t childPID;
    int status;
    childPID = vfork();
    if(childPID < 0){
      printf("Error process failed \n");
      return 1;
    }
    else if (childPID == 0){

      if(fin != '\0'){
        FILE *ptr=fopen(fin, "r");

        if(ptr==NULL){
          perror("Shellsita(error)->");
          exit(EXIT_FAILURE);
        }
        int fdin =fileno(ptr);
        if(fdin >= 0){
          int duperr=dup2(fdin, STDIN_FILENO);
           if (duperr < 0){
            perror("Shellsita(error)->");
            exit(EXIT_FAILURE);
           }
          close(fdin);
       }
        else{
          perror("Shellsita(error)->");
          exit(EXIT_FAILURE);
        }
      }
      if(fout != '\0'){
        FILE *ptr=fopen(fout, "ab");
        if(ptr==NULL){
          perror("Shellsita(error)->");
          exit(EXIT_FAILURE);
        }
        int fdout =fileno(ptr);
        if(fdout >= 0){
          int duperr=dup2(fdout, STDOUT_FILENO);
           if (duperr < 1){
            perror("Shellsita(error)->");
            exit(EXIT_FAILURE);
           }
          close(fdout);
       }
        else{
          perror("Shellsita(error)->");
          exit(EXIT_FAILURE);
        }
      }
      if (execvp(*varg, varg) < 0 ) {
        perror("Shellsita(error)->");
        exit(EXIT_FAILURE);
      }
    }
    else{
      while(wait(&status)!=childPID);
    }
    return 1;
  }
  return 1;
}
int main(int argc, const char * argv[])
{

	   opcion_t3 * menu3=((opcion_t3*) malloc(N * sizeof(opcion_t3)));


	*(menu3+2)=agregarEncuesta;
	//*(menu3+6)=salir;
	
	   int opcion=-1;
		Persona *p;
		Encuesta *e;
		Preguntas *pr;
		Respuestas *resp;

	   p=(Persona*)malloc(M*sizeof(Persona));
	   pr=(Preguntas*) malloc(X* sizeof(Preguntas));
	   e=(Encuesta*)malloc(M*sizeof (Encuesta));
	   resp=(Respuestas*)malloc(Y*sizeof (Respuestas));

	int numP=10; //numero de preguntas
	int numR=6; //numero de respuestas
	int par=0; int pre=0;
	   
	   
	while(opcion!=7)
	{

	//printf("Direccion en main %p\n",p);
		printf("---Opciones---\n1-Ingresar Preguntas\n2-Ingresar Participantes\n3-Realizar Encuesta\n7-Salir\nEscoge tu opción:  ");

		scanf("%d", &opcion);
		if(opcion==1)
		{
		pre++;
		agregarPreguntas(pr, resp, X,Y);
		
		}
		else if(opcion==2)
		{
		par++;
		agregarP(p,M);
		}
else if(opcion==7)
{
	salir(p, e, pr, resp,M ,M ,X );
}

	else if(par>0 && pre>0 && opcion==3)
{
	(*(menu3+(opcion-1)))(p, e, pr, M ,M, X);
}
else
printf("Necesitas agregar los Participantes o las Preguntas\n");


	}//Cierre de while

	//free(p);
	//free(e);
	
	//free(menu);
	//free(menu2);
	free(menu3);


	return 0;
}//Cierre de main
예제 #14
0
파일: process2.c 프로젝트: Kareliavs/SO
main()
{//PROCESO///////////////////////////////////////////////////////////////////////
	
	
	int key_proceso = ftok(FILEKEY, KEY_PROCESO);
	if (key_proceso == -1) {
		fprintf (stderr, "Error con la key \n");
		return -1; 
	}    
	int id_zone0 = shmget (key_proceso, sizeof(flags)*MAXBUF_PROCESO, 0777 | IPC_CREAT);
	if (id_zone0 == -1) {
		fprintf (stderr, "Error con id_zone 1 \n");
		return -1; 
	} 
	flags = shmat(id_zone0, (char *)0, 0);	
	if (flags == NULL) {
		fprintf (stderr, "Error reservando memoria flags\n");
		return -1; 
	}
	
////////////////////////////////////////////////////////////////////////////
	
  
  
 //turno///////////////////////////////////////////////////////////////////////
	
	
	int key_turno = ftok(FILEKEY, KEY_TURNO);
	if (key_turno == -1) {
		fprintf (stderr, "Error con la key \n");
		return -1; 
	}    
	int id_zone1 = shmget (key_turno, sizeof(turno)*MAXBUF_PROCESO, 0777 | IPC_CREAT);
	if (id_zone1 == -1) {
		fprintf (stderr, "Error con id_zone 1 \n");
		return -1; 
	} 
	turno = shmat(id_zone1,NULL , 0);	
	if (turno == NULL) {
		fprintf (stderr, "Error reservando memoria en turno\n");
		return -1; 
	}
	
//////////////////////////////////////////////////////////////////////////// 
 //interesado///////////////////////////////////////////////////////////////////////
	/* Key to shared memory */
	int key_contador = ftok(FILEKEY, KEY_CONTADOR);
	if (key_contador == -1) {
		fprintf (stderr, "Error con la key \n");
		return -1; 
	}    
	
	/*Creacion de memoria compartida */
	int id_zone3 = shmget (key_contador, sizeof(int)*2, 0777 | IPC_CREAT);
	if (id_zone3 == -1) {
		fprintf (stderr, "Error con id_zone \n");
		return -1; 
	} 
		
	/* we declared to zone to share */
	interesado = (int *)shmat (id_zone3, (char *)0, 0);
	if (interesado == NULL) {
		fprintf (stderr, "Error reservando memoria interesado\n");
		return -1; 
	}
////////////////////////////////////////////////////////////////////////////


 
 char c;
 int shmid;
 key_t key;
 
 
 /*Lo llama con es ID */
 key = 5678;

 /* Crea segmento */
 if ((shmid = shmget(key, SHMSIZE, IPC_CREAT | 0666)) < 0) {
 perror("shmget");//describe el error
 exit(1);
 }

 /*Añade segmento . */
 if ((shm = shmat(shmid, NULL, 0)) == (char *) -1) {
 perror("shmat");
 exit(1);
 }

////////////////////////////////////////////////////////////////////////////

 printf ("proceso 2 \n");


 //int i=0;
 /*
 for(i=0;i<2;i++){
	//while(1){
      	  entrar(0);
          /**/
	  /*salir(0);
	}*/
entrar(interesado[0]);
 /*Escribimos*/
	  *shm++='2';
	  *shm++=' ';
	  *shm++='h';
	  *shm++='o';
	  *shm++='l';
	  *shm++='a';
	  *shm = NULL;
/*terminamos*/
salir(interesado[0]);
interesado[0]++;
        if (id_zone1 != -1)
	{
		shmdt ((char *)turno);
	}
	if (id_zone3 != -1)
	{
		shmdt ((char *)interesado);
	}
	if(shmid != -1){
		shmdt ((char*)shm);
	}
	if(id_zone0!= -1){
		shmdt ((char*)flags);
	}
	
 exit(0);
} 
예제 #15
0
main(void)
{
	register long int num, puntos;
	char mapa[4000], tecla, fondo, fondo_enm[5], vidas, muerte, super, color_enm, inc_enm, opcion = 0;
	FILE *archivo;
	register unsigned char x, y, direccion = 0, direccion_enm[5], tempx, tempy, tempd, direccion_enmt[5];
	unsigned char xenm[5], yenm[5], xenmt[5], yenmt[5], tiempo_super, tiempo_fruta, sonido;
	int galletas, total_galletas, num2;
	char tablero[TOTAL_TABLEROS][12] = {"T1.MAP", "T2.MAP", "T3.MAP"}, indice = 0, fin, demo = VERDADERO;

	textmode(C40); /* 40 columnas * 25 filas */
	_wscroll = 0; /* desactivar el scroll */
	_setcursortype(_NOCURSOR); /* ocultar el cursor parpadeante */


	/* empezar un nuevo tablero */
	do {

	if(demo) demo = presentacion();

	if((archivo = fopen(tablero[indice], "rb")) == NULL) { /* abrir el archivo */
		textmode(C80);
		puts ("No se puede abrir el archivo mapa.");
		return 1;
	}

	/* preparar la pantalla */
	clrscr();
	/* verificar los 4 primeros bytes de ancho y alto */
	if(fread(&num2, 1, 2, archivo) != 2) {
		textmode(C80);
		puts ("Error leyendo el archivo mapa.");
		return 1;
	}
	if(num2 != XPANT) {
		textmode(C80);
		puts ("Error verificando el archivo mapa.");
		return 1;
	}
	if(fread(&num2, 1, 2, archivo) != 2) {
		textmode(C80);
		puts ("Error leyendo el archivo mapa.");
		return 1;
	}
	if(num2 != YPANT) {
		textmode(C80);
		puts ("Error verificando el archivo mapa.");
		return 1;
	}

	for(num = 0; num < 4000; num++) mapa[num] = getc(archivo); /* cargar el mapa en memoria */
	fclose(archivo);

	/* inicializar */
	total_galletas = 0;
	fin = FALSO;
	num = 0;
	vidas = 5;
	puntos = 0;

	/* mostrar el mapa en la pantalla */
	for(x = 1; x <= XPANT; x++) {
		for(y = 1; y <= YPANT; y++) {
			gotoxy(x, y);
			textcolor(LIGHTGRAY);
			if(*(mapa + num) == 1) {
				cprintf("Û");
			}
			else if(*(mapa + num) == 0) {
				cprintf("ú");
				total_galletas++;
			}
			else if(*(mapa + num) == 2) {
				textcolor(LIGHTGRAY);
				cprintf("+");
				total_galletas++;
			}
			else if(*(mapa + num) == 3) {
				textcolor(BLUE);
				cprintf("Û");
			}
			else if(*(mapa + num) == 4) {
				textcolor(RED);
				cprintf("Û");
			}
			else if(*(mapa + num) == 5) {
				textcolor(YELLOW);
				cprintf("Û");
			}
			else if(*(mapa + num) == 6) {
				textcolor(GREEN);
				cprintf("Û");
			}
			else if(*(mapa + num) == 7) {
				cprintf("°");
			}
			num++;
		} /* for... */
	}
	/* preparar el texto de la pantalla */
	textcolor(CYAN | BLINK);
	gotoxy(5, YPANT + 2);
	cprintf("Listo!");
	delay(700); /* esperar un momento */
	textcolor(LIGHTGRAY);
	gotoxy(1, YPANT + 2);
	cprintf("Puntos:0       Galletas:0    Vidas: %c%c%c%c", 2, 2, 2, 2);
	randomize();

	galletas = 1;
	do { /* empezar una nueva vida del packman */
	color_enm = MAGENTA;
	muerte = FALSO;
	vidas--; /* restar una vida */
	sonido = 0;
	super = FALSO; /* desabilitar posible especial (super) */
	tiempo_fruta = FALSO; /* desabilitar posible especial (fruta) */
	gotoxy(XFRUTA, YFRUTA); cprintf(" "); /* borrar posibles frutas */
	inc_enm = 1; /* velocidad o incremento del enemigo */
	gotoxy(36 + vidas, YPANT + 2); cprintf(" "); /* borrar una cara */
	x = XFRUTA; y = YFRUTA; /* inicializar el packman */
	xenm[0] = XPANT / 2 - 4; yenm[0] = YPANT / 2; /* inicializar las posiciones de 5 enemigos */
	xenm[1] = XPANT / 2 - 2; yenm[1] = YPANT / 2;
	xenm[2] = XPANT / 2; yenm[2] = YPANT / 2;
	xenm[3] = XPANT / 2 - 2; yenm[3] = YPANT / 2 + 1;
	xenm[4] = XPANT / 2 + 1; yenm[4] = YPANT / 2 + 1;

	if(demo) direccion = IZ;
	direccion_enm[0] = random(4) + 1; /* inicializar 5 direcciones */
	direccion_enm[1] = random(4) + 1;
	direccion_enm[2] = random(4) + 1;
	direccion_enm[3] = random(4) + 1;
	direccion_enm[4] = random(4) + 1;

	fondo_enm[0] = ' '; /* fondo vacio para cada enemigo */
	fondo_enm[1] = ' ';
	fondo_enm[2] = ' ';
	fondo_enm[3] = ' ';
	fondo_enm[4] = ' ';
	for(num2 = 100; num2 < 500; num2++) { /* sonido de inicio */
		sound(num2);
		delay(3);
	}
	nosound();
	if(!demo) tecla = getch(); /* esperar pulsaci¢n para iniciar */
	do { /* un ciclo por movimiento */
		if(demo) {
			if(kbhit()) {
					vidas = 0;
				muerte = VERDADERO;
				puntos = -1;
				break;
			}
		}
		if(!demo) tecla = inkey();
		gotoxy(x, y); cprintf(" "); /* borrar packman */
		textcolor(LIGHTGRAY);
		for (num = 0; num < 5; num++) { /* borrar 5 fantasmas */
			gotoxy(xenm[num], yenm[num]);
			cprintf("%c", fondo_enm[num]);
			/* obtener fondo para evitar restar una galleta */
			gettext(XPANT / 2, YPANT /2, XPANT /2, YPANT/2, &num2);
			if(num2 == 'ú' || num2 == '+') galletas++;
		}
		tempd = direccion; /* temporal de la direcci¢n del packman por si no hay vacio */

		if (!demo) switch(tecla) {
			case 75: /* izqierda */
				direccion = IZ;
			break;

			case 77: /* derecha */
				direccion = DR;
			break;

			case 72: /* arriba */
				direccion = AR;
			break;

			case 80: /* abajo */
				direccion = AB;
			break;
		} /* switch(tecla...*/

		tempx = x; /* temporales de posici¢n */
		tempy = y;
		switch(direccion) { /* mover el packman */
			case IZ:
				x--;
			break;

			case DR:
				x++;
			break;

			case AR:
				y--;
			break;

			case AB:
				y++;
			break;
		} /* switch(direcc... */
		for (num = 0; num < 5; num++) { /* revisar si se han estrellado */
			if(x == xenm[num]) {
				if(y == yenm[num]) { /* si se encuentra con un enemigo */
					if(super) { /* revisar si la super est  activa */
						puntos += PUNTOS_FANTASMA;
						textcolor(GREEN);
						gotoxy(8, YPANT + 2);
						cprintf("%ld", puntos);
						xenm[num] = XPANT / 2;
						yenm[num] = YPANT / 2;
						for(num2 = 466; num2 < 500; num2++) { /* sonido de comer enemigos */
							sound(num2);
							delay(1);
						}
					}
					else muerte = VERDADERO;
				}
			} /* if(x... */

		} /* for... */
		for (num = 0; num < 5; num++) { /* temporales de los enemigos */
			xenmt[num] = xenm[num];	yenmt[num] = yenm[num];
		}
		for (num = 0; num < 5; num++) { /* mover 5 enemigos */
			switch(direccion_enm[num]) {
				case IZ:
					xenm[num]-=inc_enm;
				break;

				case DR:
					xenm[num]+=inc_enm;
				break;

				case AR:
					yenm[num]-=inc_enm;
				break;

				case AB:
					yenm[num]+=inc_enm;
				break;
			} /* switch(direccion_enm... */
		} /* for(... */
		if(x < 1) x = XPANT; /* comprobar limites del packman */
		if(y < 1) y = YPANT;
		if(x > XPANT) x = 1;
		if(y > YPANT) y = 1;

		for(num = 0; num < 5; num++) { /* comprobar limites de los enemigos */
			if(xenm[num] < 1) xenm[num] = XPANT;
			if(yenm[num] < 1) yenm[num] = YPANT;
			if(xenm[num] > XPANT) xenm[num] = 1;
			if(yenm[num] > YPANT) yenm[num] = 1;
		}
		gettext(x, y, x, y, &fondo);
		if(fondo != 'ú' && fondo != ' ' && fondo != '+') { /* no pasar por las barreras (packman)*/
			x = tempx; /* reestablecer */
			y = tempy;
			direccion = tempd;
			sonido = 0;
			if(demo) direccion = random(4) + 1;
		} else sonido = 80;
		if(fondo == 'ú') { /* verificar si hay una galleta (packman) */
			puntos += PUNTOS_GALLETA;
			galletas++;
			textcolor(GREEN);
			gotoxy(8, YPANT + 2);
			cprintf("%ld", puntos);
			gotoxy(25, YPANT + 2);
			cprintf("%d", galletas);
			if(sonido == 80) sonido = 140;
			else sonido = 80;
		}
		else if(fondo == '+') { /* verificar si hay un super */
			puntos += PUNTOS_SUPER;
			galletas++;
			textcolor(GREEN);
			gotoxy(8, YPANT + 2);
			cprintf("%ld", puntos);
			gotoxy(25, YPANT + 2);
			cprintf("%d", galletas);
			for(num2 = 766; num2 > 666; num2--) { /* sonido del super */
				sound(num2);
				delay(1);
			}
			for(num = 0; num < 5; num++) { /* cambiar la direcci¢n de los enemigos (super) */
				if(direccion_enm[num] == IZ) direccion_enm[num] = DR;
				else if(direccion_enm[num] == DR) direccion_enm[num] = IZ;
				else if(direccion_enm[num] == AR) direccion_enm[num] = AB;
				else if(direccion_enm[num] == AB) direccion_enm[num] = AR;
			}
			super = VERDADERO; /* activar la super */
			tiempo_super = 0;
			color_enm = BROWN;
		}
		else if(fondo == 6) { /* si hay una especial roja */
			puntos += PUNTOS_ROJA;
			textcolor(GREEN);
			gotoxy(8, YPANT + 2);
			cprintf("%ld", puntos);
			gotoxy(25, YPANT + 2);
			cprintf("%d", galletas);
			for(num2 = 866; num2 > 766; num2--) { /* sonido de especial roja */
				sound(num2);
				delay(1);
			}
			gotoxy(XFRUTA, YFRUTA); cprintf(" "); /* borrarla */
			tiempo_fruta = FALSO;
		}
		else if(fondo == 15) { /* si hay una especial zul */
			puntos += PUNTOS_AZUL;
			textcolor(GREEN);
			gotoxy(8, YPANT + 2);
			cprintf("%ld", puntos);
			gotoxy(25, YPANT + 2);
			cprintf("%d", galletas);
			for(num2 = 966; num2 > 890; num2--) { /* sonido de especial azul */
				sound(num2);
				delay(1);
			}
			gotoxy(XFRUTA, YFRUTA); cprintf(" "); /* borrarla */
			tiempo_fruta = FALSO;
			super = VERDADERO; /* activar super */
			tiempo_super = 0;
			color_enm = LIGHTBLUE;
			inc_enm = 0;
		}
		for(num = 0; num < 5; num++) { /* temporales direccion enemigos */
			direccion_enmt[num] = direccion_enm[num];
		}
		for(num = 0; num < 5; num++) {
			if(super) {
				if(x > xenm[num]) direccion_enm[num] = IZ;
				else if(x < xenm[num]) direccion_enm[num] = DR;
				else if(y > yenm[num]) direccion_enm[num] = AR;
				else if(y < yenm[num]) direccion_enm[num] = AB;
			} else {
				if(x > xenm[num]) direccion_enm[num] = DR;
				else if(x < xenm[num]) direccion_enm[num] = IZ;
				else if(y > yenm[num]) direccion_enm[num] = AB;
				else if(y < yenm[num]) direccion_enm[num] = AR;
			}
			/* los enemigos no deben devolverse */
			if(direccion_enm[num] == IZ && direccion_enmt[num] == DR) direccion_enm[num] = direccion_enmt[num];
			else if(direccion_enm[num] == AB && direccion_enmt[num] == AR) direccion_enm[num] = direccion_enmt[num];
			else if(direccion_enm[num] == DR && direccion_enmt[num] == IZ) direccion_enm[num] = direccion_enmt[num];
			else if(direccion_enm[num] == AR && direccion_enmt[num] == AB) direccion_enm[num] = direccion_enmt[num];

			switch(direccion_enm[num]) { /* verificar que haya vacio */
				case IZ:
					gettext(xenm[num] - 1, yenm[num], xenm[num] - 1, yenm[num], &fondo);
				break;

				case DR:
					gettext(xenm[num] + 1, yenm[num], xenm[num] + 1, yenm[num], &fondo);
				break;

				case AR:
					gettext(xenm[num], yenm[num] - 1, xenm[num], yenm[num] - 1, &fondo);
				break;

				case AB:
					gettext(xenm[num], yenm[num] + 1, xenm[num], yenm[num] + 1, &fondo);
				break;
			}
			if(fondo != 'ú' && fondo != ' ' && fondo != '+' && fondo != '°' && fondo != 6 && fondo != 15) { /* solo pasar por los espacios (enemigo) */
				direccion_enm[num] = direccion_enmt[num];
			}
		}

		for(num = 0; num < 5; num++) {
			gettext(xenm[num], yenm[num], xenm[num], yenm[num], &fondo); /* solo pasar por los espacios (enemigo) */
			if(fondo != 'ú' && fondo != ' ' && fondo != '+'  && fondo != '°' && fondo != 6 && fondo != 15) {
				direccion_enm[num] = random(4) + 1; /* nueva direccion del enemigo */
				xenm[num] = xenmt[num];	yenm[num] = yenmt[num];
			}
		}
		for(num = 0; num < 5; num++) { /* guardar el fondo del enemigo */
			gettext(xenm[num], yenm[num], xenm[num], yenm[num], &fondo_enm[num]);
		}
		if(galletas == total_galletas) fin = VERDADERO; /* verificar fin del juego */
		if(fin) break; /* terminar tablero */

		for(num = 0; num < 5; num++) { /* revisar si se han estrellado */
			if(x == xenm[num]) {
				if(y == yenm[num]) { /* si se encuentra con un enemigo */
					if(super) { /* revisar si la super est  activa */
						puntos += PUNTOS_FANTASMA;
						textcolor(GREEN);
						gotoxy(8, YPANT + 2);
						cprintf("%ld", puntos);
						xenm[num] = XPANT / 2;
						yenm[num] = YPANT / 2;
						for(num2 = 466; num2 < 500; num2++) { /* sonido al atrapar un enemigo */
							sound(num2);
							delay(1);
						}
					}
					else muerte = VERDADERO; /* muerte */
				}
			} /* if(x... */
		} /* for... */
		if(puntos > 2600 && tiempo_fruta == FALSO) { /* mostrar especial roja */
			if(random(200) == 66) {
				gotoxy(XFRUTA, YFRUTA);
				textcolor(RED);
				cprintf("%c", 6);
				tiempo_fruta = VERDADERO;
			}
		}
		if(puntos > 2666 && tiempo_fruta == FALSO) { /* mostrar especial azul */
			if(random(395) == 66) {
				gotoxy(XFRUTA, YFRUTA);
				textcolor(LIGHTBLUE);
				cprintf("%c", 15);
				tiempo_fruta = VERDADERO;
			}
		}
		if(tiempo_fruta) tiempo_fruta++; /* contabilizar especial */
		if(tiempo_fruta >= DURACION_FRUTA) { /* si se agota el tiempo */
			tiempo_fruta = FALSO;
			gotoxy(XFRUTA, YFRUTA); cprintf(" "); /* borrar */
		}

		textcolor(LIGHTCYAN);
		gotoxy(x, y); /* mostrar packman */
		cprintf("%c", 2);
		textcolor(color_enm);
		for (num = 0; num < 5; num++) { /* mostrar los enemigos */
			gotoxy(xenm[num], yenm[num]); /* mostrar un enemigo */
			cprintf("%c", 1);
		}
		if(super) { /* contabilizar super */
			tiempo_super++;
			if(tiempo_super > DURACION_SUPER) {
				super = FALSO; /* desactivar */
				color_enm = MAGENTA;
				tiempo_super = 0;
				inc_enm = 1;
			}
		}
		sound(sonido);
		delay(40);
		nosound();
		delay(75);

	} while(!muerte); /* do {... */
	gotoxy(x, y); /* borrar packman */
	cprintf(" ");
	textcolor(LIGHTGRAY);
	for (num = 0; num < 5; num++) { /* borrar 5 enemigos */
		gotoxy(xenm[num], yenm[num]);
		cprintf("%c", fondo_enm[num]);
	}
	if(fin) break; /* terminar si se alcanza el total de galletas */

	} while(vidas > 1); /* GAME OVER! */

	if(fin) { /* si termino por total de galletas */
		for(num2 = 0; num2 < 600; num2++) { /* sonido al pasar el tablero */
			sound(num2);
			delay(2);
		}
		for(num2 = 0; num2 < 100; num2++) {
			sound(600);
			delay(1);
		}
		nosound();
		opcion = 's';
		if(!demo && (indice + 1) == TOTAL_TABLEROS) { /* fin del juego */
			puntos += 1666;
			record(puntos, indice); /* Verificar si el puntaje es alto para guardarlo */
			celebrar();
			indice = 0;
		}
		else indice++;
	} /* if(fin... */
	else if(!demo) {
		gotoxy(XPANT / 2 - 1, YPANT / 2);
		cprintf("GAME");
		gotoxy(XPANT / 2 - 1, YPANT / 2 + 1);
		cprintf("OVER!");

		for(num2 = 500; num2 > 0; num2--) { /* sonido de "Game Over" */
			sound(num2);
			delay(2);
		}
		for(num2 = 0; num2 < 450; num2++) {
			sound(1);
			delay(1);
		}
		nosound();

		record(puntos, indice); /* Verificar si el puntaje es alto para guardarlo */
		mostrar_records();

		textcolor(CYAN | BLINK);
		gotoxy(1, YPANT + 2); cprintf("¨Quieres volver a jugar?               ");
		do {
			opcion = getch();
			indice = 0;
		} while(tolower(opcion) != 's' && tolower(opcion) != 'n');
	} /* else if(!demo... */
	else if(demo) {
		if(kbhit()) demo = FALSO;
		opcion = 's';
		inkey();
		mostrar_records();
		for(num2 = 0; num2 < 10000 && !kbhit(); num2++) delay(1);
	}
	} while(tolower(opcion) == 's');

	salir();
	return 0;
} /* main */
예제 #16
0
int inkey (void) /* presionar una tecla */
{
	register int tecla;

	tecla = inp (0x60);

	if (kbhit ()) {
		getch ();
		switch (tecla) {
			case 30:
				tecla = 'A';
			break;
			case 48:
				tecla = 'B';
			break;
			case 46:
				tecla = 'C';
			break;
			case 32:
				tecla = 'D';
			break;
			case 18:
				tecla = 'E';
			break;
			case 33:
				tecla = 'F';
			break;
			case 34:
				tecla = 'G';
			break;
			case 35:
				tecla = 'H';
			break;
			case 23:
				tecla = 'I';
			break;
			case 36:
				tecla = 'J';
			break;
			case 37:
				tecla = 'K';
			break;
			case 38:
				tecla = 'L';
			break;
			case 50:
				tecla = 'M';
			break;
			case 49:
				tecla = 'N';
			break;
			case 39:
				tecla = '¥';
			break;
			case 24:
				tecla = 'O';
			break;
			case 25:
				tecla = 'P';
			break;
			case 16:
				tecla = 'Q';
			break;
			case 19:
				tecla = 'R';
			break;
			case 31:
				tecla = 'S';
			break;
			case 20:
				tecla = 'T';
			break;
			case 22:
				tecla = 'U';
			break;
			case 47:
				tecla = 'V';
			break;
			case 17:
				tecla = 'W';
			break;
			case 45:
				tecla = 'X';
			break;
			case 21:
				tecla = 'Y';
			break;
			case 44:
				tecla = 'Z';
			break;
			case 51:
				tecla = ',';
			break;
			case 52:
				tecla = '.';
			break;
			case 53:
				tecla = '-';
			break;
			case 1: /* ESC */
				salir();
			break;
		} /* switch */
		return(tecla);
	} /* if */
	else return(0);
} /* inkey */
예제 #17
0
파일: lemon.cpp 프로젝트: adlh/lemonpos
void lemon::setupActions()
{
  KStandardAction::quit(this, SLOT(salir()), actionCollection());
  //KStandardAction::quit(qApp, SLOT(quit()), actionCollection());
  
  KStandardAction::preferences(this, SLOT(optionsPreferences()), actionCollection());
  
  //Our actions
  QAction* loginAction =  actionCollection()->addAction( "login" );
  loginAction->setText(i18n("Login"));
  loginAction->setIcon(KIcon("preferences-web-browser-identification")); //identity  office-address-book
  loginAction->setShortcut(Qt::CTRL+Qt::Key_L);
  connect(loginAction, SIGNAL(triggered(bool)),m_view, SLOT(login()));
  
  QAction *corteCajaAction = actionCollection()->addAction("balance");
  corteCajaAction->setText(i18nc("Account balance", "Balance"));
  corteCajaAction->setIcon(KIcon("lemon-balance"));
  corteCajaAction->setShortcut(Qt::CTRL+Qt::Key_B);
  connect(corteCajaAction, SIGNAL(triggered(bool)), m_view, SLOT(corteDeCaja()));
  
  QAction* enterCodeAction = actionCollection()->addAction( "enterCode" );
  enterCodeAction->setText(i18n("Enter Code"));
  enterCodeAction->setIcon(KIcon("lemon-tag"));
  enterCodeAction->setShortcut(Qt::Key_F2);
  connect(enterCodeAction, SIGNAL(triggered(bool)),m_view, SLOT(showEnterCodeWidget()));
  
  QAction* searchItemAction = actionCollection()->addAction( "searchItem" );
  searchItemAction->setText(i18n("Search Item"));
  searchItemAction->setIcon(KIcon("edit-find"));
  searchItemAction->setShortcut(Qt::Key_F3);
  connect(searchItemAction, SIGNAL(triggered(bool)),m_view, SLOT(showSearchItemWidget()));
  
  QAction* delSelectedItemAction = actionCollection()->addAction( "deleteSelectedItem" );
  delSelectedItemAction->setText(i18n("Delete Selected Item"));
  delSelectedItemAction->setIcon(KIcon("lemon-boxcancel"));
  delSelectedItemAction->setShortcut(QKeySequence::ZoomOut); //Qt::Key_Delete  Qt::Key_Control+Qt::Key_Delete  QKeySequence::Cut QKeySequence::ZoomOut
  connect(delSelectedItemAction, SIGNAL(triggered(bool)),m_view, SLOT(deleteSelectedItem()));
  // ERROR: I dont know why, in my computer, instead of CTRL-Delete, the key assigned is Shift-(
  // The same for other non-working shortcuts.
  // Some problem related to different keyboard layout :
  qDebug()<<"shortcut:"<<delSelectedItemAction->shortcuts();
  
  QAction* finishTransactionAction = actionCollection()->addAction( "finishTransaction" );
  finishTransactionAction->setText(i18n("Finish transaction"));
  finishTransactionAction->setIcon(KIcon("lemon-transaction-accept"));
  finishTransactionAction->setShortcut(Qt::Key_F12);
  connect(finishTransactionAction, SIGNAL(triggered(bool)),m_view, SLOT(finishCurrentTransaction()));
  
  QAction* cancelTransactionAction = actionCollection()->addAction( "cancelTransaction" );
  cancelTransactionAction->setText(i18n("Cancel transaction"));
  cancelTransactionAction->setIcon(KIcon("lemon-transaction-cancel"));
  cancelTransactionAction->setShortcut(Qt::Key_F10);
  connect(cancelTransactionAction, SIGNAL(triggered(bool)),m_view, SLOT(preCancelCurrentTransaction()));
  
  QAction* cancelSellAction = actionCollection()->addAction("cancelTicket");
  cancelSellAction->setText(i18n("Cancel a ticket"));
  cancelSellAction->setIcon(KIcon("lemon-ticket-cancel") );
  cancelSellAction->setShortcut(Qt::Key_F11);
  connect(cancelSellAction, SIGNAL(triggered(bool)),m_view, SLOT(askForIdToCancel()));
  
  //NOTE: This action is for setting how much money is on the drawer...
  QAction* startOperationAction = actionCollection()->addAction( "startOperation" );
  startOperationAction->setText(i18n("Start Operation"));
  startOperationAction->setIcon(KIcon("window-new"));
  startOperationAction->setShortcut(QKeySequence::New); // New Qt::Key_Control+Qt::Key_N
  connect(startOperationAction, SIGNAL(triggered(bool)),m_view, SLOT(_slotDoStartOperation()));

  QAction *payFocusAction = actionCollection()->addAction("payFocus");
  payFocusAction->setText(i18n("Pay focus"));
  payFocusAction->setIcon(KIcon("lemon-payfocus"));
  payFocusAction->setShortcut(Qt::Key_F4); //Qt::Key_Alt + Qt::Key_End
  connect(payFocusAction, SIGNAL(triggered(bool)),m_view, SLOT(focusPayInput()));
  
  QAction *showProdGridAction = actionCollection()->addAction("showProductsGrid");
  showProdGridAction->setCheckable(true);
  showProdGridAction->setText(i18n("Show/Hide Products Grid"));
  showProdGridAction->setIcon(KIcon("view-split-top-bottom"));
  showProdGridAction->setShortcut(QKeySequence::Print);
  connect(showProdGridAction, SIGNAL(toggled(bool)), m_view, SLOT(showProductsGrid(bool)));
  qDebug()<<"Show Grid shortcut:"<<showProdGridAction->shortcuts();
  
  QAction *showPriceCheckerAction = actionCollection()->addAction("showPriceChecker");
  showPriceCheckerAction->setText(i18n("Show Price Checker"));
  showPriceCheckerAction->setIcon(KIcon("lemon-price-checker"));
  showPriceCheckerAction->setShortcut(Qt::Key_F9);
  connect(showPriceCheckerAction, SIGNAL(triggered(bool)), m_view, SLOT(showPriceChecker()));
  
  QAction *reprintTicketAction = actionCollection()->addAction("reprintTicket");
  reprintTicketAction->setText(i18n("Reprint ticket"));
  reprintTicketAction->setIcon(KIcon("lemon-print-ticket"));
  reprintTicketAction->setShortcut(Qt::Key_F5);
  connect(reprintTicketAction, SIGNAL(triggered(bool)), m_view, SLOT(showReprintTicket()));
  
  QAction *cashOutAction = actionCollection()->addAction("cashOut");
  cashOutAction->setText(i18n("Cash Out"));
  cashOutAction->setIcon(KIcon("lemon-cashout"));
  cashOutAction->setShortcut(Qt::Key_F7); //F7
  connect(cashOutAction, SIGNAL(triggered(bool)), m_view, SLOT(cashOut()));
  
  QAction *cashAvailableAction = actionCollection()->addAction("cashAvailable");
  cashAvailableAction->setText(i18n("Cash in drawer"));
  cashAvailableAction->setIcon(KIcon("lemon-money"));
  cashAvailableAction->setShortcut(Qt::Key_F6);
  connect(cashAvailableAction, SIGNAL(triggered(bool)), m_view, SLOT(cashAvailable()));
  
  QAction *cashInAction = actionCollection()->addAction("cashIn");
  cashInAction->setText(i18n("Cash In"));
  cashInAction->setIcon(KIcon("lemon-cashin"));
  cashInAction->setShortcut(Qt::Key_F8); //F8
  connect(cashInAction, SIGNAL(triggered(bool)), m_view, SLOT(cashIn()));
  
  QAction *endOfDayAction = actionCollection()->addAction("endOfDay");
  endOfDayAction->setText(i18n("End of day report"));
  endOfDayAction->setIcon(KIcon("go-jump-today"));
  endOfDayAction->setShortcut(QKeySequence::Close);
  connect(endOfDayAction, SIGNAL(triggered(bool)), m_view, SLOT(endOfDay()));
  qDebug()<<"End of day shortcut:"<<endOfDayAction->shortcuts();
  
  setupGUI();
  
  setGeometry(QApplication::desktop()->screenGeometry(this));
  if (!Settings::splitterSizes().isEmpty()) m_view->setTheSplitterSizes(Settings::splitterSizes());
}
예제 #18
0
void lemon::setupActions()
{
  KStandardAction::quit(this, SLOT(salir()), actionCollection());
  //KStandardAction::quit(qApp, SLOT(quit()), actionCollection());

  KStandardAction::preferences(this, SLOT(optionsPreferences()), actionCollection());

    //Our actions
  QAction* loginAction =  actionCollection()->addAction( "login" );
  loginAction->setText(i18n("Login"));
  loginAction->setIcon(KIcon("office-address-book")); //identity
  loginAction->setShortcut(Qt::CTRL+Qt::Key_L);
  connect(loginAction, SIGNAL(triggered(bool)),m_view, SLOT(login()));

  QAction *corteCajaAction = actionCollection()->addAction("balance");
  corteCajaAction->setText(i18nc("Account balance", "Balance"));
  corteCajaAction->setIcon(KIcon("lemon-balance"));
  corteCajaAction->setShortcut(Qt::CTRL+Qt::Key_B);
  connect(corteCajaAction, SIGNAL(triggered(bool)), m_view, SLOT(doCorteDeCaja()));

  QAction* enterCodeAction = actionCollection()->addAction( "enterCode" );
  enterCodeAction->setText(i18n("Enter Code"));
  enterCodeAction->setIcon(KIcon("lemon-tag"));
  enterCodeAction->setShortcut(Qt::Key_F2);
  connect(enterCodeAction, SIGNAL(triggered(bool)),m_view, SLOT(showEnterCodeWidget()));

  QAction* searchItemAction = actionCollection()->addAction( "searchItem" );
  searchItemAction->setText(i18n("Search Item"));
  searchItemAction->setIcon(KIcon("edit-find"));
  searchItemAction->setShortcut(Qt::Key_F3);
  connect(searchItemAction, SIGNAL(triggered(bool)),m_view, SLOT(showSearchItemWidget()));

  QAction* delSelectedItemAction = actionCollection()->addAction( "deleteSelectedItem" );
  delSelectedItemAction->setText(i18n("Delete Selected Item"));
  delSelectedItemAction->setIcon(KIcon("lemon-boxcancel"));
  delSelectedItemAction->setShortcut(QKeySequence::ZoomOut); //Qt::Key_Delete  Qt::Key_Control+Qt::Key_Delete  QKeySequence::Cut QKeySequence::ZoomOut
  connect(delSelectedItemAction, SIGNAL(triggered(bool)),m_view, SLOT(deleteSelectedItem()));
  // ERROR: I dont know why, in my computer, instead of CTRL-Delete, the key assigned is Shift-(
  // The same for other non-working shortcuts.
  // Some problem related to different keyboard layout :
  qDebug()<<"shortcut:"<<delSelectedItemAction->shortcuts();

  QAction* finishTransactionAction = actionCollection()->addAction( "finishTransaction" );
  finishTransactionAction->setText(i18n("Finish transaction"));
  finishTransactionAction->setIcon(KIcon("lemon-transaction-accept"));
  finishTransactionAction->setShortcut(Qt::Key_F12);
  connect(finishTransactionAction, SIGNAL(triggered(bool)),m_view, SLOT(finishCurrentTransaction()));

  QAction* cancelTransactionAction = actionCollection()->addAction( "cancelTransaction" );
  cancelTransactionAction->setText(i18n("Cancel transaction"));
  cancelTransactionAction->setIcon(KIcon("lemon-transaction-cancel"));
  cancelTransactionAction->setShortcut(Qt::Key_F10);
  connect(cancelTransactionAction, SIGNAL(triggered(bool)),m_view, SLOT(preCancelCurrentTransaction()));

  QAction* cancelSellAction = actionCollection()->addAction("cancelTicket");
  cancelSellAction->setText(i18n("Cancel a ticket"));
  cancelSellAction->setIcon(KIcon("lemon-ticket-cancel") );
  cancelSellAction->setShortcut(Qt::Key_F11);
  connect(cancelSellAction, SIGNAL(triggered(bool)),m_view, SLOT(askForIdToCancel()));

      //NOTE: This action is for setting how much money is on the drawer...
  QAction* startOperationAction = actionCollection()->addAction( "startOperation" );
  startOperationAction->setText(i18n("Start Operation"));
  startOperationAction->setIcon(KIcon("window-new"));
  startOperationAction->setShortcut(QKeySequence::New); // New Qt::Key_Control+Qt::Key_N
  connect(startOperationAction, SIGNAL(triggered(bool)),m_view, SLOT(_slotDoStartOperation()));

  QAction *payFocusAction = actionCollection()->addAction("payFocus");
  payFocusAction->setText(i18n("Pay focus"));
  payFocusAction->setIcon(KIcon("lemon-payfocus"));
  payFocusAction->setShortcut(Qt::Key_F4); //Qt::Key_Alt + Qt::Key_End
  connect(payFocusAction, SIGNAL(triggered(bool)),m_view, SLOT(focusPayInput()));

  QAction *showProdGridAction = actionCollection()->addAction("showProductsGrid");
  showProdGridAction->setCheckable(true);
  showProdGridAction->setText(i18n("Show/Hide Products Grid"));
  showProdGridAction->setIcon(KIcon("view-split-top-bottom"));
  showProdGridAction->setShortcut(QKeySequence::Print);
  connect(showProdGridAction, SIGNAL(toggled(bool)), m_view, SLOT(showProductsGrid(bool)));
  qDebug()<<"Show Grid shortcut:"<<showProdGridAction->shortcuts();

  QAction *showPriceCheckerAction = actionCollection()->addAction("showPriceChecker");
  showPriceCheckerAction->setText(i18n("Show Price Checker"));
  showPriceCheckerAction->setIcon(KIcon("lemon-price-checker"));
  showPriceCheckerAction->setShortcut(Qt::Key_F9);
  connect(showPriceCheckerAction, SIGNAL(triggered(bool)), m_view, SLOT(showPriceChecker()));

  QAction *reprintTicketAction = actionCollection()->addAction("reprintTicket");
  reprintTicketAction->setText(i18n("Reprint ticket"));
  reprintTicketAction->setIcon(KIcon("lemon-print-ticket"));
  reprintTicketAction->setShortcut(Qt::Key_F5);
  connect(reprintTicketAction, SIGNAL(triggered(bool)), m_view, SLOT(showReprintTicket()));

  QAction *cashOutAction = actionCollection()->addAction("cashOut");
  cashOutAction->setText(i18n("Cash Out"));
  cashOutAction->setIcon(KIcon("lemon-cashout"));
  cashOutAction->setShortcut(Qt::Key_F7); //F7
  connect(cashOutAction, SIGNAL(triggered(bool)), m_view, SLOT(cashOut()));

  QAction *cashAvailableAction = actionCollection()->addAction("cashAvailable");
  cashAvailableAction->setText(i18n("Cash in drawer"));
  cashAvailableAction->setIcon(KIcon("lemon-money"));
  cashAvailableAction->setShortcut(Qt::Key_F6);
  connect(cashAvailableAction, SIGNAL(triggered(bool)), m_view, SLOT(cashAvailable()));

  QAction *cashInAction = actionCollection()->addAction("cashIn");
  cashInAction->setText(i18n("Cash In"));
  cashInAction->setIcon(KIcon("lemon-cashin"));
  cashInAction->setShortcut(Qt::Key_F8); //F8
  connect(cashInAction, SIGNAL(triggered(bool)), m_view, SLOT(cashIn()));

  QAction *endOfDayAction = actionCollection()->addAction("endOfDay");
  endOfDayAction->setText(i18n("End of day report"));
  endOfDayAction->setIcon(KIcon("go-jump-today"));
  endOfDayAction->setShortcut(QKeySequence::Close);
  connect(endOfDayAction, SIGNAL(triggered(bool)), m_view, SLOT(endOfDay()));
  qDebug()<<"End of day shortcut:"<<endOfDayAction->shortcuts();

  QAction *soAction = actionCollection()->addAction("specialOrder");
  soAction->setText(i18n("Add Special Order"));
  soAction->setIcon(KIcon("lemon-box"));
  soAction->setShortcut(Qt::Key_PageUp);
  connect(soAction, SIGNAL(triggered(bool)), m_view, SLOT(addSpecialOrder()));
  qDebug()<<"SpecialOrder shortcut:"<<soAction->shortcuts();


  QAction *socAction = actionCollection()->addAction("specialOrderComplete");
  socAction->setText(i18n("Complete Special Order"));
  socAction->setIcon(KIcon("lemon-box"));
  socAction->setShortcut(Qt::Key_PageDown);
  connect(socAction, SIGNAL(triggered(bool)), m_view, SLOT(specialOrderComplete()));
  qDebug()<<"SpecialOrder Complete shortcut:"<<socAction->shortcuts();

  QAction *lockAction = actionCollection()->addAction("lockScreen");
  lockAction->setText(i18n("Lock Screen"));
  lockAction->setIcon(KIcon("lemon-box")); //TODO:CREATE ICON!
  lockAction->setShortcut(Qt::CTRL+Qt::Key_Space);
  connect(lockAction, SIGNAL(triggered(bool)), m_view, SLOT(lockScreen()));
  qDebug()<<"LockScreen shortcut:"<<lockAction->shortcuts();

  QAction *suspendSaleAction = actionCollection()->addAction("suspendSale");
  suspendSaleAction->setText(i18n("Suspend Sale"));
  suspendSaleAction->setIcon(KIcon("lemon-suspend"));
  suspendSaleAction->setShortcut(Qt::CTRL+Qt::Key_Backspace);
  connect(suspendSaleAction, SIGNAL(triggered(bool)), m_view, SLOT( suspendSale() ));
  qDebug()<<"Suspend Sale shortcut:"<<suspendSaleAction->shortcuts();

  QAction *soStatusAction = actionCollection()->addAction("soStatus");
  soStatusAction->setText(i18n("Change Special Order Status"));
  soStatusAction->setIcon(KIcon("lemon-box")); //TODO:CREATE ICON!
  soStatusAction->setShortcut(Qt::CTRL+Qt::Key_PageUp);
  connect(soStatusAction, SIGNAL(triggered(bool)), m_view, SLOT( changeSOStatus() ));
  qDebug()<<"soStatus shortcut:"<<soStatusAction->shortcuts();

  QAction *oDiscAction = actionCollection()->addAction("occasionalDiscount");
  oDiscAction->setText(i18n("Change Special Order Status"));
  oDiscAction->setIcon(KIcon("lemon-money")); //TODO:CREATE ICON!
  oDiscAction->setShortcut(Qt::CTRL+Qt::Key_D);
  connect(oDiscAction, SIGNAL(triggered(bool)), m_view, SLOT( occasionalDiscount() ));
  qDebug()<<"occasionalDiscount shortcut:"<<oDiscAction->shortcuts();

  QAction *resumeAction = actionCollection()->addAction("resumeSale");
  resumeAction->setText(i18n("Resume Sale"));
  resumeAction->setIcon(KIcon("lemon-resume"));
  resumeAction->setShortcut(Qt::CTRL+Qt::Key_R);
  connect(resumeAction, SIGNAL(triggered(bool)), m_view, SLOT( resumeSale() ));
  qDebug()<<"resumeSale shortcut:"<<resumeAction->shortcuts();

  QAction *makeReservationA = actionCollection()->addAction("makeReservation");
  makeReservationA->setText(i18n("Reserve Items"));
  makeReservationA->setIcon(KIcon("lemon-box")); //TODO:CREATE ICON!
  makeReservationA->setShortcut(Qt::ALT + Qt::Key_R); // Qt::ALT is the left ALT key ( not the Alt Gr )
  connect(makeReservationA, SIGNAL(triggered(bool)), m_view, SLOT( reserveItems() ));
  qDebug()<<"makeReservation shortcut:"<<makeReservationA->shortcuts();

  QAction *resumeRAction = actionCollection()->addAction("resumeReservation");
  resumeRAction->setText(i18n("Reservations"));
  resumeRAction->setIcon(KIcon("lemon-box")); //TODO:CREATE ICON!
  resumeRAction->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_R);
  connect(resumeRAction, SIGNAL(triggered(bool)), m_view, SLOT( resumeReservation() ));
  qDebug()<<"Reservations shortcut:"<<resumeRAction->shortcuts();

  QAction *showCreditsAction = actionCollection()->addAction("showCredits");
  showCreditsAction->setText(i18n("Show Credits"));
  showCreditsAction->setIcon(KIcon("lemon-credits"));
  showCreditsAction->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_C);
  connect(showCreditsAction, SIGNAL(triggered(bool)), m_view, SLOT( showCredits() ));
  qDebug()<<"ShowCredits shortcut:"<<showCreditsAction->shortcuts();
  
  setupGUI();

  //FIXME: SCREEN SIZE
  setWindowState( windowState() | Qt::WindowFullScreen ); // set
  //setGeometry(QApplication::desktop()->screenGeometry(this));
  if (!Settings::splitterSizes().isEmpty()) m_view->setTheSplitterSizes(Settings::splitterSizes());
  if (!Settings::gridSplitterSizes().isEmpty()) m_view->setTheGridSplitterSizes(Settings::gridSplitterSizes());
}
예제 #19
0
void JuegoCliente::leerEvento(){

	if (this->vista->leerEvento(evento)){
		int accion = this->vista->getAccion();
		switch(accion){

		case SALIR:			salir();						break;
	    //case JUGAR:			reiniciar();					break;
		case CLICKDERECHO:		this->alternarPanelArmas();				break;
		}

		bool enviar = false;
		if ( accion == IZQUIERDA || accion == DERECHA || accion == ABAJO || accion == ARRIBA || accion == ENTER || accion == ESPACIO) {
			if (!this->eventos[accion]) {
				this->eventos[accion] = true;
				enviar = true;
				if(accion == ESPACIO && !this->panelArmas->proyectilRestante(this->panelArmas->getArmaSeleccionada())){
					//Si no me quedan mas proyectiles no en7vio el evento
					enviar = false;
				}
			}		
		} else {
			if (accion == SOLTARIZQUIERDA || accion == SOLTARABAJO || accion == SOLTARESPACIO || accion == SOLTARENTER || accion == SOLTARARRIBA || accion == SOLTARDERECHA) {
				this->eventos[accion - teclas] = false;
				enviar = true;
				if(accion == SOLTARESPACIO){
					//Descuento un proyectil
					this->panelArmas->descontarArmaEspacio(this->panelArmas->getArmaSeleccionada());
				}
			}
		}
		if((accion == CLICK && !this->panelArmas->visible) || enviar){
			//Para estos eventos tengo que notificar al servidor
			Evento* e = new Evento();
			int x,y;
			SDL_GetMouseState(&x,&y);

			e->accion = accion;
			 
			e->x = (x + this->vista->getCorrimientoX()) / (relacionPPU * this->vista->getZoom());
			e->y = (y + this->vista->getCorrimientoY()) / (relacionPPU * this->vista->getZoom());
			
			this->cliente->enviarEvento(e->serializar());
			delete e;
		}else if(accion == CLICK && this->panelArmas->visible){
			//Manejo el click aparte para verificar el click sobre el panel de armas
			Evento* e = new Evento();
			int x,y;
			SDL_GetMouseState(&x,&y);
			int armaSeleccionada = this->getArmaSeleccionada(x,y);
			
			if(armaSeleccionada >= 0 && this->panelArmas->proyectilRestante(armaSeleccionada)){
				this->panelArmas->seleccionarArma(armaSeleccionada);
				
				//Notifico al servidor el arma seleccionada
				e->accion = CLICKARMA;
				e->x = armaSeleccionada;
				e->y = armaSeleccionada;
			}else{
				//Envio el click al servidor para que lo procese
				this->panelArmas->descontarArmaClick(this->panelArmas->getArmaSeleccionada());
				e->accion = accion;
				e->x = (x + this->vista->getCorrimientoX()) / (relacionPPU * this->vista->getZoom());
				e->y = (y + this->vista->getCorrimientoY()) / (relacionPPU * this->vista->getZoom());
			}
			
			this->cliente->enviarEvento(e->serializar());
			delete e;
		}
	}
}
예제 #20
0
	int main(int argc, const char * argv[])
	{

	opcion_t3 * menu3=((opcion_t3*) malloc(N * sizeof(opcion_t3)));

	
	*(menu3)=agregaP;

	int opcion=-1;

	Persona *p;
	Torre *tor;
	Edificio *ed;
	Nave *nav;
	Modelado *mod;

	p=(Persona*)malloc(1*sizeof(Persona));
	tor=(Torre*)malloc(1*sizeof(Torre));
	ed=(Edificio*)malloc(1*sizeof(Edificio));
	nav=(Nave*)malloc(1*sizeof(Nave));
	mod=(Modelado*)malloc(1*sizeof(Modelado));
int op=0;
		while(opcion!=7)
	{

		printf("---Opciones---\n1-Ingresar Persona \n2-Generar una estructura \n3-Imprime \n4-Editar Persona \n5-Borrar Persona\n7-Salir\nEscoge tu opción:  ");

		scanf("%d", &opcion);
		if(opcion==1)
		{
	
	p = (Persona*)realloc(p, (pT+1) * sizeof(Persona));
	(*(menu3+opcion-1))( p, pT);
	pT++;
	}//Cierre if
		else if(opcion==2)
		{
	if(pT<1)
{
printf("Aun no hay empleados Registradas\n");
}
else
{
		imprimirEmpleados(p, pT);
		printf("Selecciona un empleado por su ID: ");
		scanf("%d", &aux);

		printf("Que tipo de estructura quieres? \n1.Edificio \n2.Torre \n3.Nave \nOpcion: ");
		scanf("%d", &op);

		if(op==1)
		{
		ed = (Edificio*)realloc(ed, (edT+1) * sizeof(Edificio));
		}
		else if(op==2)
		{
		tor = (Torre*)realloc(tor, (torT+1) * sizeof(Torre));
		}

		else if(op==3)
		{
		nav = (Nave*)realloc(nav, (navT+1) * sizeof(Nave));
		}
			printf("Voy a agregar una estructura\n");
			agregaEstructura(p, ed, tor, nav, mod, op);

		mod = (Modelado*)realloc(mod, (modT+1) * sizeof(Modelado));
		agregaMod(mod, p, ed, tor, nav, aux-1, op);
		modT++;

		}//Cierre de else
		}//Cierre de opcion 2
		else if(opcion==3)
		{

		//imprimirEd(ed);

		//imprimirTor(tor);
		//imprimirNav(nav);

		if(fork()==0)
		{
		imprimirMod(mod);
		}//Cierre de hijo
		else
		{
		wait(0);
		}//Padre
		//imprimirEmpleados(p, pT);

		}
		else if(opcion==4)
		{
		if(pT<1)
		{
		printf("Aun no hay Empleados Registrados\n");
		}
		else
		{
		imprimirEmpleados(p,pT);
		printf("Dame el ID de la persona que quieres editar: ");
		scanf("%d", &aux);
		editarP(p, aux-1);
		}//Cierre de else
		}//Cierre de else 4
		else if(opcion==5)
		{
		if(pT<1)
		{
		printf("Aun no hay Empleados Registrados\n");
		}
		else
		{
		imprimirEmpleados(p,pT);
		printf("Dame el ID de la persona que quieres Borrar: ");
		scanf("%d", &aux);
		borrarP(p, aux-1);
		}//Cierre de else

		}//Cierre de else 5

		else if(opcion==7)
		{
			free(menu3);
		salir(mod, p,ed,tor,nav);
free(p);
free(tor);
free(ed);
free(nav);
free(mod);

		exit(0);

		}//Cierre de SALIR
	}//Cierre de while
	
	return 0;
	}//Cierre de main
예제 #21
0
void gestotux::closeEvent( QCloseEvent *event )
{
 salir();
 event->accept();
}
예제 #22
0
int main(void)
{
      char n;
      int x=10,y=10;
      clrscr();
      textbackground(0);
      ipn();
      Sleep(600);
      voca3();
      Sleep(1000);
      marco();
      textcolor(10);
      Sleep(200);
      textbackground(0);
      gotoxy(10,11);
      printf("Altas");
      Sleep(200);
      gotoxy(10,12);
      textbackground(0);
      printf("Bajas");
      Sleep(200);
      gotoxy(10,13);
      textbackground(0);
      printf("Modificaciones");
      Sleep(200);
      textbackground(0);
      gotoxy(10,14);
      printf("Consultas");
      Sleep(200);
      gotoxy(10,15);
      textbackground(0);
      printf("Reportes");
      Sleep(200);
      gotoxy(10,16);
      textbackground(0);
      printf("Salir");
      Sleep(500);
      about();

      do
      {
             n = tolower(getch());
             switch(n)
             {
                      case 'w':
                           if(y<=16 && y>=12)
                           {
                                    y=y-1;
                                    menu(&x,&y);
                                    about();
                           }
                           else
                           {
                               Beep(9000,300);
                               if(y==12)
                               {
                                        y=9;
                                        menu(&x,&y);
                                        about();
                               }
                           }
                           break;

                      case 's':
                           if(y<=15 && y>=10)
                           {
                                    y=y+1;
                                    menu(&x,&y);
                                    about();
                           }
                           
                           else
                           {
                               y=16;
                               Beep(9000,300);
                               menu(&x,&y);
                               about();
                           }
                           break;

                      case enter:
                           if(y==11)
                           {
                                    daralta();
                           }
                           if(y==12)
                           {
                                    darbaja();
                           }
                           if(y==13)
                           {
                                    modificaciones();
                           }
                           if(y==14)
                           {
                                    consultas();
                           }
                           if(y==15)
                           {
                                    reportes();
                           }
                           if(y==16)
                           {
                                    salir();
                           }
                           break;
                      
             }  
      }
      while(n !='v');
}
예제 #23
0
int menu(int argc, char **argv)
{
    char tecla;
    int i;
    u16 *vga;
    MemoryMessage mem;

    /* Request VGA memory. */
    mem.action    = CreatePrivate;
    mem.bytes     = PAGESIZE;
    mem.virtualAddress  = ZERO;
    mem.physicalAddress = VGA_PADDR;
    mem.protection      = PAGE_RW | PAGE_PINNED;
    mem.ipc(MEMSRV_PID, SendReceive, sizeof(mem));

    /* Point to the VGA mapping. */
    vga = (u16 *) mem.virtualAddress;

    for (i=0; i < 36; i++) {
      vga[i] = VGA_CHAR(' ', GREEN, GREEN);
    }
    vga[36] = VGA_CHAR('A', BLACK, GREEN);
    vga[37] = VGA_CHAR('m', BLACK, GREEN);
    vga[38] = VGA_CHAR('a', BLACK, GREEN);
    vga[39] = VGA_CHAR('y', BLACK, GREEN);
    vga[40] = VGA_CHAR('a', BLACK, GREEN);
    vga[41] = VGA_CHAR('O', BLACK, GREEN);
    vga[42] = VGA_CHAR('S', BLACK, GREEN);
    for (i=43; i < 80; i++) {
      vga[i] = VGA_CHAR(' ', GREEN, GREEN);
    }
    for (i=80; i < 1680; i++) {
      vga[i] = VGA_CHAR(' ', MAGENTA, MAGENTA);
    }
/*    vga[1520] = VGA_CHAR('A', BLUE, BROWN);
    vga[1521] = VGA_CHAR('m', BLUE, BROWN);
    vga[1522] = VGA_CHAR('a', BLUE, BROWN);
    vga[1523] = VGA_CHAR('y', BLUE, BROWN);
    vga[1524] = VGA_CHAR('a', BLUE, BROWN);
    vga[1525] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1526] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1527] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1528] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1529] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1530] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1531] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1600] = VGA_CHAR('S', BLUE, BROWN);
    vga[1601] = VGA_CHAR('c', BLUE, BROWN);
    vga[1602] = VGA_CHAR('a', BLUE, BROWN);
    vga[1603] = VGA_CHAR('p', BLUE, BROWN);
    vga[1604] = VGA_CHAR('e', BLUE, BROWN);
    vga[1605] = VGA_CHAR('(', BLUE, BROWN);
    vga[1606] = VGA_CHAR('A', BLUE, BROWN);
    vga[1607] = VGA_CHAR(')', BLUE, BROWN);
    vga[1608] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1609] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1610] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1611] = VGA_CHAR(' ', BLUE, BROWN);*/
    vga[1680] = VGA_CHAR('W', BLUE, BROWN);
    vga[1681] = VGA_CHAR('a', BLUE, BROWN);
    vga[1682] = VGA_CHAR('m', BLUE, BROWN);
    vga[1683] = VGA_CHAR('a', BLUE, BROWN);
    vga[1684] = VGA_CHAR('/', BLUE, BROWN);
    vga[1685] = VGA_CHAR('W', BLUE, BROWN);
    vga[1686] = VGA_CHAR('A', BLUE, BROWN);
    vga[1687] = VGA_CHAR('+', BLUE, BROWN);
    vga[1688] = VGA_CHAR('(', BLUE, BROWN);
    vga[1689] = VGA_CHAR('W', BLUE, BROWN);
    vga[1690] = VGA_CHAR(')', BLUE, BROWN);
    vga[1691] = VGA_CHAR(' ', BLUE, BROWN);
    for (i=1692; i < 1760; i++) {
      vga[i] = VGA_CHAR(' ', MAGENTA, MAGENTA);
    }
    vga[1760] = VGA_CHAR('R', BLUE, BROWN);
    vga[1761] = VGA_CHAR('e', BLUE, BROWN);
    vga[1762] = VGA_CHAR('b', BLUE, BROWN);
    vga[1763] = VGA_CHAR('o', BLUE, BROWN);
    vga[1764] = VGA_CHAR('o', BLUE, BROWN);
    vga[1765] = VGA_CHAR('t', BLUE, BROWN);
    vga[1766] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1767] = VGA_CHAR('(', BLUE, BROWN);
    vga[1768] = VGA_CHAR('R', BLUE, BROWN);
    vga[1769] = VGA_CHAR(')', BLUE, BROWN);
    vga[1770] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1771] = VGA_CHAR(' ', BLUE, BROWN);
    for (i=1772; i < 1840; i++) {
      vga[i] = VGA_CHAR(' ', MAGENTA, MAGENTA);
    }
    vga[1840] = VGA_CHAR('S', BLUE, BROWN);
    vga[1841] = VGA_CHAR('h', BLUE, BROWN);
    vga[1842] = VGA_CHAR('e', BLUE, BROWN);
    vga[1843] = VGA_CHAR('l', BLUE, BROWN);
    vga[1844] = VGA_CHAR('l', BLUE, BROWN);
    vga[1845] = VGA_CHAR('(', BLUE, BROWN);
    vga[1846] = VGA_CHAR('S', BLUE, BROWN);
    vga[1847] = VGA_CHAR(')', BLUE, BROWN);
    vga[1848] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1849] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1850] = VGA_CHAR(' ', BLUE, BROWN);
    vga[1851] = VGA_CHAR(' ', BLUE, BROWN);
    do {
      tecla = getchar();
    } while (tecla != 'R'&& tecla != 'r'&& tecla != 'S'&& tecla != 's'&& 'M'&& tecla != 'm'&& tecla != 'W'&& tecla != 'w'
             /*&&tecla != 'A'&& tecla != 'a'*/);
    if (tecla == 'M'|| tecla == 'm') {
      main(argc, argv);
    }
    if (tecla == 'R'|| tecla == 'r') {
      return PrivExec(Reboot);
    }
    if (tecla == 'S'|| tecla == 's') {
      salir();
    }
    if (tecla == 'W'|| tecla == 'w') {
      wama();
    }
/*    if (tecla == 'A'|| tecla == 'a') {
      game();
    }*/
}