Exemplo n.º 1
0
void executeMenu(ALLEGRO_DISPLAY* _display)
{
    display = _display;
    initMenu();
    menuLoop(display);
    shutdownMenu();
}
Exemplo n.º 2
0
int Credits::quit() {
    Menu menu;
    menu.create(mEngine);    // creates menu overlay

    MenuLoop menuLoop(mEngine);
    menuLoop.run();

    return 0;
}
Exemplo n.º 3
0
int main(void)
{
    int input  = 0, try = 0;
    
    try = 1;
    input = getUserInput(try);
    
    menuLoop(input);
    
    return 0;
}
Exemplo n.º 4
0
Arquivo: mis.c Projeto: zxwbj/danei
int onLogin (void) {
	USER userLog;
	printf ("用户名:");
	scanf ("%s", userLog.name);
	printf ("密码:");
	scanf ("%s", userLog.passwd);

	int fd = open (USER_FILE, O_RDONLY | O_CREAT, 0644);
	if (fd == -1) {
		perror ("open");
		return -1;
	}

	USER userOld;
	ssize_t bytes;

	while ((bytes = read (fd, &userOld, sizeof (userOld))) > 0)
		if (! strcmp (userOld.name, userLog.name)) {
			if (strcmp (userOld.passwd, userLog.passwd)) {
				printf ("密码错误,登录失败!\n");
				close (fd);
				return 0;
			}
			else
				break;
		}

	if (bytes == -1) {
		perror ("read");
		close (fd);
		return -1;
	}

	if (bytes == 0) {
		printf ("用户名错误,登录失败!\n");
		close (fd);
		return 0;
	}

	close (fd);

	ONMENU onMenu[] = {onLogout, onAdd, onDel, onBrowse};
	menuLoop (menuStudent, onMenu, sizeof (onMenu) / sizeof (onMenu[0]));

	return 0;
}
Exemplo n.º 5
0
int main()
{
	sdcard_Init();
	initVGA();
	initAnonProfile();
	brickmap = malloc(sizeof(BrickMap));
	currentLevel->paddle = malloc(sizeof(Paddle));
	currentLevel->buff=malloc(sizeof(Buff));
	int i,j;
	for(i=0;i<maxBalls;i++)
		currentLevel->ball[i] = malloc(sizeof(Ball));

	for(i=0;i<maxRows;i++)
		for(j=0;j<bricksPerRow;j++)
			currentLevel->bricks[i][j]=malloc(sizeof(Brick));


	level=1;


	//pre load the root menu
	getMenu(&currentMenu,rootMenu, 1);

	//allocate memory for level farm


	//set the game to playing
	prevState=currentState=Playing;


	//look up the level from level farm and load it into currentLevel
	levelLookUp(brickmap,level);
	initLevel(*brickmap);
	drawStart(currentLevel);   //this is optional here
	swapBuffers();
	drawStart(currentLevel);

	runCountDown();              //count down from three
	initInterrupt();            //start the game (we dont need to right off the bat (probably shouldnt)

	int counter=0;   //so were not doing direct IO reads on EVERY iteration (we could timer this buttttt no)
	while(1)
	{
		//input to state machine
		counter++;
		if(counter>22000)
		{
			counter=0;
			if(getMenuPB())
			{
				while(getMenuPB() != 0);
				if(currentState == Playing)
					changeState(MenuShow);
			}
		}
		//flicker changes
		if(prevState != currentState)
		{
			if(currentState == Playing)
			{
				clearScreen();
				drawStart(currentLevel);   //this is optional here
				swapBuffers();
				drawStart(currentLevel);
				runCountDown();
				initInterrupt();
			}else
			{
				stopInterrupt();
				getMenu(&currentMenu,rootMenu, 1);
				clearScreen();
				drawStart(currentLevel);   //this is optional here
				swapBuffers();
				drawStart(currentLevel);
				drawMenu(currentMenu);
			}
			prevState = currentState;
		}
		//state machine
		if(currentState == MenuShow)
		{
			menuLoop();
		}else //while were playing we will have to check for other things (all balls gone etc.)
		{
			if(currentLevel->brickCount<=0)
			{
				printf("starting new level \n");
				stopInterrupt();
				level++;
				levelLookUp(brickmap,level);
				initLevel(*brickmap);
				prevState= currentState - 1;
				currentState = Playing;
				printf("finished starting new level \n");
			}
		}
	}
	return 0;
}
Exemplo n.º 6
0
void menuRefresh()
{
	keys |= KEY_REFRESH;
	menuLoop();
}
Exemplo n.º 7
0
Arquivo: mis.c Projeto: zxwbj/danei
int main (void) {
	ONMENU onMenu[] = {onQuit, onRegister, onLogin};
	menuLoop (menuLogin, onMenu, sizeof (onMenu) / sizeof (onMenu[0]));
	return 0;
}