示例#1
0
// main menu
void startMenu()
{
	int menuNum=0;
	char key;
	system("cls");
	setWindowSize();
	startImage();

	while(1)
	{
		Sleep(200);
		if(kbhit())
		{
			key=getch();
			if(key=='1'||key=='2'||key=='3')
				break;
		}
	}
	if(key=='1')
	{
		startGame();
		return;
	}
	else if (key=='2')
	{
		showRank();
		Sleep(2000);
		startMenu();
		return;
	}else if(key=='3')
		exit;
	
	return;
}
示例#2
0
void main(void) //using 0
{			   
	EA = 0;
	
	
	PLLCON&=PLLCON_VAL;//настройка частоты процессора
	
	RestoreCalibrate();
	RestoreSettings();
//	ChannelsInit();//инициализация настроек каналов
	Protocol_Init();	
	Timer1_Initialize(); //таймер шедулера 200Гц	
	ADC_Initialize();
	UART_Init();


	WDT_Init(WDT_2000);//включить сторожевой таймер

	PT_INIT(&pt_sort);

	startMenu();
	EA=1;


	while(1)
	{		
		ulongsort_process(&pt_sort);
		DisplayProcess(&pt_display);  
		WDT_Process(&pt_wdt);
		KeyboardProcess(&pt_keyboard);	    
	}
}
示例#3
0
void loopMenu(word table[])
{
        int choice = 0;
    while (choice < 49 || choice > 52)
    {
        choice = startMenu();
    }
    switch(choice)
    {
        case 49:
            fichier = fopen("word_database.txt", "a");
            if(fichier == NULL)
            {
                printf("[ERROR] Can't opening the file.\n");
                break;
            }
            encode(table);
            break;
        case 50:
            frenchToEnglish(table);
            break;
        case 51:
            break;
        case 52:
            break;
        default:
            printf("I knew that you're a stupid user but at this point it's very incredible !\n");
            break;
    }
    fclose(fichier);
}
示例#4
0
int main(void) {

        startMenu();
        help();
        GAME();

        return 0;
}
示例#5
0
文件: main.c 项目: psht410/LateMan
main( ) {
	// 출력 콘솔창의 크기를 가로 30, 세로 50 line 으로 설정한다.
	system( "mode con:cols=50 lines=30" );

	// 출력 콘솔창의 제목을 설정한다.
	system( "title 지각맨~Late Man~" );

	// GameManager.c 의 startMenu() 함수 호출.
	startMenu( );
}
示例#6
0
// gameMissionCheck
void gameOver(int level)
{
	char name[10];
	system("cls");
	gotoxy(35,15);
	printf("GameOver\n");
	Sleep(1000);
	writeRank(level);
	startMenu();
	return;
}
示例#7
0
文件: game.c 项目: Acknex/Wichtelwald
void backToMenu() {
	on_space = NULL;
	on_mouse_left = NULL;	
	endIngameGUI();
	stopSnow();
	wait(1);
	//error("loading menu");
	pssm_run(0);
	wait(1);
	level_load("menuLevel2.wmb");
	startMenu();
}
示例#8
0
//Display the game over menu
void displayGameOverMenu(Player *player)
{
    int userChoice;
    int flag = 0;
    int i = 0;

    system("cls");

    while(flag < 10){
        for(i = 0; i < 15; i++){
            Sleep(10);
            system("cls");
            color(i, 0);

            printf("#####################################\n");
            printf("############# GAME OVER #############\n");
            printf("#####################################\n");

            printf("\nYour score is -> %d\n", player->score);
            printf("Dungeon(s) done : %d\n", player->nbrDungeons);
            printf("You killed %d monster(s)...\n", player->nbrKills);
        }
        flag++;
    }

    if(player->life > 0){
        printf("\nYou still have %d life(s)\n", player->life);
        printf("Would you like to continue ?\n");
        printf("1 : yes\n2 : No\n");
        userChoice = userInputInt();

        switch(userChoice){
            case 1:
                player->life--;
                player->health = player->maxHP;
                player->gold = 0;
                setPotionAtStart(player);
                displayMainMenu(player);
                break;
            default:
                break;
        }
    }
    printf("You are dead, you finished the game with :\n");
    printf("Score -> %d\n", player->score);
    printf("Kills -> %d\n", player->nbrKills);
    printf("Dungeon(s) -> %d\n", player->nbrDungeons);
    printf("Try to do better next time...\n");
    Sleep(5000);
    startMenu();
}
示例#9
0
void MenuHandler( void *pvParameters )
{
	unsigned int key;
	unsigned char str[20]="";
    LCD_INIT ();
    startMenu();
    while(1)
    {
        if( xKeySemaphore != NULL )
        {

            if( xSemaphoreTake( xKeySemaphore, ( portTickType ) 10 ) == pdTRUE )
            {
            	if( xKeyQueue != 0 )
            	 {
					 if( xQueueReceive( xKeyQueue, &( key ), ( portTickType ) 10 ) )
					 {
						 sprintf(&str,"%i",key);
						// LCD_STRING (&str);
						 if((key&GPIO_Pin_10)==0)
						 {

							 Menu_Previous();
						 }

						 if((key&GPIO_Pin_11)==0)
						 {
							 Menu_Next();
						 }

						 if((key&GPIO_Pin_12)==0)
						 {
							 Menu_Child();
						 }

						 if((key&GPIO_Pin_0)==1)
						 {
							 Menu_Parent();
						 }
					 }
            	 }
            }
            else
            {

            }
        }

    	vTaskDelay(10);
    }
}
示例#10
0
//Main menu in town
void displayMainMenu(Player *player)
{
    int userChoice = 0;

    system("cls");
    color(10, 0);

    printf("<< IN TOWN >>\n\n");
    printf("----------------------------------\n");
    printf("Here are all the things you can do :\n");
    printf("--------------------------------------\n\n");
    color(11, 0);
    printf("1 - Empty an infested Dungeon\n");
    color(14, 0);
    printf("2 - Go to the tavern if you want to buy new stuff or potions\n");
    color(15, 0);
    printf("3 - Display player menu\n");
    color(12, 0);
    printf("4 - Save and quit\n");
    color(15, 0);

    while(1){
        userChoice = userInputInt();

        switch(userChoice){
            case 1:
                goThroughDungeon(player);
                break;
            case 2:
                goToTavern(player);
                break;
            case 3:
                menu_player(player, 0);
                break;
            case 4:
                saveYourGame(player);
                startMenu();
                break;
            default:
                printf("Please enter a correct entry !\n");
                Sleep(1500);
                displayMainMenu(player);
                break;
        }
    }
}
示例#11
0
//First menu where you can start or load
int startMenu()
{
    Player* newPlayer;
    int userChoice = 0;

    system("cls");
    color(12, 0);

    printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
    printf("~~~                                                   ~~~\n");
    printf("~~~        ***       LOST IN A DUNGEON      ***       ~~~\n");
    printf("~~~                         BY                        ~~~\n");
    printf("~~~                    --- EX@W ---                   ~~~\n");
    printf("~~~                                                   ~~~\n");
    printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");

    color(15, 0);

    printf("\n\n");
    printf("Would you like to continue a story or start a new one? \n");
    printf("-------------------------------------------------------\n");
    printf("1 : New Game\n");
    printf("2 : Load Game\n\n");
    printf("Press enter to exit the game...\n");

    userChoice = userInputInt();

    switch(userChoice){
        case 1:
            startNewGame();
            break;
        case 2:
            newPlayer = loadYourGame();
            displayMainMenu(newPlayer);
            break;
        case 0:
            exit (0);
        default:
            printf("Please enter a correct entry...\n");
            Sleep(2000);
            startMenu();
            break;
    }
    return (0);
}
示例#12
0
int main()
{
	srand(time(0));
	ResourceHolder<sf::Font, Fonts::ID> fonts;
	ResourceHolder<sf::Texture, Textures::ID> textures;
	//ResourceHolder<sf::SoundBuffer, Sounds::ID> sounds;
	try
	{
		fonts.load(Fonts::WhiteRabbit, "Assets/whiterabbit.ttf");
		textures.load(Textures::Buttons, "Assets/buttons.png");
		textures.load(Textures::Timtam, "Assets/cmcquiz.png");
	}
	catch(std::runtime_error &e)
	{
		//would be better off using a log file for release code.
		return 1;
	}

	Window mainWindow(sf::Vector2f(800, 600), "Soft Eng Game");

	
	Button mainPlayButton(textures.get(Textures::Buttons), sf::Vector2f(250,  75), sf::Vector2f(25, 500),
		sf::IntRect(0, 0, 250, 75), sf::IntRect(0, 75, 250,  75));
	Button mainQuitButton(textures.get(Textures::Buttons), sf::Vector2f(250,  75), sf::Vector2f(525, 500),
		sf::IntRect(0, 150, 250, 75), sf::IntRect(0, 225, 250,  75));

	//QuizSelect stuff
	Button quizMenuContinue(textures.get(Textures::Buttons), sf::Vector2f(250, 75), sf::Vector2f(250, 500),
		sf::IntRect(0, 300, 250, 75), sf::IntRect(0, 375, 250, 75));

	sf::Text selectQuiz("Select Quiz", fonts.get(Fonts::WhiteRabbit), 24);
	selectQuiz.setPosition(150, 150);
	sf::Text selectTime("Select Time", fonts.get(Fonts::WhiteRabbit), 24);
	selectTime.setPosition(500, 150);

	std::vector<QuestionButton> quizButtons;
	std::vector<std::string> quizFilenames;
	Util::getFilenamesInDir(quizFilenames, "Quizes");
	for(int i = 0; i < quizFilenames.size(); i++)
	{
		quizButtons.push_back(QuestionButton(quizFilenames[i], fonts.get(Fonts::WhiteRabbit), 24, sf::Vector2f(200, 100), sf::Vector2f(100, 200 +( i * 100)), sf::Color(116, 40, 148, 255), sf::Color(181, 103, 214, 255)));
	}

	std::vector<QuestionButton> timerButtons;
	timerButtons.push_back(QuestionButton("15", fonts.get(Fonts::WhiteRabbit), 48, sf::Vector2f(200, 100), sf::Vector2f(500, 200), sf::Color(116, 40, 148, 255), sf::Color(181, 103, 214, 255)));
	timerButtons.push_back(QuestionButton("25", fonts.get(Fonts::WhiteRabbit), 48, sf::Vector2f(200, 100), sf::Vector2f(500, 300), sf::Color(116, 40, 148, 255), sf::Color(181, 103, 214, 255)));
	timerButtons.push_back(QuestionButton("35", fonts.get(Fonts::WhiteRabbit), 48, sf::Vector2f(200, 100), sf::Vector2f(500, 400), sf::Color(116, 40, 148, 255), sf::Color(181, 103, 214, 255)));

	//EndMenu Stuff
	Button endRetry(textures.get(Textures::Buttons), sf::Vector2f(250, 75), sf::Vector2f(25, 500),
		sf::IntRect(0, 450, 250, 75), sf::IntRect(0, 525, 250, 75)); 
	Button endQuit(textures.get(Textures::Buttons), sf::Vector2f(250,  75), sf::Vector2f(525, 500),
		sf::IntRect(0, 150, 250, 75), sf::IntRect(0, 225, 250,  75));

	sf::Vector2f endLogoPos(100, 0);

	std::vector<QuestionButton> endAnswers;
	endAnswers.push_back(QuestionButton("", fonts.get(Fonts::WhiteRabbit), 24, sf::Vector2f(640, 120), sf::Vector2f(80, 120), sf::Color(116, 40, 148, 255), sf::Color(116, 40, 148, 255)));
	endAnswers.push_back(QuestionButton("", fonts.get(Fonts::WhiteRabbit), 24, sf::Vector2f(640, 120), sf::Vector2f(80, 250), sf::Color::Green, sf::Color::Green));
	endAnswers.push_back(QuestionButton("", fonts.get(Fonts::WhiteRabbit), 24, sf::Vector2f(640, 120), sf::Vector2f(80, 380), sf::Color::Red, sf::Color::Red));

	
	


	//MAIN MENU
	Menu startMenu(mainWindow.getWindow(), mainPlayButton, mainQuitButton, 10, 20, 15, 45, textures.get(Textures::Timtam),
		sf::Vector2f(75, 200));
		

	bool play = startMenu.run();
	
	
	while(play)
	{
		play = false;
		//quiz reader, gets a list of quizes from a dir and displays them.
		//pick one and return with that number.

		//pick a filename / quiz file.
		std::string quizFile;

		//QUIZ CHOICE AND TIMER MENU
		QuizMenu quizMenu(mainWindow.getWindow(), quizMenuContinue, selectQuiz, selectTime, quizButtons, timerButtons, 
			textures.get(Textures::Timtam), sf::Vector2f(100, 0));

		int timeToAns = 0;
		timeToAns = quizMenu.run(quizFile);
		//use the quiz at that index.

		if(timeToAns == 15 || timeToAns == 25 || timeToAns == 35)
		{
			//get the list of Q's
			Quiz quiz = Util::getQuiz("Quizes/" + quizFile, timeToAns);

			std::vector<QuestionButton> questionButtons;
			questionButtons.push_back(QuestionButton("", fonts.get(Fonts::WhiteRabbit), 18, sf::Vector2f(640, 120), sf::Vector2f(80, 210), sf::Color(116, 40, 148, 255), sf::Color(116, 40, 148, 255)));
			questionButtons.push_back(QuestionButton("", fonts.get(Fonts::WhiteRabbit), 18, sf::Vector2f(300, 120), sf::Vector2f(80, 340), sf::Color(116, 40, 148, 255), sf::Color(181, 103, 214, 255)));
			questionButtons.push_back(QuestionButton("", fonts.get(Fonts::WhiteRabbit), 18, sf::Vector2f(300, 120), sf::Vector2f(80, 470), sf::Color(116, 40, 148, 255), sf::Color(181, 103, 214, 255)));
			questionButtons.push_back(QuestionButton("", fonts.get(Fonts::WhiteRabbit), 18, sf::Vector2f(300, 120), sf::Vector2f(420, 340), sf::Color(116, 40, 148, 255), sf::Color(181, 103, 214, 255)));
			questionButtons.push_back(QuestionButton("", fonts.get(Fonts::WhiteRabbit), 18, sf::Vector2f(300, 120), sf::Vector2f(420, 470), sf::Color(116, 40, 148, 255), sf::Color(181, 103, 214, 255)));

			std::vector<AnswerCombo> answers;


		
			Game game(&mainWindow.getWindow(), quiz, questionButtons, 
				sf::Sprite(textures.get(Textures::Timtam), 
				sf::IntRect(0, 0, textures.get(Textures::Timtam).getSize().x, textures.get(Textures::Timtam).getSize().y)),
				fonts.get(Fonts::WhiteRabbit),
				32,
				sf::Color::Black);
			answers = game.run();

			if(answers.size() > 0)
			{
				//takes in answers.
				EndMenu endMenu(&mainWindow.getWindow(), endRetry, endQuit, textures.get(Textures::Timtam), endLogoPos,
					answers, endAnswers);
				play = endMenu.run();
			}
		}
	}
	

	return 0;
}
示例#13
0
//Starting block of the program
int main(int argc, char *argv[])
{
    startMenu();

    return(0);
}
示例#14
0
int main(int argc, char *argv[])
{
    pthread_t recvThread;
    srand(time(NULL));
    GameState gamestate;
    SDL_Window *window=NULL;                    // Declare a window
    SDL_Renderer *renderer=NULL;                // Declare a renderer
    Entity tempEntity;

    SDL_Init(SDL_INIT_EVERYTHING);              // Initialize SDL2
    //srandom((int)time(NULL));


  //Create an application window with the following settings:
    window = SDL_CreateWindow("Game Window",                     // window title
                            SDL_WINDOWPOS_UNDEFINED,           // initial x position
                            SDL_WINDOWPOS_UNDEFINED,           // initial y position
                            SCREEN_WIDTH,                               // width, in pixels
                            SCREEN_HEIGHT,                               // height, in pixels
                            0                                  // flags
                            );
    renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
    gamestate.renderer=renderer;

    SDL_Rect cameraScene= {0,0,SCREEN_WIDTH,SCREEN_HEIGHT};

    gamestate.nrOfAi=0;
    loadMedia(&gamestate); ///load images to textures

  // The window is open: enter program loop (see SDL_PollEvent)

    /**Event loop*/

    int done = 0; // NEDANSTÅENDE SKA BLI EN FUNKTION SOM LIGGER I GAMENET

 // TODO GÖR 96x96

    for(int i = 0;i<100;i++) // initializera ai token listan
        gamestate.aiEntityToken[i]=0;

  //Event loop
  while(1){
  for(int i = 0;i<100;i++) // initializera ai token listan
        gamestate.aiEntityToken[i]=0;
    threadJoinQuerry = 0;
    startMenu(renderer,&gamestate);
    gamestate.castle=createEntity(&tempEntity,896,508,96,96,500.0);
    while(!done) ///main game loop
    {
        for(int i=0;i<maxPlayers;i++){
            if(gamestate.playerEntityToken[i]!=0){
                gamestate.playerEntity[i].mPosX=getAIPositionX(&gamestate.playerEntity[i]); /// get last mainplayers position
                gamestate.playerEntity[i].mPosY=getAIPositionY(&gamestate.playerEntity[i]);
                //coPlayerControll(&gamestate.playerEntity[i]);
            }
        }
        for(int i=0;i<=highestId;i++){
            if(gamestate.aiEntityToken[i]!=0){
                if(gamestate.AiEntity[i].hpData.currentHp <= 0){
                    gamestate.aiEntityToken[i] = 0;
                }
            }
        }
        for(int i=0;i<=highestId;i++){
            gamestate.AiEntity[i].mPosX=getAIPositionX(&gamestate.AiEntity[i]); ///AI data
            gamestate.AiEntity[i].mPosY=getAIPositionY(&gamestate.AiEntity[i]);
            AITTick(&gamestate.AiEntity[i]); /// AI changes position and checks collision
            if(gamestate.aiEntityToken[i]!=0){
                if(checkIFObjectHit(&gamestate.playerEntity[gamestate.mySlot].attack, &gamestate.AiEntity[i].object.rect)){//Kollar om spelarens attack kolliderar med AIn
                    giveDamage(&gamestate,i);
                    resetAttack(&gamestate.playerEntity[gamestate.mySlot].attack);
                }
            }
        }

        done = processEvents(window, &gamestate);

        cameraScene.x=(getmPosX(&gamestate.playerEntity[gamestate.mySlot])+ 20/2)-SCREEN_WIDTH/2;
        cameraScene.y=(getmPosY(&gamestate.playerEntity[gamestate.mySlot])+20/2)-SCREEN_HEIGHT/2;
        if( cameraScene.x < 0 )   /// cameraScren follows main player
        {
            cameraScene.x = 0;
        }
        if( cameraScene.y < 0 )
        {
            cameraScene.y = 0;
        }
        if( cameraScene.x > LEVEL_WIDTH - cameraScene.w )
        {
            cameraScene.x = LEVEL_WIDTH - cameraScene.w;
        }
        if( cameraScene.y > LEVEL_HEIGHT - cameraScene.h )
        {
            cameraScene.y = LEVEL_HEIGHT - cameraScene.h;
        }

    //Render display
        doRender(renderer, &gamestate,cameraScene); /// renderer Ai , players and  map

    //don't burn up the CPU
        //SDL_Delay(10);

       ///***************if players position x,y changes -> send to server***********///
       if(getmPosX(&gamestate.playerEntity[gamestate.mySlot])!=gamestate.playerEntity[gamestate.mySlot].mPosX || getmPosY(&gamestate.playerEntity[gamestate.mySlot])!=gamestate.playerEntity[gamestate.mySlot].mPosY){
            printf("Attempting to update player movement\n");
            updatePlayerMovement(&gamestate);
        }
        ///*******'LOSS CONDITION*****////
        if(gamestate.castle.hpData.currentHp<=0){
            done=1;
        }
    }
    //TODO Rensa upp alla textures osv
    threadJoinQuerry = 1;
    pthread_join(recvThread,NULL);
    SDLNet_TCP_Close(gamestate.socket);
    lossMenu(renderer);
}
  // Close and destroy the window
    SDL_DestroyTexture(gamestate.gTileTexture.mTexture);

    SDL_DestroyTexture(gamestate.mAiTexture);

    SDL_DestroyTexture(gamestate.playerEntity[0].object.mTexture); ///clear Textures
    SDL_DestroyTexture(gamestate.playerEntity[1].object.mTexture);

    SDL_DestroyWindow(window);
    SDL_DestroyRenderer(renderer);

    // Clean up
    SDL_Quit();
    //pthread_join(recvThread,NULL);
  //  close(gamestate.socket);

    return 0;
}
示例#15
0
文件: main.c 项目: Acknex/Wichtelwald
void main() {
	sysInit();
	wait(1);
	level_load("menuLevel2.wmb");
	startMenu();
}
示例#16
0
void llm::Menu::desactive() {
	startMenu( false );
	pauseMenu( false );
}
示例#17
0
//------------------------------------------------------------------------------ 
// run 
//------------------------------------------------------------------------------ 
// Uppgift: Funktion som startar igång programmet genom att visa upp menyn.
// Indata : (void)
// Utdata : (void)
//------------------------------------------------------------------------------
void TestApp::run() {
	startMenu();
}
示例#18
0
void createMenu()
{
	startMenu();
	{
		startSubMenu("View");
		{
			startSubMenu("Presets");
			{
				for (int i = 0; i < PRESET_COUNT; ++i)
				{
					createMenuEntry(getPresetName(i), setPreset, i);
				}
			}
			endSubMenu();
			startSubMenu("Screen Layout");
			{
				createMenuEntry("Side by Side", setScreenLayout, (int)SIDE_BY_SIDE);
				createMenuEntry("Overlay", setScreenLayout, (int)OVERLAY);
			}
			endSubMenu();
			startSubMenu("Depth");
			{
				for (int i = 0; i < NUM_OF_DEPTH_TYPES; ++i)
				{
					createMenuEntry(g_DepthColoring[i], setDepthDrawing, i);
				}
			}
			endSubMenu();
			startSubMenu("Image");
			{
				for (int i = 0; i < NUM_OF_IMAGE_TYPES; ++i)
				{
					createMenuEntry(g_ImageColoring[i], setImageDrawing, i);
				}
			}
			endSubMenu();
			createMenuEntry("Pointer Mode On/Off", togglePointerMode, 0);
			createMenuEntry("Show/Hide Background", toggleBackground, 0);
			createMenuEntry("Show/Hide Help Screen", toggleHelpScreen, 0);
		}
		endSubMenu();
		startSubMenu("Device");
		{
			startSubMenu("Streams");
			{
				startSubMenu("Depth");
				{
					createMenuEntry("On/Off", toggleDepthState, 0);
					startSubMenu("Registration");
					{
						for (int i = 0; i < g_Registration.nValuesCount; ++i)
						{
							unsigned int nValue = g_Registration.pValues[i];
							createMenuEntry(g_Registration.pValueToName[nValue], changeRegistration, nValue);
						}
					}
					endSubMenu();
					startSubMenu("Resolution");
					{
						createMenuEntry("QVGA", setDepthResolution, XN_RES_QVGA);
						createMenuEntry("VGA", setDepthResolution, XN_RES_VGA);
					}
					endSubMenu();
					startSubMenu("FPS");
					{
						createMenuEntry("25", setDepthFPS, 25);
						createMenuEntry("30", setDepthFPS, 30);
						createMenuEntry("60", setDepthFPS, 60);
					}
					endSubMenu();
					createMenuEntry("Reset Cropping", resetDepthCropping, 0);
				}
				endSubMenu();
				startSubMenu("Image");
				{
					createMenuEntry("On/Off", toggleImageState, 0);
					startSubMenu("Resolution");
					{
						createMenuEntry("QVGA", setImageResolution, XN_RES_QVGA);
						createMenuEntry("VGA", setImageResolution, XN_RES_VGA);
						createMenuEntry("SXGA", setImageResolution, XN_RES_SXGA);
						createMenuEntry("UXGA", setImageResolution, XN_RES_UXGA);
					}
					endSubMenu();
					startSubMenu("FPS");
					{
						createMenuEntry("25", setImageFPS, 25);
						createMenuEntry("30", setImageFPS, 30);
						createMenuEntry("60", setImageFPS, 60);
					}
					endSubMenu();
					createMenuEntry("Reset Cropping", resetImageCropping, 0);
				}
				endSubMenu();
				startSubMenu("IR");
				{
					createMenuEntry("On/Off", toggleIRState, 0);
					startSubMenu("Resolution");
					{
						createMenuEntry("QVGA", setIRResolution, XN_RES_QVGA);
						createMenuEntry("VGA", setIRResolution, XN_RES_VGA);
						createMenuEntry("SXGA", setIRResolution, XN_RES_SXGA);
					}
					endSubMenu();
					startSubMenu("FPS");
					{
						createMenuEntry("25", setIRFPS, 25);
						createMenuEntry("30", setIRFPS, 30);
						createMenuEntry("60", setIRFPS, 60);
					}
					endSubMenu();
					createMenuEntry("Reset Cropping", resetIRCropping, 0);
				}
				endSubMenu();
				startSubMenu("Primary Stream");
				{
					for (int i = 0; i < g_PrimaryStream.nValuesCount; ++i)
					{
						createMenuEntry(g_PrimaryStream.pValues[i], changePrimaryStream, i);
					}
				}
				endSubMenu();
			}
			endSubMenu();
            
			createMenuEntry("Mirror", toggleMirror, 0);
		}
		endSubMenu();
		startSubMenu("Capture");
		{
			startSubMenu("Depth Format");
			{
				for (int i = 0; i < g_DepthFormat.nValuesCount; ++i)
				{
					unsigned int nValue = g_DepthFormat.pValues[i];
					createMenuEntry(g_DepthFormat.pIndexToName[i], captureSetDepthFormat, nValue);
				}
			}
			endSubMenu();
			startSubMenu("Image Format");
			{
				for (int i = 0; i < g_ImageFormat.nValuesCount; ++i)
				{
					unsigned int nValue = g_ImageFormat.pValues[i];
					createMenuEntry(g_ImageFormat.pIndexToName[i], captureSetImageFormat, nValue);
				}
			}
			endSubMenu();
			startSubMenu("IR Format");
			{
				for (int i = 0; i < g_IRFormat.nValuesCount; ++i)
				{
					unsigned int nValue = g_IRFormat.pValues[i];
					createMenuEntry(g_IRFormat.pIndexToName[i], captureSetIRFormat, nValue);
				}
			}
			endSubMenu();
			createMenuEntry("Browse", captureBrowse, 0);
			createMenuEntry("Start", captureStart, 0);
			createMenuEntry("Start (5 sec delay)", captureStart, 5);
			createMenuEntry("Restart", captureRestart, 0);
			createMenuEntry("Stop", captureStop, 0);
		}
		endSubMenu();
		startSubMenu("Statistics");
		{
			createMenuEntry("Start Collecting", statisticsStart, 0);
			createMenuEntry("Stop Collecting", statisticsStop, 0);
			createMenuEntry("Clear", statisticsClear, 0);
		}
		endSubMenu();
		startSubMenu("Player");
		{
			createMenuEntry("Pause/Resume", togglePause, 0);
			createMenuEntry("Skip 1 frame forward", seek, 1);
			createMenuEntry("Skip 10 frame forward", seek, 10);
			createMenuEntry("Skip 1 frame backwards", seek, -1);
			createMenuEntry("Skip 10 frame backwards", seek, -10);
		}
		endSubMenu();
		createMenuEntry("Quit", closeSample, ERR_OK);
	}
	endMenu();
}
void Main(){
	//I don't know why,but the compiler of ADS1.2 never invoke the 
	// constructor of global struct and class.....
 	// So, I have to move these global variables to stack.
 	// And initialize the EStyle here.....
	EG_DefaultStyle.m_cTextColor=EColor(30,30,30);
	EG_DefaultStyle.m_cFrameColor=EColor(100,150,200);
	EG_DefaultStyle.m_cContentColor=EColor(120,100,200);
	EG_DefaultStyle.m_cBackgroundColor=EColor(230,230,230);
	EG_DefaultStyle.m_cSelectColor=EColor(100,200,100);
	#ifdef EG_RICH_STYLE
	EG_DefaultStyle.m_fFont=EFont(1,1);
	#endif //EG_RICH_STYLE
	prog=0;	
	timerScale=0;
	
	EDesktop desk;
	EWindow introWin("EGUI Guide\0",EPosition(0,0),ESize(127,63),true);
	EWindow secWin("Fun\0",EPosition(50,100),ESize(200,103),true);
	ELabel labelCtrl(EPosition(4,25),"Example of EGUI\0",16*8);
	EButton nextButn(NULL,EPosition(35,40),"Next>>\0",6*8);
	EIconButton icon(desktopIconCallback,EPosition(200,30),ESize(50,50),3,"Help!\0",false);
	EMenu startMenu("Start\0",50,EPosition(0,0),true);
	EMenu::EMenuItem startItem1,startItem2,startItem3;
	EPopupMenu popMenu;
	EPopupMenu::EPopupMenuItem popItem1,popItem2,popItem3;
	EEvent event;
	EButton progressButn(progressBtnCallback,EPosition(200,126),"+\0",12);
	EEdit editCtrl("a\0",false,EPosition(80,155),100);
	EProgress progress(0,EPosition(65,126),ESize(116,17));
	pglbProgress=&progress;
	pDesktop=&desk;
	
	EG_LCDInit();
	// Clear the buffer, set the buffer to 0
	EG_LCDClearBuffer();
	//GUI variable init...
	introWin.AddControl(&labelCtrl);
	introWin.AddControl(&nextButn);
	secWin.AddControl(&progress);
	secWin.AddControl(&progressButn);
	secWin.AddControl(&editCtrl);
	desk.AddWindow(&introWin);
	desk.AddWindow(&secWin);
	desk.AddIconButton(&icon);
	desk.AppendStartMenu(&startMenu);
	desk.AppendPopupMenu(&popMenu);
	startMenu.RemovedAllItems();
	#ifdef EG_RICH_STYLE
	//make sure pIcon =0 when you add the items
	startItem1.m_piIcon=NULL;
	startItem2.m_piIcon=NULL;
	startItem3.m_piIcon=NULL;
	#endif //EG_RICH_STYLE
	startItem1.m_pcLabel[0]='\0';
	startItem2.m_pcLabel[0]='\0';
	startItem3.m_pcLabel[0]='\0';
	startMenu.AddItem(&startItem1);
	startMenu.AddItem(&startItem2);
	startMenu.AddItem(&startItem3);
	startMenu.SetMenuItem(0,"Menu1\0",0,menu1Callback);
	startMenu.SetMenuItem(1,"Menu2\0",0,menu2Callback);
	startMenu.SetMenuItem(2,"Menu3\0",0,menu3Callback);
	#ifdef EG_RICH_STYLE
	//make sure pIcon =0 when you add the items
	popItem1.m_piIcon=NULL;
	popItem2.m_piIcon=NULL;
	popItem3.m_piIcon=NULL;
	#endif //EG_RICH_STYLE
	popItem1.m_pcLabel[0]='\0';
	popItem2.m_pcLabel[0]='\0';
	popItem3.m_pcLabel[0]='\0';
	popMenu.AddItem(&popItem1);
	popMenu.AddItem(&popItem2);
	popMenu.AddItem(&popItem3);
	popMenu.SetPopupMenuItem(0,"PopupMenu1\0",0,popmenu1Callback);
	popMenu.SetPopupMenuItem(1,"PopupMenu2\0",0,popmenu2Callback);
	popMenu.SetPopupMenuItem(2,"PopupMenu3\0",0,popmenu3Callback);
	
   	 // Global Redraw upon the buffer
	desk.GlobalRedraw();
	desk.SetCursorShape((unsigned char*)(&EG_DefaultCursorShape));
	//BSP_UART_SendCongestionString(0,"Desktop Global Redraw!\n\0");

	//labelCtrl.RedrawControl();
	//nextButn.RedrawControl();

	//EG_Graphic_DrawFilledRectangle(EPosition(12,23),ESize(50,80),EColor(0,255,0));
	//EG_Graphic_DrawString(EPosition(100,100),"red\0",EColor(255,0,0));
	//EG_Graphic_DrawString(EPosition(200,160),"blue\0",EColor(0,0,255));
	//EG_Graphic_DrawFilledCircle(EPosition(70,70),30,EColor(255,0,0));
	//EG_Graphic_DrawVerticalLine(EPosition(63,5),200,EColor(255,0,0));
	//EG_Graphic_DrawHorizonLine(EPosition(8,3),200,EColor(0,0,255));
	//EG_Graphic_DrawPoint(EPosition(100,100),EColor(255,0,0));
	//EG_Graphic_DrawPoint(EPosition(100,102),EColor(255,0,0));
	//EG_Graphic_DrawPoint(EPosition(102,100),EColor(255,0,0));
	//EG_Graphic_DrawPoint(EPosition(102,102),EColor(255,0,0));
	//EG_Graphic_DrawPoint(EPosition(104,100),EColor(255,0,0));
	//EG_Graphic_DrawPoint(EPosition(104,104),EColor(255,0,0));
	BSP_GPIO_Init(7,0x0000AAAA);
	BSP_UART_Init_HighCLK(0);
	
	BSP_ISR_Init();
	BSP_Timer_Init(2,0x0000FF00,0x00000000);
    	BSP_TimerSys_Init(0x0000F000);
    	BSP_Timer_InterruptInit(2);
	BSP_Timer_Start(2);
	BSP_TouchScreen_Init();
	BSP_TouchScreen_InterruptInit();
	
	while(1){
		if(EG_ReceiveEvent(&event)==0){
			desk.SetCursorEvent(&event);
		}
	}
}
示例#20
0
//////////////////////////////////////////////////////////////////////////////////////////////////
//<-------------- Program Function Start-------------->
// program main
void main(void)
{
	startMenu();

	return;
}
示例#21
0
// game Func
void coinMove(int x,int y,int speed,int level)
{
	int rightmove = 1;
	int leftmove = 0;
	int downline = 0;
	int dropheight =20;
	int gameCheck=1;
	double balance=41.5;
	double stackBalance=41.5;
	char key;
	YELLOW;
	while(1){
		if(rightmove==1)
		{
			gotoxy(x,y);
			printf("▥▥▥▥");
			Sleep(speed);
			x++;
			if(x==53)
			{
				rightmove=0;
				leftmove=1;
			}
			
		}
		if(leftmove==1)
		{
			gotoxy(x,y);
			printf("▥▥▥▥");
			Sleep(speed);
			x--;
			if(x==23)
			{
				leftmove=0;
				rightmove=1;
			}
		}
		if(kbhit())	
		{
			key=getch();
			if(key=='d')
			{
				coinClear((x-8),y);
				coinDown(x,dropheight);
		
				leftmove=0;
				rightmove=1;

				// checkBalanceFunc
				gameCheck = coinBalanceCheck(balance,stackBalance,x);
				if(gameCheck!=1)
				{
					gameOver(level);
					return;
				}
				balance=(balance+stackBalance)/2;

				coinStack(x,dropheight);
			
				dropheight--;
				x=23;

			}
			if(key=='q')
			{
				startMenu();
				return;
			}
		}
		if(dropheight==15)
		{
			gameClear(level);
			return;
		}
	}
}