Exemple #1
0
int main ()
{
	InitCurses();

	Menu *Faculty = new Menu("");
	Menu *Departments = new Menu("Departments>");
	Menu *Groups = new Menu("Groups>");

	Menu *TeachersSS = new Menu("Solid-state>");
	Menu *TeachersIT = new Menu("IT-technology>");

	Menu *Students312 = new Menu("21312>");
	Menu *Students313 = new Menu("21313>");
	Menu *Students318 = new Menu("21318>");
	Menu *Students314 = new Menu("21314>");

	TeachersSS->Add(new MenuItem("Klimon Igor Viktorovich", 0));
	TeachersSS->Add(new MenuItem("Boriskov", 0));
	TeachersSS->Add(new MenuItem("Sysun", 0));

	TeachersIT->Add(new MenuItem("Pikulev Vitaly Borisovich", 0));
	TeachersIT->Add(new MenuItem("Kogochev", 0));

	Students312->Add(new MenuItem("Okhotnikov Viktor",0));
	Students312->Add(new MenuItem("Philipov Egor",0));
	Students312->Add(new MenuItem("DV:company",0));
	Students312->Add(new MenuItem("Kazakov Artem",0));
	Students312->Add(new MenuItem("Efimov Georgii",0));

	Students313->Add(new MenuItem("Kuzin Konstantin",0));
	Students313->Add(new MenuItem("Elena Mackovich",0));

	Students318->Add(new MenuItem("Elena Geveiler",0));
	Students318->Add(new MenuItem("Alina Danilova",0));

	Students314->Add(new MenuItem("Rahman",0));

	Departments->Add(TeachersSS);
	Departments->Add(TeachersIT);

	Groups->Add(Students312);
	Groups->Add(Students313);
	Groups->Add(Students318);
	Groups->Add(Students314);

	Faculty->Add(Departments);
	Faculty->Add(Groups);

	StartControl(Faculty);

	delete Faculty;

	QuitCurses();

	return 0;
}
Exemple #2
0
int main(int argc, char *argv[100]) {

	int j = 0;
	srand( (unsigned)time( NULL ) );

	InitCurses();
	CheckScreenSize();
	CreateWindows(29, 28, 1, 1);

	//If they specified a level to load
	if((argc > 1) && (strlen(argv[1]) > 1)) {
		argv[1][99] = '\0';
		LoadLevel(argv[1]);
		MainLoop();
	}
        
	//If not, display intro screen then use default levels
	else {
		//Show intro "movie"
		IntroScreen();

		j = 1;
		//They want to start at a level 1-9
		if(argc > 1)
			for(LevelNumber = '1'; LevelNumber <= '9'; LevelNumber++)
				if(LevelNumber == argv[1][0]) j = LevelNumber - '0';

		//Load 9 levels, 1 by 1, if you can beat all 9 levels in a row, you're awesome
		for(LevelNumber = j; LevelNumber < 10; LevelNumber++) {
                        LevelFile[strlen(LevelFile) - 6] = '0';
			LevelFile[strlen(LevelFile) - 5] = LevelNumber + '0';
			LoadLevel(LevelFile);
			Invincible = 0;			//Reset invincibility
			MainLoop();
		}

	}

	ExitProgram("Good bye!");
}
Exemple #3
0
int main (int argc, char *argv[]) {
#ifdef SIGWINCH
	struct sigaction act;
#endif

	int autoupdate = 0;		/* Automatically update feeds on app start... or not if set to 0. */
	int numfeeds;			/* Number of feeds loaded from Config(). */
	int i = 0;	
	char *arg;
	char *foo;
	
#ifdef LOCALEPATH
	setlocale (LC_ALL, "");
	bindtextdomain ("snownews", LOCALEPATH);
	textdomain ("snownews");
#endif
	
	if (argc > 1) {
		i = 1;
		while (i < argc) {
			arg = argv[i];
			if (strcmp(arg, "--version") == 0 || strcmp(arg, "-V") == 0) {
				printf (_("Snownews version %s\n\n"), VERSION);
				return 0;
			} else if (strcmp(arg, "-u") == 0 || strcmp(arg, "--update") == 0) {
				autoupdate = 1;
				i++;
				continue;
			} else if (strcmp(arg, "-c") == 0 || strcmp(arg, "--cursor-on") == 0) {
				cursor_always_visible = 1;
				i++;
				continue;
			} else if (strcmp(arg, "-l") == 0 || strcmp(arg, "--charset") == 0) {
				foo = argv[i+1];
				if (foo) {
					forced_target_charset = foo;
					i += 2;
				} else {
					badOption(arg);
					exit(1);
				}
				continue;
			} else if (strcmp(arg, "-h") == 0 || strcmp(arg, "--help") == 0) {
				printHelp();
				return 0;
			} else {
				printf ("Unkown option given: \"%s\".\n", arg);
				printHelp();
				return 0;
			}
		}
	}
	
	checkPIDFile();
	
	/* Create PID file. */
	modifyPIDFile(pid_file_create);

	signal (SIGHUP, MainSignalHandler);
	signal (SIGINT, MainSignalHandler);
	signal (SIGTERM, MainSignalHandler);
	
	/* Un-broken pipify */
	signal (SIGPIPE, SIG_IGN);
	
	signal (SIGCHLD, sigChildHandler);
	
#ifdef SIGWINCH
	/* Set up SIGWINCH handler */
	sigemptyset(&act.sa_mask);
	act.sa_flags = 0;
	act.sa_handler = sig_winch;
	sigaction(SIGWINCH, &act, NULL);
#endif

	InitCurses();
	
	/* Check if configfiles exist and create/read them. */
	numfeeds = Config();
			
	LoadAllFeeds (numfeeds);

	if (autoupdate)
		UpdateAllFeeds();
	
	/* Init the pRNG. See about.c for usages of rand() ;) */
	srand(time(0));
	
	/* Give control to main program loop. */
	UIMainInterface();

	/* We really shouldn't be here at all... ah well. */
	MainQuit(NULL, NULL);
	return 0;
}
void HandleScreen(int _msqid)
{
     int msqid = _msqid;
     int width, height;
     int curx = 0, cury = 0;
     textmsg msg;

     InitCurses();

     pthread_mutex_lock(&count_mutex);
     pthread_cond_signal(&count_threshold_cv);
     pthread_mutex_unlock(&count_mutex);

     getmaxyx(stdscr, height, width);

     class CursesWindow inputWin, tmpWin;

     inputWin.set(InitializeScreen(0, (height/2), width, height/2, false));

     tmpWin.set(InitializeScreen(0, 0, width, height/2, true));
     class CursesListWindow outputWin(tmpWin);


     while(true) {
          if (msgrcv(msqid, &msg, sizeof(msg) - sizeof(long), TYPE_QUIT, IPC_NOWAIT) == -1) {
               if (msgrcv(msqid, &msg, sizeof(msg) - sizeof(long), TYPE_MSG, IPC_NOWAIT) == -1) {
                    continue;
               }

               if (msg.mwindow == WINDOW_INPUT) {
                    if ((msg.mproperties & PROP_CLEAR) == PROP_CLEAR) {
                         inputWin.clear();
                    }

                    if((msg.mproperties & PROP_DEL) == PROP_DEL) {
                         inputWin.deleteChar();
                    } else {

                         if ((msg.mproperties & (PROP_TOP | PROP_BOTTOM)) == (PROP_TOP | PROP_BOTTOM)) {
                              continue;
                         } else if ((msg.mproperties & PROP_TOP) == PROP_TOP) {
                              inputWin.move(0, 1);
                         } else if ((msg.mproperties & PROP_BOTTOM) == PROP_BOTTOM) {
                              inputWin.move(0, inputWin.getHeight() - 1);
                         }

                         inputWin.stdWrite(msg.mtext);
                    }

                    getyx(inputWin.getWindow(), cury, curx);

                    inputWin.setCursorx(curx);
                    inputWin.setCursory(cury);

                    inputWin.refresh();

               } else if (msg.mwindow == WINDOW_OUTPUT) {

                    outputWin.clear();

                    outputWin.move(0, 0);

                    outputWin.stdWrite(msg.mtext);

                    getyx(outputWin.getWindow(), cury, curx);

                    outputWin.setCursorx(curx);
                    outputWin.setCursory(cury);

                    outputWin.drawBottomLine();

                    outputWin.refresh();
               }


          } else {
               break;
          }
     }

     // cleaning up
     endwin();
     pthread_exit(NULL);
}