2010-03-22 00:40:35 +01:00
|
|
|
// ==============================================================
|
|
|
|
// This file is part of Glest (www.glest.org)
|
|
|
|
//
|
2010-04-02 04:33:32 +02:00
|
|
|
// Copyright (C) 2001-2005 Martio Figueroa
|
2010-03-22 00:40:35 +01:00
|
|
|
//
|
|
|
|
// You can redistribute this code and/or modify it under
|
|
|
|
// the terms of the GNU General Public License as published
|
|
|
|
// by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version
|
|
|
|
// ==============================================================
|
|
|
|
|
|
|
|
#ifndef _GLEST_GAME_MENUSTATEJOINGAME_H_
|
|
|
|
#define _GLEST_GAME_MENUSTATEJOINGAME_H_
|
|
|
|
|
2012-04-20 03:04:05 +02:00
|
|
|
#ifdef WIN32
|
|
|
|
#include <winsock2.h>
|
|
|
|
#include <winsock.h>
|
|
|
|
#endif
|
|
|
|
|
2010-03-22 00:40:35 +01:00
|
|
|
#include "properties.h"
|
|
|
|
#include "main_menu.h"
|
|
|
|
#include "chat_manager.h"
|
2010-04-02 04:33:32 +02:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2010-09-07 07:25:40 +02:00
|
|
|
#include "leak_dumper.h"
|
2010-03-22 00:40:35 +01:00
|
|
|
|
|
|
|
using Shared::Util::Properties;
|
|
|
|
|
|
|
|
namespace Glest{ namespace Game{
|
|
|
|
|
|
|
|
class NetworkMessageIntro;
|
|
|
|
|
|
|
|
// ===============================
|
|
|
|
// class MenuStateJoinGame
|
|
|
|
// ===============================
|
|
|
|
|
2010-04-02 04:33:32 +02:00
|
|
|
class MenuStateJoinGame: public MenuState, public DiscoveredServersInterface {
|
2010-03-22 00:40:35 +01:00
|
|
|
private:
|
|
|
|
static const int newServerIndex;
|
2010-04-30 08:45:30 +02:00
|
|
|
static const int newPrevServerIndex;
|
|
|
|
static const int foundServersIndex;
|
2010-03-22 00:40:35 +01:00
|
|
|
static const string serverFileName;
|
|
|
|
|
|
|
|
private:
|
|
|
|
GraphicButton buttonReturn;
|
|
|
|
GraphicButton buttonConnect;
|
2010-04-02 04:33:32 +02:00
|
|
|
GraphicButton buttonAutoFindServers;
|
2011-10-30 23:23:57 +01:00
|
|
|
GraphicButton buttonCreateGame;
|
|
|
|
|
2010-03-22 00:40:35 +01:00
|
|
|
GraphicLabel labelServer;
|
|
|
|
GraphicLabel labelServerType;
|
|
|
|
GraphicLabel labelServerIp;
|
|
|
|
GraphicLabel labelStatus;
|
|
|
|
GraphicLabel labelInfo;
|
|
|
|
GraphicListBox listBoxServerType;
|
|
|
|
GraphicListBox listBoxServers;
|
2010-04-30 08:45:30 +02:00
|
|
|
GraphicListBox listBoxFoundServers;
|
2010-04-03 19:17:15 +02:00
|
|
|
GraphicLabel labelServerPort;
|
|
|
|
GraphicLabel labelServerPortLabel;
|
|
|
|
|
2010-03-22 00:40:35 +01:00
|
|
|
|
|
|
|
bool connected;
|
|
|
|
int playerIndex;
|
|
|
|
Properties servers;
|
|
|
|
|
2011-04-15 03:05:36 +02:00
|
|
|
//Console console;
|
2010-03-22 00:40:35 +01:00
|
|
|
ChatManager chatManager;
|
|
|
|
|
|
|
|
string serversSavedFile;
|
2010-05-13 23:47:14 +02:00
|
|
|
bool abortAutoFind;
|
2010-06-22 17:03:57 +02:00
|
|
|
bool autoConnectToServer;
|
2010-03-22 00:40:35 +01:00
|
|
|
|
|
|
|
public:
|
2012-09-25 23:52:23 +02:00
|
|
|
MenuStateJoinGame(Program *program, MainMenu *mainMenu, bool connect= false, Ip serverIp= Ip(),int portNumberOverride=-1);
|
2012-10-06 02:25:13 +02:00
|
|
|
MenuStateJoinGame(Program *program, MainMenu *mainMenu, bool *autoFindHost);
|
2010-04-02 04:33:32 +02:00
|
|
|
virtual ~MenuStateJoinGame();
|
2010-03-22 00:40:35 +01:00
|
|
|
|
|
|
|
void mouseClick(int x, int y, MouseButton mouseButton);
|
|
|
|
void mouseMove(int x, int y, const MouseState *mouseState);
|
|
|
|
void render();
|
|
|
|
void update();
|
2011-06-26 03:55:08 +02:00
|
|
|
virtual void keyDown(SDL_KeyboardEvent key);
|
|
|
|
virtual void keyPress(SDL_KeyboardEvent c);
|
2010-03-22 00:40:35 +01:00
|
|
|
|
2010-07-29 07:24:51 +02:00
|
|
|
virtual bool isInSpecialKeyCaptureEvent() { return chatManager.getEditEnabled(); }
|
|
|
|
|
2011-10-25 20:39:11 +02:00
|
|
|
void reloadUI();
|
|
|
|
|
2010-03-22 00:40:35 +01:00
|
|
|
private:
|
2012-10-06 02:25:13 +02:00
|
|
|
|
|
|
|
void CommonInit(bool connect, Ip serverIp,int portNumberOverride);
|
2013-06-01 19:40:34 +02:00
|
|
|
bool connectToServer();
|
2010-04-02 04:33:32 +02:00
|
|
|
virtual void DiscoveredServers(std::vector<string> serverList);
|
2010-03-22 00:40:35 +01:00
|
|
|
};
|
|
|
|
}}//end namespace
|
|
|
|
|
|
|
|
#endif
|