Esempio n. 1
0
bool COptions::Create( bool useAppDataFolder, std::string dynamicDataFolder, std::string pgmFolder )
{
    // Set the file name of the configuration file including full path
    configFileName = dynamicDataFolder.c_str();
    configFileName.append( "config.xml" );
    theLog.WriteLine( "Options         => Name of config file: '%s'.", configFileName.c_str() );

    // Set the file name of the old configuration file
    oldconfigFileName = dynamicDataFolder.c_str();
    oldconfigFileName.append( "config.dat" );

    // Set default configuration values before loading the configuration file and overwriting the default
    SetDefaultValues();

    // Load configuration file and overwrite the previously set defaults
    if (!LoadConfiguration())
        return false;

    // Load game levels data and names
    if (!LoadLevels( useAppDataFolder ? dynamicDataFolder : "", pgmFolder ))
        return false;
    
    // Everything went ok.
    return true;
}
Esempio n. 2
0
void FLevelCollectionModel::LoadSelectedLevels_Executed()
{
	LoadLevels(GetSelectedLevels());
}
Esempio n. 3
0
// MAIN ---------------------------------
int main(int argc, char *argv[]){
int I;
char buf[255];

#ifdef UNIX
  strcpy(GAME_HOME,getenv("HOME"));
  strcat(GAME_HOME,"/.xpired");
#else
  strcpy(GAME_HOME,".");
#endif

  sprintf(ConfFName,"%s/xpired.cfg",GAME_HOME);

  if(!LoadConfig(ConfFName))
  {
    sprintf(buf,"%s/xpired.cfg",SHARE_DIR);
    LoadConfig(buf);
  }

  sprintf(LFile,"%s/xpired.lvl",SHARE_DIR);

  for (I=1;I<argc;I++){
    if ((!strcmp("--help",argv[I]))||(!strcmp("-h",argv[I]))){
		fprintf(stdout,"Example of usage: %s --nosound -l levelfile.lvl -d demo.dmo\n",argv[0]);
		fprintf(stdout," Switches:\n");
		fprintf(stdout,"   -f, --fullscreen    Toggle fullscreen/windowed\n");
		fprintf(stdout,"   -l  <file>          Load level from <file>\n");
		fprintf(stdout,"   -h, --help          Display this help screen\n");
		fprintf(stdout,"   --version           Display version no.\n");
		return 0;
    }else if (!strcmp("-l",argv[I])){
      strcpy(LFile,argv[++I]);
    }else if (!strcmp("-f",argv[I]) || !strcmp("--fullscreen",argv[I])){
      FULLSCR=!FULLSCR;
    }else if (!strcmp("--version",argv[I])){
		fprintf(stdout,"%s ver. %s \n",APPNAME,VERSION);
		return 0;
	}
  }

	if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
		fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
		exit(1);
	}
	atexit(SDL_Quit);

	SDL_WM_SetCaption(APPNAME,APPNAME);

  sprintf(buf,"%s/img/icon.bmp",SHARE_DIR);
  
	SDL_WM_SetIcon(IMG_Load(buf), NULL);
	VIDEO_INIT();
	SDL_ShowCursor(SDL_ENABLE);
	SDL_SetEventFilter(E_FILTER);
	SDL_EnableKeyRepeat(0,0);
	SDL_EnableUNICODE(1);

	LoadSprites();
	LoadLevels(LFile);

	if (Shades){
		Sh=SDL_CreateRGBSurface(SDL_SRCALPHA,400,400,BPP,screen->format->Rmask,screen->format->Gmask,screen->format->Bmask,screen->format->Amask);
		if (Sh==NULL) fprintf(stderr,"SH neni!!\n");
		SDL_SetColorKey(Sh,SDL_SRCCOLORKEY,SDL_MapRGB(Sh->format,255,0,255));
		SDL_SetAlpha(Sh,SDL_SRCALPHA,Shades);
	}

