Beispiel #1
0
void set_random_flac(int i) {
	if (list.size() > 0) {
		int n = rand()%list.size();
		string filename = list[n];
		list.erase(list.begin() + n);
		switch(i) {
			case 0:
				deck0_play = 0;
				deck0_amp = 0.0;
				lo_send(address, "/1/fader1", "f", 0.0);
				lo_send(address, "/1/toggle1", "i", 0);
				lo_send(address, "/1/toggle2", "i", 0);

				deck0.delete_buffer();
				deck0 = Play(filename.c_str());
				deck0.set_loop(0);
				lo_send(address, "/1/rotary3", "f", 1.0);
				lo_send(address, "/1/toggle1", "i", 1);
				break;
			case 1:
				deck1_play = 0;
				deck1_amp = 0.0;
				lo_send(address, "/1/fader2", "f", 0.0);
				lo_send(address, "/1/toggle3", "i", 0);
				lo_send(address, "/1/toggle4", "i", 0);

				deck1.delete_buffer();
				deck1 = Play(filename.c_str());
				deck1.set_loop(0);
				lo_send(address, "/1/rotary6", "f", 1.0);
				lo_send(address, "/1/toggle3", "i", 1);
				break;
		}
	}
}
Beispiel #2
0
int main()
{
	bool exit=true;						//boolean for exiting program
	char user_choice;					//user choice in interactive menu
	init_cash(cash);
	init_stock(file1);
	init_stock(file2);
	init_stock(file3);
	play.setstock(number_edu,number_enter,number_acti);
	cout<<endl;
	cout<<"cash in hand:"<<play.getcash()<<endl;
	display_all();
	while (exit)
	{
		menu();
		cin>>user_choice;
		switch (user_choice)
		{
		case '1':display_all();break;
		case '2':look_price();break;
		case '3':play.selltoy();break;
		case '4':play.toy_informations();break;
		case '5':display_all();number_transaction();
				 totalvalue_sales();save_cash(cash);
				 save_inventory(file1);save_inventory(file2);
				 save_inventory(file3);exit=false;break;
		default:cout<<"invalid choice!!!!";
		}//end switch
	}//end while
	return 0;
}//end main
Beispiel #3
0
int main()
{
  srand(time(0));
  Play game;
  game.run();

  return 0;
}
Beispiel #4
0
// pa callback
static int paCallback( const void *inputBuffer, void *outputBuffer,
	unsigned long framesPerBuffer,
	const PaStreamCallbackTimeInfo* timeInfo,
	PaStreamCallbackFlags statusFlags,
	void *userData )
{
	float *out = (float*)outputBuffer;
	float left, right;
	float rec_samples[FRAMES_PER_BUFFER*2];
	float deck0_out[2], deck1_out[2];
	unsigned int i, rec_i = 0;
	(void) inputBuffer; /* Prevent unused variable warning. */
	for( i=0; i<framesPerBuffer; i++ )
	{
		left = 0;
		right = 0;
		if (deck0_play) {
			deck0_out[0] = deck0.out();
			deck0_out[1] = deck0.out();
			left += deck0_out[0]*deck0_amp * 0.5;
			right += deck0_out[1]*deck0_amp * 0.5;
			if (deck0_vol < deck0_out[0]) deck0_vol = deck0_out[0];
		}
		if (deck1_play) {
			deck1_out[0] = deck1.out();
			deck1_out[1] = deck1.out();
			left += deck1_out[0]*deck1_amp * 0.5;
			right += deck1_out[1]*deck1_amp * 0.5;
			if (deck1_vol < deck1_out[0]) deck1_vol = deck1_out[0];
		}

		*out++ = left;
		*out++ = right;
		if (REC) {
			rec_samples[rec_i++] = left;
			rec_samples[rec_i++] = right;
		}

		if (count%SAMPLE_RATE==0) {
			lo_send(address, "/1/rotary3", "f", 1.0 - deck0.get_position());
			lo_send(address, "/1/rotary6", "f", 1.0 - deck1.get_position());
			lo_send(address, "/1/fader3", "f", list.size()/(float)max_list);
		}
		if (count%(int)(SAMPLE_RATE*0.1)==0) {
			lo_send(address, "/1/rotary2", "f", deck0_vol);
			lo_send(address, "/1/rotary5", "f", deck1_vol);
			deck0_vol *= 0.9;
			deck1_vol *= 0.9;
		}

		count++;
	}

	if (REC) rec.write(rec_samples);
	return 0;
}
Beispiel #5
0
int main() {
    Play pp;
    vector<TreeNode *> v = pp.generateTrees(5);
    for(int i = 0; i < v.size(); ++i) {
        cout << "\n NUMBER: " << i << '\n';
        pp.walk(v[i]);
    }

    return 0;
}
Beispiel #6
0
int main() {
    Play pp;
    string t, p;
    while(cin >> p) {
        cin >> t;
        cout << "Index: " << pp.kmp(t,p) << endl;
    }

    return 0;
}
Beispiel #7
0
int main() {
    vector<vector<int> > mat {{1, 4, 6, 8},
        {9, 13, 15, 20},{30, 40, 50, 60}};

    Play pp;
    if(pp.searchMatrix(mat, 50))
        cout << "Found !\n";

    return 0;
}
int main() {
    Play pp;
    int a[] = {2,1,4,5,1,3,3};
    int n = sizeof(a) / sizeof(int);
    vector<int> h = pp.arrToVec(a, n);

    pp.printV(h);
    cout << pp.largestRectArea(h) << '\n';

    return 0;
}
Beispiel #9
0
int main()
{
	using namespace std;

	cout << "Tic Tac Toe version " << VERSION <<
	endl << "\t by TEAM ALPHA" << endl << endl;

	Play player;

	player.start();

	return 0;
}
Beispiel #10
0
int main() {
    Play pp;
    ListNode *head, **h = &head;
    int x, t;
    cin >> x;
    while(cin >> t) {
        *h = new ListNode(t);
        h = &(*h)->next;
    }
    
    head = pp.partition(head, x);
    printList(head);

    return 0;
}
Beispiel #11
0
int main() {
    Play pp;
    vector<int> num {-1,0,1,2,-1,-4};
    printV(num);

    vector<vector<int> > v = pp.threeSum(num);
    printVV(v);

    vector<int> uu {-3, -2, -5, 3, -4};
    int t = -1;
    int m = pp.threeSumClosest(uu, t);
    printV(uu);
    cout << "Target: " << t << " sum: " << m << endl;

    return 0;
}
Beispiel #12
0
int main() {
    Play pp;
    TreeNode A(1), B(2), C(2), D(3), E(4), F(5), G(4), H(3);

    TreeNode *r = &A;
    A.left = &B, A.right = &C;
    if(pp.isSymmetric(r)) cout << "Symmetric !\n";

    B.left = &D, B.right = &E;
    C.left = &G, C.right = &H;
    if(pp.isSymmetric(r)) cout << "Symmetric !\n";

    G.left = &F;
    if(pp.isSymmetric(r)) cout << "Symmetric !\n";

    return 0;
}
Beispiel #13
0
void Arbiter::makeMove(Play &play) 
{
	for(;;){
		Card card = player.getCard();
		if(checkMoveValidity(play, card, hand)){
			hand.removeCard(card);
			play.receiveCard(card);
			break;
		}
	}
}
Beispiel #14
0
void Arbiter::makeDummyMove(Play &play) 
{
	for(;;){
		Card card = player.getDummyCard();
		if(checkMoveValidity(play, card, *dummyHand)){
			dummyHand->removeCard(card);
			play.receiveCard(card);
			break;
		}
	}
}
Beispiel #15
0
void look_price()
{
	int IN;
	bool find_toy=false;					//flag to look if you find the toy or not in the
											//different stocks
	cout<<"Identification number of the toy: ";
	cin>>IN;
	for (int i=0;i<number_edu;i++)
	{
		if (play.getedu(i).getIN()==IN)
		{
			find_toy=true;
			cout<<"name: "<<play.getedu(i).getname()<<endl;
			cout<<"price: "<<play.getedu(i).getprice()<<endl;
			break;
		}//end if
	}//end for
	if (!find_toy)
	{
		for (int i=0;i<number_enter;i++)
		{
			if (play.getenter(i).getIN()==IN)
			{
				find_toy=true;
				cout<<"name: "<<play.getenter(i).getname()<<endl;
				cout<<"price: "<<play.getenter(i).getprice()<<endl;
				break;
			}//end if
		}//end for
	}//end if
	if (!find_toy)
	{
		for (int i=0;i<number_acti;i++)
		{
			if (play.getacti(i).getIN()==IN)
			{
				find_toy=true;
				cout<<"name: "<<play.getacti(i).getname()<<endl;
				cout<<"price: "<<play.getacti(i).getprice()<<endl;
				break;
			}//end if	
		}//end for
	}//end if
	if (!find_toy)cout<<"identification number invalid\n";
}//end look_price();
Beispiel #16
0
void init_stock(string filename)
{
	int number_toy,IN,age_min,age_max,number_component;
	bool breakable,clothes_accessory,collection_animals;
	float cost,price;
	int name,phone_number;
	cout<<"loading "<<filename<<" inventory...\n";
	ifstream in(filename.c_str());
	if (!in) cerr<<"error:unable to open "<<filename<<"\n";
	else
	{
		in>>number_toy;
		for (int i=0;i<number_toy;i++)
		{
			in>>name;
			in>>cost;
			in>>price;
			in>>age_min;
			in>>age_max;
			if (filename==file1)
			{
				in>>IN;
				in>>phone_number;
				Educational edu(name,cost,price,age_min,age_max,IN,phone_number);
				number_edu=number_toy;
				play.setedu(i,edu);
			}//end if
			else if(filename==file2)
			{
				in>>IN;
				in>>clothes_accessory;
				in>>collection_animals;
				Entertainment enter(name,cost,price,age_min,age_max,IN,clothes_accessory
									,collection_animals);
				number_enter=number_toy;
				play.setenter(i,enter);
			}//end else if
Beispiel #17
0
bool Arbiter::checkMoveValidity(Play &play, Card &card, Hand &hand)
{
	if(!hand.hasCard(card)) {
		return false;
	}
	auto & tricks = play.getTricksView(); 
	if (tricks.empty() || tricks.back().getCardsView().size() == 4) {
		return true;
	} 
	auto & cards = tricks.back().getCardsView();
	Card firstCard = cards.front();
	if (hand.hasSuit(firstCard.suit) && firstCard.suit != card.suit) {
		return false;
	}
	return true;
}
Beispiel #18
0
int main() {
    Play pp;
    int pre[] = {0,0,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0};
    int k = sizeof(pre)/ sizeof(int);
    int m = 4;
    vector<vector<int> > a = pp.format(pre, m, k);

    pp.print(a);
    cout << pp.uniquePathII(a) << '\n';


    int pb[] = {1,2,3,8,4,3,2,1,5,3,2,3,1,4,5,3,6};
    k = sizeof(pb)/sizeof(int);
    m = 4;
    a = pp.format(pb, m, k);

    pp.print(a);
    cout << pp.minPathSum(a) << '\n';

    return 0;
}
Beispiel #19
0
void display_all()
{
	cout<<"Educational toys inventory: \n";
	for (int i=0;i<number_edu;i++)
	{
		if (!play.getedu(i).Issold())
		play.getedu(i).display();
	}//end for
	cout<<endl<<"Entertainment toys inventory: \n";
	for (int j=0;j<number_enter;j++)
	{
		if (!play.getenter(j).Issold())
		play.getenter(j).display();
	}//end for
	cout<<endl<<"Active Learning toys inventory: \n";
	for (int k=0;k<number_acti;k++)
	{
		if (!play.getacti(k).Issold())
		play.getacti(k).display();
	}//end for 
}//end display
Beispiel #20
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	ChangeWindowMode(true);
	SetGraphMode(640, 480, 16);
	DxLib_Init();
	SetDrawScreen(DX_SCREEN_BACK);
	SetDrawMode(DX_DRAWMODE_BILINEAR);
	SetMainWindowText("禁断の果実と楽園の護人");

	//int titlebg = LoadGraph("picture/taitol.bmp");
	int titletext = LoadGraph("picture/title.bmp");
	int bg = LoadGraph("picture/playbg_2.bmp");
	int tree = LoadGraph("picture/bigtreekai.bmp");
	char key[256];
	Opening openingscene;
	Play playscene;
	MusicSelect musicselect;
	Result resultscene;

	enum{
		OPENING,
		PLAY,
		MUSICSELECT,
		RESULT
	}scene=OPENING;

	while(Process(key)){
		switch(scene){
		case OPENING:
			DrawGraph(0, 0, bg, false);
			DrawGraph(0, 0, tree, true);
			DrawGraph(0, 0, titletext, true);
			if( ProcessMessage() == -1 ){
				break ;        // エラーが起きたらループを抜ける
			}
			openingscene.UpDate();
			openingscene.Draw();
			if(key[KEY_INPUT_LEFT]==1 || openingscene.HitJudge() == true){
				scene = MUSICSELECT;
				
			}

			if(key[KEY_INPUT_ESCAPE]==1){
				DxLib_End();
			}
			break;

		case MUSICSELECT:
			if( ProcessMessage() == -1 ){
				break ;        // エラーが起きたらループを抜ける
			}
			DrawGraph(0, 0, bg, false);
			DrawGraph(0, 0, tree, true);
			musicselect.UpDate();
			musicselect.Draw();
			if(musicselect.HitJudge() == true){
				playscene.Loadfile(musicselect.GetMusicfile());
				playscene.SetMusic(musicselect.GetMusic());
				playscene.SoundPlay();
				scene = PLAY;
			}
			if(key[KEY_INPUT_UP]==1){
				scene = PLAY;
			}

			if(key[KEY_INPUT_ESCAPE]==1){
				DxLib_End();
			}
			break;

		case PLAY:
			if( ProcessMessage() == -1 ){
				break ;        // エラーが起きたらループを抜ける
			}
			DrawGraph(0, 0, bg, false);
			DrawGraph(0, 0, tree, true);
			playscene.UpDate();
			playscene.Draw();
			if(key[KEY_INPUT_RIGHT]==1 || playscene.isPlaying() == false){
				playscene.SoundStop();
				scene = RESULT;
			}

			if(key[KEY_INPUT_ESCAPE]==1){
				DxLib_End();
			}
			break;
		
		case RESULT:
			DrawGraph(0, 0,bg, false);
			resultscene.Update();
			resultscene.Draw();
			if(key[KEY_INPUT_DOWN]==1 || resultscene.HitJudge() == true){
				scene = OPENING;
			}

			if(key[KEY_INPUT_ESCAPE]==1){
				DxLib_End();
			}
			break;
		}
	}
	DxLib_End();

	return 0;
}
int main()
{
	float boidsSize = 8;
	string action = "flock";


	// Create the main window
	sf::VideoMode desktop = sf::VideoMode::getDesktopMode();
	const int window_height = desktop.height;
	const int window_width = desktop.width;

	
	sf::RenderWindow window(sf::VideoMode(window_width, window_height, 32), "AI Project", sf::Style::None);
	Camera::GetInstance()->Init(window_width, window_height);
	MiniMap::GetInstance()->Init(window_width, window_height);
	//load a font
	sf::Font font;
	font.loadFromFile("C:\\Windows\\Fonts\\GARA.TTF");
	//int SCREEN_WIDTH = 800, SCREEN_HEIGHT = 600;
	Menu* menu;
	Play* play;

	//Create flock, vector of shapes, and initialize boids
	//Flock flock;
	//vector<sf::CircleShape> shapes;

	//for (int i = 0; i < 25; i++) //Number of boids is hardcoded for testing pusposes.
	//{
	//	//Boid b(rand() % window_width, rand() % window_height); //Starts the boid with a random position in the window.
	//	Boid b((window_width * 3) / 2, (window_height * 3) / 2 -150); //Starts all boids in the center of the screen
	//	sf::CircleShape shape(boidsSize, 3); //Shape with a radius of 10 and 3 points (Making it a triangle)

	//	//Changing the Visual Properties of the shape
	//	//shape.setPosition(b.location.x, b.location.y); //Sets position of shape to random location that boid was set to.
	//	shape.setPosition(window_width, window_height); //Testing purposes, starts all shapes in the center of screen.
	//	shape.setOutlineColor(sf::Color(0, 255, 0));
	//	shape.setFillColor(sf::Color::Green);
	//	shape.setOutlineColor(sf::Color::White);
	//	shape.setOutlineThickness(1);
	//	shape.setRadius(boidsSize);

	//	//Adding the boid to the flock and adding the shapes to the vector<sf::CircleShape>
	//	flock.addBoid(b);
	//	shapes.push_back(shape);
	//	
	//}

	menu = new Menu(window_width, window_height);
	play = new Play(window_width, window_height);


	////create a circle
	//sf::CircleShape circle(50);
	//
	//sf::CircleShape circle2(100);

	sf::Time time;
	sf::Clock m_clock;

	// Start game loop 
	while (window.isOpen())
	{
		// Process events 
		sf::Event Event;
		while (window.pollEvent(Event))
		{
			// Close window : exit 
			if (Event.type == sf::Event::Closed)
				window.close();
		}

		time = m_clock.getElapsedTime();
		float t = time.asSeconds();
		m_clock.restart();


		//updates
		switch (StateController::GetInstance()->getState())
		{
		case StateController::MENU:
			menu->Update(t);
			break;
		case StateController::PLAY:
			play->Update(t, window);
			break;
		case StateController::CREDITS:
			break;
		case StateController::PAUSE:
			break;
		case StateController::SPLASH:
			break;
		case StateController::SCORESCREEN:
			break;
		}//end switch


		window.clear();
		
		//draw
		switch (StateController::GetInstance()->getState())
		{
		case StateController::MENU:
			menu->Draw(window);
			break;
		case StateController::PLAY:
			play->Draw(window);
			break;
		case StateController::CREDITS:
			break;
		case StateController::PAUSE:
			break;
		case StateController::SPLASH:
			break;
		case StateController::SCORESCREEN:
			break;
		}//end switch

		
		window.display(); //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>DRAW WINDOW
	} //loop back for next frame
	
	return EXIT_SUCCESS;
}
Beispiel #22
0
void totalvalue_sales()
{
	cout<<"total value of sales transactions: "<<play.gettotal_sales()<<endl;
	cout<<"totat cash in hand:"<<play.getcash()<<endl;
}//end totalvalue_sales
Beispiel #23
0
void number_transaction()
{
	cout<<"total number of transaction:"<<play.getnumber_transaction()<<endl;
}//end number_transaction
Beispiel #24
0
// メインループ
void Game::MainLoop(void) {
    // 音楽再生
    Mix_PlayMusic(music_main,-1);
    // イベント
    SDL_Event event;
    double next_frame = SDL_GetTicks();
    double wait = 1000.0 / 60;
    // TOP画面
    Top top;
    // PLAY画面
    Play play;
    // ゲーム設定
    Config config;
    // パズルの区画やブロックを並べる
    PuzzleManager puzzle_manager;
    // ブロックの集合
    Block blocks[BLOCK_MAX] = {};
    // 区画の集合
    Section sections[SECTION_MAX] = {};
    // ストップウォッチ
    boost::timer t;
    
    for (;;) {
        // すべてのイベントを処理する
        while (SDL_PollEvent(&event)) {
            // 終了 (QUIT イベントが発生するか、ESC キーが押されたら)
            if ((event.type == SDL_QUIT) ||
                (event.type == SDL_KEYUP && event.key.keysym.sym == SDLK_ESCAPE))
                return;

            // TOP画面
            if (view_type == VIEW_TOP){
                // イベント処理
                int result = top.Event(&event, &config, &puzzle_manager, sections, blocks);
                if (result == ON){
                    view_type = VIEW_PLAY;
                }
            }
            
            // PLAY画面
            if (view_type == VIEW_PLAY){
                // イベント処理
                play.Event(&event, &config, &puzzle_manager, sections, blocks, &t);
            }
  
            // 全画面共通
            // キーボード操作
            if (event.type == SDL_KEYDOWN){
                // 右Shift
                if (event.key.keysym.sym == SDLK_RSHIFT){
                    // 設定初期化
                    config.Reset();
                    // ブロック未操作
                    play.SetFlagOperated(OFF);
                    // 得点リセット
                    puzzle_manager.ResetScore();
                    // 操作回数リセット
                    play.SetNumberOfOperations(OFF);
                    // クリア状況リセット
                    play.SetPlayResult(OFF);
                    // プレイ状況リセット
                    play.Reset();
                    // TOP画面へ遷移
                    view_type = VIEW_TOP;
                }
            }
        }
        
        // 1秒間に60回Updateされるようにする
        if (SDL_GetTicks() >= next_frame) {
            Update(&config, &puzzle_manager, sections, &top, &play, blocks);
            // 描画
            Draw(&config, sections, &top, &play, &puzzle_manager, blocks, &t);
            next_frame += wait;
            // CPU休ませる。どれくらいの数値がベスト…?
            SDL_Delay(3);
        }
    }
}
Beispiel #25
0
int MainMenu::DrawMenu(SDL_Surface *screen)
{
	Play igra;
	
	SDL_FillRect(screen , NULL , 0x000000);
	
	txtRect3.x = HEIGHT/2 - 100;
	txtRect3.y = WIDTH/2 - 295;

	font3 = TTF_OpenFont("./font/42852.ttf",20);
	imgTxt3 = TTF_RenderText_Solid( font3 , "Текущий игрок: " , Color3 );
	SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
	
	txtRect3.x = HEIGHT/2 + 50;
	imgTxt3 = TTF_RenderText_Solid( font3 , name , Color3 );
	SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
	
	txtRect3.x = HEIGHT/2 - 100;
	txtRect3.y = WIDTH/2 - 200;
	font3 = TTF_OpenFont("./font/42852.ttf",25);
	imgTxt3 = TTF_RenderText_Solid( font3 , "Начало игры" , menucolor3 );
	SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );	
	Draw_Rect(screen, txtRect3.x - 10, txtRect3.y , 285, 25,  0xFFFFFF);
	
	txtRect3.y = WIDTH/2 - 175;
	imgTxt3 = TTF_RenderText_Solid( font3 , "Смена игрока" , Color3 );
	SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );	
	
	txtRect3.y = WIDTH/2 - 150;
	imgTxt3 = TTF_RenderText_Solid( font3 , "Просмотр результатов" , Color3 );
	SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );	

	txtRect3.y = WIDTH/2 - 125;
	imgTxt3 = TTF_RenderText_Solid( font3 , "Правила игры" , Color3 );
	SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );	

	txtRect3.y = WIDTH/2 - 100;
	imgTxt3 = TTF_RenderText_Solid( font3 , "Выход" , Color3 );
	SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );		
	
	SDL_Flip(screen);
	
	j3=0;
	txtRect3.y = WIDTH/2 - 200;
	
	while(end3 == 0)
	{
		while(SDL_PollEvent(&event3))
		{  
			switch(event3.type)
		    {  
    			case SDL_MOUSEBUTTONDOWN:
    			{
    				if(event3.button.x >= HEIGHT/2 - 100 && event3.button.x <= HEIGHT/2 + 185)
	    			{
	    					if(event3.button.y >= WIDTH/2 - 200 && event3.button.y < WIDTH/2 - 175) /*играть*/
	    					{
								igra.Game(screen);
								return 0;
							}
							
	    					if(event3.button.y >= WIDTH/2 - 175 && event3.button.y < WIDTH/2 - 150) /*смена имени*/
	    					{
								while(name[i3]!='\0')
									name[i3++] = '\0';
									
								Zastavka2(screen); 
								
								return 0;							
							}
							
	    					if(event3.button.y >= WIDTH/2 - 150 && event3.button.y < WIDTH/2 - 125)
	    					{
	    						Tablitca(screen);
								return 0;
	    					}
	    					
	    					if(event3.button.y >= WIDTH/2 - 125 && event3.button.y < WIDTH/2 - 100)/*правила игры*/
	 						{
								PravilaGame(screen);
								return 0;						
							}   
												
	    					if(event3.button.y >= WIDTH/2 - 100 && event3.button.y < WIDTH/2 - 75)
	    						end3 = 1;
	    			}
    				break;
    			}
    			
				case SDL_KEYDOWN:
    			{
					if(event3.key.keysym.sym == SDLK_DOWN && j3 != 4)
					{
						if(j3<4)
							j3++;
							
						Draw_Rect(screen, txtRect3.x - 10, txtRect3.y , 285, 25,  0x000000);
						
						if(j3==0)
							txtRect3.y = WIDTH/2 - 200;
						else
						if(j3==1)
						{
							imgTxt3 = TTF_RenderText_Solid( font3 , "Начало игры" , Color3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );						
							txtRect3.y = WIDTH/2 - 175;
							imgTxt3 = TTF_RenderText_Solid( font3 , "Смена игрока" , menucolor3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
						}
						else
						if(j3==2)
						{
							imgTxt3 = TTF_RenderText_Solid( font3 , "Смена игрока" , Color3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );						
							txtRect3.y = WIDTH/2 - 150;
							imgTxt3 = TTF_RenderText_Solid( font3 , "Просмотр результатов" , menucolor3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
						}
						else
						if(j3==3)
						{
							imgTxt3 = TTF_RenderText_Solid( font3 , "Просмотр результатов" , Color3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );						
							txtRect3.y = WIDTH/2 - 125;
							imgTxt3 = TTF_RenderText_Solid( font3 , "Правила игры" , menucolor3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
						}
						else	
						if(j3==4)
						{
							imgTxt3 = TTF_RenderText_Solid( font3 , "Правила игры" , Color3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );						
							txtRect3.y = WIDTH/2 - 100;
							imgTxt3 = TTF_RenderText_Solid( font3 , "Выход" , menucolor3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
						}
							
						Draw_Rect(screen, txtRect3.x - 10, txtRect3.y , 285, 25,  0xFFFFFF);
						SDL_Flip(screen);
					}
					
					if(event3.key.keysym.sym == SDLK_UP && j3 != 0)
					{
						if(j3>0)
							j3--;
						
						Draw_Rect(screen, txtRect3.x - 10, txtRect3.y , 285, 25,  0x000000);
						
						if(j3==0)
						{
							imgTxt3 = TTF_RenderText_Solid( font3 , "Смена игрока" , Color3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );						
							txtRect3.y = WIDTH/2 - 200;
							imgTxt3 = TTF_RenderText_Solid( font3 , "Начало игры" , menucolor3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
						}
						else
						if(j3==1)
						{
							imgTxt3 = TTF_RenderText_Solid( font3 , "Просмотр результатов" , Color3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );						
							txtRect3.y = WIDTH/2 - 175;
							imgTxt3 = TTF_RenderText_Solid( font3 , "Смена игрока" , menucolor3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
						}
						else
						if(j3==2)
						{
							imgTxt3 = TTF_RenderText_Solid( font3 , "Правила игры" , Color3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );						
							txtRect3.y = WIDTH/2 - 150;
							imgTxt3 = TTF_RenderText_Solid( font3 , "Просмотр результатов" , menucolor3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
						}
						else
						if(j3==3)
						{
							imgTxt3 = TTF_RenderText_Solid( font3 , "Выход" , Color3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );						
							txtRect3.y = WIDTH/2 - 125;
							imgTxt3 = TTF_RenderText_Solid( font3 , "Правила игры" , menucolor3 );
							SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
						}
						else	
						if(j3==4)
							txtRect3.y = WIDTH/2 - 100;
						
																		
						Draw_Rect(screen, txtRect3.x - 10, txtRect3.y , 285, 25,  0xFFFFFF);
						SDL_Flip(screen);
					}
					
					if(event3.key.keysym.sym == 0x0D) /*если нажат Enter*/
					{
						if(txtRect3.y == men1) /*Играть*/
						{
							igra.Game(screen);
							return 0;
						}
						
						if(txtRect3.y == men2) /*Смена игрока*/
						{
							while(name[i3]!='\0')
								name[i3++] = '\0';
								
							Zastavka2(screen); 
							
							return 0;							
						}
						
						if(txtRect3.y == men3) /*Просмотр результатов*/
						{
							Tablitca(screen);
							return 0;						
						}
						
						if(txtRect3.y == men4) /*Правила игры*/
						{
							PravilaGame(screen);
							return 0;						
						}
						
						if(txtRect3.y == men5) /*Выход*/
							end3 = 1; 	
					}
				}
			}
		}
	}
	
	return end3;	
}