#include <iostream>
#include <windows.h>
#include <conio.h>
using namespace std;
void Select1Player();
void Select2Players();
void main()
{
bool player2 = false;
Select1Player();
char c = 0;
while(c != 13)
{
c = _getch();
if((c == 72 || c == 80) && player2 == false)//38 и 40 - стрелки вверх и вниз у таблице ASCII
{
player2 = true;
Select2Players();
}
else if(c == 72 || c == 80)
{
player2 = false;
Select1Player();
}
}
}
//выводит выбор параметров и выделяет "1 player"
void Select1Player()
{
system("cls");
COORD coord = { 50, 10 };
static HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hStdOut, coord);
SetConsoleTextAttribute(hStdOut,
BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY | BACKGROUND_RED);
cout << "1 PLAYER";
SetConsoleTextAttribute(hStdOut,
FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_RED);
coord = { 50, 11 };
SetConsoleCursorPosition(hStdOut, coord);
cout << "2 PLAYERS";
}
//выводит выбор параметров и выделяет "2 players"
void Select2Players()
{
system("cls");
COORD coord = { 50, 10 };
static HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hStdOut, coord);
SetConsoleTextAttribute(hStdOut,
FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_RED);
cout << "1 PLAYER";
SetConsoleTextAttribute(hStdOut,
BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY | BACKGROUND_RED);
coord = { 50, 11 };
SetConsoleCursorPosition(hStdOut, coord);
cout << "2 PLAYERS";
}
#include <iostream>
#include <windows.h>
#include <conio.h>
using namespace std;
void Select1Player();
void Select2Players();
int main()
{
bool player2 = false;
Select1Player();
char c = 0;
while(c != 13)
{
c = _getch();
if((c == 72 || c == 80) && player2 == false)//38 и 40 - стрелки вверх и вниз у таблице ASCII
{
player2 = true;
Select2Players();
}
else if(c == 72 || c == 80)
{
player2 = false;
Select1Player();
}
}
return 0;
}
//выводит выбор параметров и выделяет "1 player"
void Select1Player()
{
COORD coord = { 50, 10 };
static HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hStdOut,
FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_RED);
system("cls");
SetConsoleCursorPosition(hStdOut, coord);
SetConsoleTextAttribute(hStdOut,
BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY | BACKGROUND_RED);
cout << "1 PLAYER";
SetConsoleTextAttribute(hStdOut,
FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_RED);
coord = { 50, 11 };
SetConsoleCursorPosition(hStdOut, coord);
cout << "2 PLAYERS";
}
//выводит выбор параметров и выделяет "2 players"
void Select2Players()
{
COORD coord = { 50, 10 };
static HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hStdOut,
FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_RED);
system("cls");
SetConsoleCursorPosition(hStdOut, coord);
SetConsoleTextAttribute(hStdOut,
FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_RED);
cout << "1 PLAYER";
SetConsoleTextAttribute(hStdOut,
BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY | BACKGROUND_RED);
coord = { 50, 11 };
SetConsoleCursorPosition(hStdOut, coord);
cout << "2 PLAYERS";
}
void Select1Player()
{
COORD coord = { 50, 10 };
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hStdOut, 0);
system("cls");
SetConsoleTextAttribute(hStdOut,
BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY | BACKGROUND_RED);
SetConsoleCursorPosition(hStdOut, coord);
cout << "1 PLAYER";
coord.X = 50;
coord.Y = 11;
SetConsoleTextAttribute(hStdOut,
FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_RED);
SetConsoleCursorPosition(hStdOut, coord);
cout << "2 PLAYERS";
}
//выводит выбор параметров и выделяет "2 players"
void Select2Players()
{
COORD coord = { 50, 10 };
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hStdOut, 0);
system("cls");
SetConsoleTextAttribute(hStdOut,
FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_RED);
SetConsoleCursorPosition(hStdOut, coord);
cout << "1 PLAYER";
coord.X = 50;
coord.Y = 11;
SetConsoleTextAttribute(hStdOut,
BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY | BACKGROUND_RED);
SetConsoleCursorPosition(hStdOut, coord);
cout << "2 PLAYERS";
}