//--- MNU DEFS
	M_Fg.X=400;
	M_Fg.Top=0;
	M_Fg.Akt=0;
	M_Fg.L=7;
	strcpy(M_Fg.Name,"Fg");
	M_Fg.E[0].Spr=' ';
	M_Fg.E[0].Typ=' ';
	strcpy(M_Fg.E[0].Desc,"None");
	M_Fg.E[1].Spr='X';
	M_Fg.E[1].Typ='X';
	strcpy(M_Fg.E[1].Desc,"Wall");
	M_Fg.E[2].Spr='x';
	M_Fg.E[2].Typ='x';
	strcpy(M_Fg.E[2].Desc,"TinyWall");
	M_Fg.E[3].Spr='c';
	M_Fg.E[3].Typ='c';
	strcpy(M_Fg.E[3].Desc,"Crate");
	M_Fg.E[4].Spr='o';
	M_Fg.E[4].Typ='o';
	strcpy(M_Fg.E[4].Desc,"Barrel");
	M_Fg.E[5].Spr='O';
	M_Fg.E[5].Typ='O';
	strcpy(M_Fg.E[5].Desc,"HiExplosive");
	M_Fg.E[6].Spr='B';
	M_Fg.E[6].Typ='B';
	strcpy(M_Fg.E[6].Desc,"BEM");

	M_Bg.X=420;
	M_Bg.Top=0;
	M_Bg.Akt=0;
	M_Bg.L=8;
	strcpy(M_Bg.Name,"Bg");
	M_Bg.E[0].Spr=' ';
	M_Bg.E[0].Typ=' ';
	strcpy(M_Bg.E[0].Desc,"None");
	M_Bg.E[1].Spr='*';
	M_Bg.E[1].Typ='*';
	strcpy(M_Bg.E[1].Desc,"Start");
	M_Bg.E[2].Spr='+';
	M_Bg.E[2].Typ='+';
	strcpy(M_Bg.E[2].Desc,"Exit");
	M_Bg.E[3].Spr='%';
	M_Bg.E[3].Typ='%';
	strcpy(M_Bg.E[3].Desc,"Retarder");
	M_Bg.E[4].Spr='#';
	M_Bg.E[4].Typ='#';
	strcpy(M_Bg.E[4].Desc,"Ice");
	M_Bg.E[5].Spr='&';
	M_Bg.E[5].Typ='&';
	strcpy(M_Bg.E[5].Desc,"Flamable");
	M_Bg.E[6].Spr='@';
	M_Bg.E[6].Typ='@';
	strcpy(M_Bg.E[6].Desc,"Hot! ");
	M_Bg.E[7].Spr='T';
	M_Bg.E[7].Typ='T';
	strcpy(M_Bg.E[7].Desc,"Teleport");

	strcpy(M_Txt[0],"Name|");
	strcpy(M_Txt[1],"Pw|");
	strcpy(M_Txt[2],"Timer|");
	strcpy(M_Txt[3],"BgImg|");
	strcpy(M_Txt[4],"Msg|");
	strcpy(M_Txt[5],"GoTo|");
	strcpy(M_Txt[6],"Save|");
	M_Txt[7][0]='\0';

	strcpy(M_Msg[0],"T0|");
	strcpy(M_Msg[1],"T1|");
	strcpy(M_Msg[2],"T2|");
	strcpy(M_Msg[3],"T3|");
	strcpy(M_Msg[4],"T4|");
	strcpy(M_Msg[5],"T5|");
	strcpy(M_Msg[6],"T6|");
	strcpy(M_Msg[7],"T7|");
	strcpy(M_Msg[8],"T8|");
	strcpy(M_Msg[9],"T9|");

	Edit();

	SDL_Quit();
	return 0;
}
Esempio n. 4
0
void SSGameLobby::Startup()
{
	// Seed the randomizer
	const unsigned int randomSeed = static_cast<const unsigned int>( SDL_GetPerformanceCounter() );
	g_Randomizer.Seed( randomSeed );

	// Register subscriber
	g_SSMail.RegisterSubscriber( this );
	m_UserInterests = MessageTypes::COLOUR_CHANGE 
		| MessageTypes::TEAM_CHANGE 
		| MessageTypes::SPAWN_POINT_CHANGE 
		| MessageTypes::CHANGE_SPAWN_COUNT
		| MessageTypes::RESERVE_AI_PLAYER;

	// Set all player slots to not ready
	for ( int i = 0; i < MAX_PLAYERS; ++i )
		m_PlayersReady[i] = false;

	// Register callback to network engine
	m_NetworkCallbackHandle = g_NetworkEngine.RegisterCallback( NetworkCallbackEvent::Disconnection, std::bind( &SSGameLobby::OnDisconnection, this, std::placeholders::_1 ) );

	// Player colours
	m_ColourEntries.push_back( ColourEntry	{ "Green",	Colours::KINDA_GREEN, Colours::KINDA_GREEN	, -1 } );
	m_ColourEntries.push_back( ColourEntry	{ "Red", 	Colours::KINDA_RED 	, Colours::KINDA_RED	, -1 } );
	m_ColourEntries.push_back( ColourEntry	{ "Blue", 	Colours::KINDA_BLUE	, Colours::KINDA_BLUE	, -1 } );
	m_ColourEntries.push_back( ColourEntry	{ "Pink",	Colours::KINDA_PINK	, Colours::KINDA_PINK	, -1 } );
	m_ColourEntries.push_back( ColourEntry	{ "Yellow", Colours::VERY_YELLOW, Colours::VERY_YELLOW	, -1 } );
	m_ColourEntries.push_back( ColourEntry	{ "Cyan",	Colours::LTBLUE		, Colours::LTBLUE		, -1 } );
	// Text colour modified
	m_ColourEntries.push_back( ColourEntry	{ "Black",	Colours::BLACK		, glm::vec4(0.4f, 0.4f, 0.4f, 1.0f), -1 } );

	g_GameData.SetPlayerColour( 0, Colours::KINDA_GREEN );
	g_GameData.SetPlayerColour( 1, Colours::KINDA_RED );
	g_GameData.SetPlayerColour( 2, Colours::KINDA_BLUE );
	g_GameData.SetPlayerColour( 3, Colours::KINDA_PINK );

	// Set up GUI
	g_GUI.UseFont( FONT_ID_LEKTON_16 );

	m_ConnectionState			= ConnectionState::EnteringIP;
	m_ConnectionAttemptFailed	= false;
	g_NetworkEngine.RegisterCallback( NetworkCallbackEvent::ConnectionAttemptSuccess, std::bind( &SSGameLobby::OnConnectionSuccess, this, std::placeholders::_1 ) ); // TODODB: Check against this variable already being set eller nånting.
	g_NetworkEngine.RegisterCallback( NetworkCallbackEvent::ConnectionAttemptFail, std::bind( &SSGameLobby::OnConnectionFail, this, std::placeholders::_1 ) ); // TODODB: Check against this variable already being set eller nånting.

	// Button scripts
	g_Script.Register( m_ScriptNameReady.c_str(), [&] ( IScriptEngine* ) -> int { OnReadyButtonClicked(); return 0; } );
	g_Script.Register( m_ScriptNameStartGame.c_str(), [&] ( IScriptEngine* ) -> int { StartGame(); return 0; } );
	g_Script.Register(m_ScriptChangeGameSetting.c_str(), [this](IScriptEngine* script) -> int
	{
		m_NumberOfSpawns += script->PopInt();
		if (m_NumberOfSpawns < 1)
			m_NumberOfSpawns = 1;
		if (m_NumberOfSpawns > SQUAD_MAXIMUM_UNIT_COUNT)
			m_NumberOfSpawns = SQUAD_MAXIMUM_UNIT_COUNT;
		ChangeSpawnCount( m_NumberOfSpawns );
		return 0;
	} );

	GUI::Window* parentWindow = g_GUI.GetWindow( m_WindowNameParent );
	glm::ivec2 middleParent = glm::ivec2(parentWindow->GetBoundingBoxRef().X, parentWindow->GetBoundingBoxRef().Y) + parentWindow->GetSize() / 2;
	glm::ivec2 sizeParent = parentWindow->GetSize( );

	{ // Enter ip
		m_WindowEnterIP = g_GUI.AddWindow( m_WindowNameEnterIP, GUI::Rectangle( middleParent.x - m_WidthEnterIP / 2, middleParent.y - m_HeightEnterIP / 2, m_WidthEnterIP, m_HeightEnterIP ), m_WindowNameParent, true );

		m_TextBoxEnterIP = g_GUI.AddTextBox( "", GUI::Rectangle( m_WidthButton, m_HeightEnterIP - m_HeightTextBox, m_WidthTextBox, m_HeightTextBox) , m_WindowNameEnterIP);

		// Connect
		m_ButtonConnect = g_GUI.AddButton( "", GUI::Rectangle( m_WidthEnterIP - m_WidthButton * 2, m_HeightEnterIP - m_HeightButton, m_WidthButton, m_HeightButton), m_WindowNameEnterIP );
		m_ButtonConnect->SetText( "Connect" );
		g_Script.Register( m_ScriptNameConnect.c_str(), [this](IScriptEngine*){ ConnectToGame(m_TextBoxEnterIP->GetText()); return 0; } );
		m_ButtonConnect->SetClickScript( m_ScriptNameConnect + "()" );
		m_ButtonConnect->GetBackgroundRef().Texture = m_TextureNameButtons;

		// Host
		m_ButtonHost = g_GUI.AddButton( "", GUI::Rectangle( m_WidthEnterIP - m_WidthButton, m_HeightEnterIP - m_HeightButton, m_WidthButton, m_HeightButton), m_WindowNameEnterIP );
		m_ButtonHost->SetText( "Host" );
		g_Script.Register( m_ScriptNameHost.c_str(), [this](IScriptEngine*){ HostGame(); return 0; } );
		m_ButtonHost->SetClickScript( m_ScriptNameHost + "()" );
		m_ButtonHost->GetBackgroundRef().Texture = m_TextureNameButtons;

		// Text
		GUI::Text* infoText = g_GUI.AddText( "", GUI::TextDefinition( "Please enter an IP adress to connect to", 0, m_TopPadding, m_WidthEnterIP, m_HeightInfoText ), m_WindowNameEnterIP );
		infoText->GetTextDefinitionRef().Alignment = GUI::ALIGNMENT_TOP_CENTER;
		m_TextError = g_GUI.AddText( "", GUI::TextDefinition( "", 0, m_TopPadding + m_HeightInfoText, m_WidthEnterIP, m_HeightErrorText ), m_WindowNameEnterIP );

		// Back button
		m_ButtonBackEnterIP = g_GUI.AddButton( "", GUI::Rectangle( 0, m_WindowEnterIP->GetSize( ).y - m_HeightButton, m_WidthButton, m_HeightButton ), m_WindowNameEnterIP );
		g_Script.Register( m_ScriptNameBackEnterIP.c_str(), [this](IScriptEngine*){ BackFromEnterIP( ); return 0; } );
		m_ButtonBackEnterIP->SetClickScript( m_ScriptNameBackEnterIP + "()" );
		m_ButtonBackEnterIP->SetText( "Back" );
		m_ButtonBackEnterIP->GetBackgroundRef().Texture = m_TextureNameButtons;

		// Enter ip is default window
		m_WindowEnterIP->ToggleOpen();

		// Default IP
		CallbackConfig* networkConfig = g_ConfigManager.GetConfig( "network.cfg" );
		int defaultPort = networkConfig->GetInt( "DefaultListeningPort", 40606, "Default port for establishing connections" );
		rString savedIP = networkConfig->GetString( "SavedIP", "", "The IP of the last successfull connection attempt" );

		m_TextBoxEnterIP->SetText( savedIP );
	}
	{ // Lobby
		m_WindowLobby = g_GUI.AddWindow( m_WindowNameLobby, parentWindow->GetBoundingBoxRef(), m_WindowNameParent );
		glm::ivec2 sizeLobby = m_WindowLobby->GetSize( );
		// Start game (host)
		m_ButtonStartGame = g_GUI.AddButton( "", GUI::Rectangle( sizeLobby.x - m_WidthButton * 2, sizeLobby.y - m_HeightButton, m_WidthButton, m_HeightButton ), m_WindowNameLobby );
		m_ButtonStartGame->SetText( "Start" );
		m_ButtonStartGame->SetClickScript( m_ScriptNameStartGame + "()" );
		m_ButtonStartGame->SetVisible( false );
		m_ButtonStartGame->SetEnabled( false );
		m_ButtonStartGame->GetBackgroundRef().Texture = m_TextureNameButtons;

		// Back button
		m_ButtonBackLobby = g_GUI.AddButton( "", GUI::Rectangle( 0, sizeLobby.y - m_HeightButton, m_WidthButton, m_HeightButton ), m_WindowNameLobby );
		g_Script.Register( m_ScriptNameBackLobby.c_str(), [this](IScriptEngine*) 
			{
				BackFromLobby();
				return 0; 
			} );
		m_ButtonBackLobby->SetClickScript( m_ScriptNameBackLobby + "()" );
		m_ButtonBackLobby->SetText( "Back" );
		m_ButtonBackLobby->GetBackgroundRef().Texture = m_TextureNameButtons;

		// Ready (client)
		m_ButtonReady = g_GUI.AddButton( "", GUI::Rectangle( sizeLobby.x - m_WidthButton, sizeLobby.y - m_HeightButton, m_WidthButton, m_HeightButton ), m_WindowNameLobby );
		m_ButtonReady->GetBackgroundRef().Texture = m_TextureNameButtons;
		m_ButtonReady->SetText( "Ready" );
		m_ButtonReady->SetClickScript( m_ScriptNameReady + "()" );
		{ // Connected clients 
			m_WindowConnectedClients = g_GUI.AddWindow( m_WindowNameConnectedClients,
					GUI::Rectangle( 0, 0,
						sizeParent.x / 2, sizeParent.y / 2 ),
					m_WindowNameLobby, true );
			m_WindowConnectedClients->ToggleOpen( );
			g_GUI.UseFont( FONT_ID_LEKTON_20 );
			g_Script.Register( m_ScriptNameColourChange.c_str(), [this](IScriptEngine* script) -> int
					{
						int playerID = script->PopInt( );
						assert( playerID >= 0 && playerID < MAX_PLAYERS );
						int selectedIndex = m_ConnectedPlayerEntries[playerID].Colour->GetSelectedIndex( );
						TryChangeColour( selectedIndex, playerID, false );
						return 0;
					} );
			g_Script.Register( m_ScriptNameTeamChange.c_str(), [this](IScriptEngine* script) -> int
					{
						int playerID = script->PopInt( );
						assert( playerID >= 0 && playerID < MAX_PLAYERS );
						int selectedIndex = m_ConnectedPlayerEntries[playerID].Team->GetSelectedIndex( );
						TryChangeTeam( selectedIndex, playerID, false );
						return 0;
					} );
			g_Script.Register( m_ScriptNameKick.c_str( ), [this](IScriptEngine* script) -> int
					{
						int playerID = script->PopInt( );
						if ( m_ConnectedPlayerEntries[ playerID ].IsAI )
						{
							ChangeReserveAI( playerID, false );
							OnDisconnection( &playerID );
						}
						else
							g_NetworkEngine.RequestDisconnection( playerID );
						return 0;
					} );
			g_Script.Register( m_ScriptNameReserveForAI.c_str( ), [this](IScriptEngine* script) -> int
					{
						int playerID = script->PopInt( );
						if ( !m_ConnectedPlayerEntries[playerID].IsAI )
						{
							OnNewClientConnect( playerID );
						}
						ChangeReserveAI( playerID, true );
						g_NetworkEngine.RequestDisconnection( playerID );
						return 0;
					} );
			// Players
			int entryY = m_HeightPlayerEntry * (MAX_PLAYERS - 1) + m_TopPadding;
			for ( int i = MAX_PLAYERS -1 ; i >= 0; --i )
			{
				int x = m_WindowConnectedClients->GetSize().x - m_WidthReady;
				ConnectedPlayer& playerEntry = m_ConnectedPlayerEntries[i];
				playerEntry.Name = g_GUI.AddText( "", GUI::TextDefinition( "TODOJM", m_LeftPadding, entryY, m_WidthName, m_HeightPlayerEntry ), m_WindowNameConnectedClients );

				playerEntry.Ready = g_GUI.AddSprite( "", GUI::SpriteDefinition( m_TextureNameReadySprite, m_WindowConnectedClients->GetSize().x - m_WidthReady, entryY, m_WidthReady, m_HeightPlayerEntry ), m_WindowNameConnectedClients );
				x -= m_WidthTeam;
				playerEntry.Team = g_GUI.AddComboBox( "", GUI::Rectangle( x, entryY, m_WidthTeam, m_HeightPlayerEntry ), m_WindowNameConnectedClients );
				playerEntry.Team->AddItem( "Team 1" );
				playerEntry.Team->AddItem( "Team 2" );
				playerEntry.Team->AddItem( "Team 3" );
				playerEntry.Team->AddItem( "Team 4" );
				playerEntry.Team->SetClickScript( m_ScriptNameTeamChange + "(" + rToString( i ) + ")");
				playerEntry.Team->GetBackgroundRef().Texture = m_TextureNameComboBox;
				playerEntry.Team->SetItemBackgroundImage( m_TextureNameComboBoxItem );
				x -= m_WidthColour;
				playerEntry.Colour = g_GUI.AddComboBox( "", GUI::Rectangle( x, entryY, m_WidthColour, m_HeightPlayerEntry ), m_WindowNameConnectedClients );
				for( auto& colourEntry : m_ColourEntries )
				{
					playerEntry.Colour->AddItem( colourEntry.Text );
					playerEntry.Colour->GetItem( playerEntry.Colour->GetNumItems() - 1 ).Text.Colour = colourEntry.TextColour;
				}
				playerEntry.Colour->SetClickScript( m_ScriptNameColourChange + "(" + rToString( i ) + ")" );
				playerEntry.Colour->GetBackgroundRef().Texture = m_TextureNameComboBox;
				playerEntry.Colour->SetItemBackgroundImage( m_TextureNameComboBoxItem );
				x -= m_WidthKick;
				playerEntry.Kick = g_GUI.AddButton( "", GUI::Rectangle( x, entryY, m_WidthKick, m_HeightPlayerEntry ), m_WindowNameConnectedClients );
				playerEntry.Kick->SetClickScript( m_ScriptNameKick + "(" + rToString( i ) + ")" );
				playerEntry.Kick->GetBackgroundRef().Texture = m_TextureNameKickSprite;
				x -= m_WidthReserveForAI;
				playerEntry.ReserveForAIBtn = g_GUI.AddButton( "", GUI::Rectangle( x, entryY, m_WidthReserveForAI, m_HeightPlayerEntry ), m_WindowNameConnectedClients );
				playerEntry.ReserveForAIBtn->SetClickScript( m_ScriptNameReserveForAI + "(" + rToString( i ) + ")" );
				playerEntry.ReserveForAIBtn->GetBackgroundRef().Texture = m_TextureNameButtons;
				playerEntry.ReserveForAIBtn->GetTextDefinitionRef().Text = "AI";

				playerEntry.PlayerID = i;

				entryY -= m_HeightPlayerEntry;
			}
		}
		{ // Select level window
			m_WindowSelectLevel = g_GUI.AddWindow( m_WindowNameSelectLevel, 
					GUI::Rectangle( sizeLobby.x / 2, 0, sizeLobby.x / 2, sizeLobby.y / 2 ), 
					m_WindowNameLobby, true );
			glm::ivec2 slSize = m_WindowSelectLevel->GetSize();
			m_WindowSelectLevel->ToggleOpen( );
			m_ComboBoxSelectLevel = g_GUI.AddComboBox( "", GUI::Rectangle(
						0, m_WindowSelectLevel->GetSize().y - m_HeightComboBoxSelectLevel, m_WindowSelectLevel->GetSize().x, m_HeightComboBoxSelectLevel ),
					m_WindowNameSelectLevel );
			m_ComboBoxSelectLevel->SetBackgroundImage( m_TextureNameSelectLevel );
			m_ComboBoxSelectLevel->SetItemBackgroundImage( m_TextureNameSelectLevel );
			g_Script.Register( m_ScriptClickLevelChange.c_str(), [this](IScriptEngine*){ SetLevel(m_ComboBoxSelectLevel->GetTextDefinitionRef().Text); return 0; } );
			m_ComboBoxSelectLevel->SetClickScript( m_ScriptClickLevelChange + "()" );

			m_SizeLevelWindow = std::min(slSize.x, slSize.y - m_HeightComboBoxSelectLevel);
			m_WindowLevel = g_GUI.AddWindow( m_WindowNameLevel, GUI::Rectangle( 
						(slSize.x / 2) - (m_SizeLevelWindow / 2), 0, m_SizeLevelWindow, m_SizeLevelWindow ),
					m_WindowNameSelectLevel );
			m_WindowLevel->ToggleOpen( );
			m_SpriteLevelSelected = g_GUI.AddSprite( "", GUI::SpriteDefinition(
						"",
						0,
						0,
						m_SizeLevelWindow,
						m_SizeLevelWindow),
					m_WindowNameLevel );

			CreateSpawnPointButtons( );
			LoadLevels( );
		}

		{ // Gameplay settings

			int gpsX = sizeLobby.x / 2;
			int gpsY = sizeLobby.y / 2;

			int gpsW = sizeLobby.x / 2;
			int gpsH = sizeLobby.y / 2;

			int gpsDiff = m_HeightComboBoxSelectLevel;

			int gpsStartCountW = gpsW - gpsDiff * 4 - gpsDiff * 3;

			m_WindowGamePlaySettings = g_GUI.AddWindow(m_WindowNameGamePlaySettings, GUI::Rectangle(gpsX, gpsY, gpsW, gpsH -m_HeightButton), m_WindowNameLobby, true);
			m_WindowGamePlaySettings->ToggleOpen();

			// | Starting units count | 
			m_BtnSpawnCount = g_GUI.AddButton("GamePlaySettingStartCount", GUI::Rectangle(gpsDiff, gpsDiff, gpsStartCountW, gpsDiff), m_WindowNameGamePlaySettings);
			m_BtnSpawnCount->GetBackgroundRef().Texture = m_TextureNameButtons;
			m_BtnSpawnCount->SetText("Starting units count");
			m_BtnSpawnCount->SetEnabled(false);

			// | Starting units count | - |
			m_BtnSpawnCountDec = g_GUI.AddButton("GamePlaySettingStartCountModDec", GUI::Rectangle(gpsStartCountW + gpsDiff, gpsDiff, gpsDiff, gpsDiff), m_WindowNameGamePlaySettings);
			m_BtnSpawnCountDec->GetBackgroundRef().Texture = m_TextureNameButtons;
			m_BtnSpawnCountDec->SetText("-");
			m_BtnSpawnCountDec->SetClickScript(m_ScriptChangeGameSetting + "(-1)");
			

			// | Starting units count | - | X |
			m_BtnSpawnCountVal = g_GUI.AddButton("GamePlaySettingStartCountVal", GUI::Rectangle(gpsStartCountW + gpsDiff * 2, gpsDiff, gpsDiff, gpsDiff), m_WindowNameGamePlaySettings);
			m_BtnSpawnCountVal->GetBackgroundRef().Texture = m_TextureNameButtons;
			m_BtnSpawnCountVal->SetText("X");
			m_BtnSpawnCountVal->SetEnabled(false);

			// | Starting units count | - | X | + |
			m_BtnSpawnCountInc = g_GUI.AddButton("GamePlaySettingStartCountModInc", GUI::Rectangle(gpsStartCountW + gpsDiff * 3, gpsDiff, gpsDiff, gpsDiff), m_WindowNameGamePlaySettings);
			m_BtnSpawnCountInc->GetBackgroundRef().Texture = m_TextureNameButtons;
			m_BtnSpawnCountInc->SetText("+");
			m_BtnSpawnCountInc->SetClickScript(m_ScriptChangeGameSetting + "(1)");
			
		}
	}
}