Example #1
0
int main(int argc, char *argv[])
{
	if( argc == 2 )
	{
		if(strcmp(argv[1],"-h") == 0 || strcmp(argv[1],"--output") == 0)
			helpScreen();
		else
			extract(argv[1]);	
  	}
  	else if(argc == 4)
  	{
  		if(strcmp(argv[1],"-o") == 0 || strcmp(argv[1],"--output") == 0)
  			extract2(argv[3],argv[2]);
  		else if(strcmp(argv[2],"-o") == 0 || strcmp(argv[2],"--output") == 0)
  			extract2(argv[1],argv[3]);  			
  		else helpScreen();
  	}
  	else
  	{
  		helpScreen();
  	}
}
bool AddJobDialog::eventFilter(QObject *o, QEvent *e)
{
	if((o == ui->labelHelpScreenX264) && (e->type() == QEvent::MouseButtonPress))
	{
		OptionsModel options(m_sysinfo); saveOptions(&options);
		QScopedPointer<HelpDialog> helpScreen(new HelpDialog(this, false, m_sysinfo, &options, m_preferences));
		helpScreen->exec();
	}
	else if((o == ui->labelHelpScreenAvs2YUV) && (e->type() == QEvent::MouseButtonPress))
	{
		OptionsModel options(m_sysinfo); saveOptions(&options);
		QScopedPointer<HelpDialog> helpScreen(new HelpDialog(this, true, m_sysinfo, &options, m_preferences));
		helpScreen->exec();
	}
	else if((o == ui->editCustomX264Params) && (e->type() == QEvent::FocusOut))
	{
		ui->editCustomX264Params->setText(ui->editCustomX264Params->text().simplified());
	}
	else if((o == ui->editCustomAvs2YUVParams) && (e->type() == QEvent::FocusOut))
	{
		ui->editCustomAvs2YUVParams->setText(ui->editCustomAvs2YUVParams->text().simplified());
	}
	return false;
}
Example #3
0
void extract2(char *filename, char *outputfile)
{
	FILE *fp;
	FILE *fh;
	int ch2,roundno = 0;
	fp = fopen(filename,"r");

	if(fp == NULL)
	{
		printf("cannot open file: %s\n", filename);
		helpScreen();
	}
	else
	{
		fh = fopen(outputfile,"w+");
		while ((roundno = decodeNextCharacter(roundno,&ch2,fp,fh)) >= 0 );
		fclose(fp);
		fclose(fh);
	}
}
Example #4
0
int main()
{ 
  FILE *fp; 
  int whr; //weather
  int diff=2; //variable for difficulty initialized in medium
  int slct1; //main menu selection
  int x,y=0,i=1; //loops
  int totals=50; //total score
  char name[30];
  char c; //gameplay selection loop
  
  
    clearScreen();
    printf("\n\t   ---Welcome to LEMONADE STAND--- ");
    printf("\n\tA C version of the original game from the Apple II.");
    printf("\n\tProgrammed by R");
    printf("\n");
    printf("\n\tPlease, enter your name: ");
    scanf(" %[^\n]s", name);
    while( strlen(name) == 30) {
      printf("\tSorry, the name is too long. Try again...");
      printf("\n\tEnter your name: ");
      scanf(" %30[^\n]", name);
    }
    
    fp=fopen("scores.txt","a");
    
    int slct; //main menu selection
    
    do {
    printf("\n\t1- Start a new game");
    printf("\n\t2- HELP and how to play");
    printf("\n\t3- Options");
    do{
      printf("\n\tEnter: ");
      scanf(" %i",&slct); //menu entry selection
      switch(slct) {
          case 1:                    //GAME START
            x=0; 
	    break;
          case 2:                    //HELP SCREEN
            helpScreen(x);
    	    x=1;
	    clearScreen();
            break;
          case 3:                    //OPTIONS SCREEN
            diff=optionsScreen(diff);
	    x=1;
	    clearScreen();
            break;
	  default:
	    printf("\tOption not recognised");
	    x=2;
	    break;
       }
      }while(x==2);
    } while(x==1);
    
    clearScreen();
    printf("\n\n\t Press ENTER to start the game.\n\tEnjoy and have fun!");
    getchar();
    getchar();
    
    do{
      clearScreen();
      printf("\n\tDay %i", i);
      printf("\n\tMoney: %ic", totals);
      getchar();
      
      whr = weather(diff); //weather screen
      totals += gameplay(diff, whr);
     
      clearScreen();
      printf("\tYour total money is %i", totals);
      do {
        printf("\n\tDo you want to continue? (Y/N) ");
        scanf(" %c", &c);
        switch(c) {
	  case 'y':
	  case 'Y':
	    y=1;
	    break;
	  case 'n':
	  case 'N':
	    y=0;
	    break;
	  default:
	    printf("\tOption not recognised. Try again...");
	    y=2;
	    break;
	}
      } while (y==2);
      i+=1;
    }while(y==1);
    
    clearScreen();
    printf("\n\tYour total earnings were %i", totals);
    printf("\n\tIt will be saved to scores.txt");
    
    fprintf(fp, "\n%s --- %i", name, totals);
    fclose(fp);
    
    printf("\n\tThank you for playing!");
    printf("\n\n\n\tPress Enter to exit...\n\n");
    getchar();
    getchar();
    
    return;
}