2010-05-09 23:23:13 +02:00
|
|
|
|
// ==============================================================
|
|
|
|
|
// This file is part of Glest (www.glest.org)
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2001-2005 Marti<74>o Figueroa
|
|
|
|
|
//
|
|
|
|
|
// 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_MENUSTATEMASTERSERVER_H_
|
|
|
|
|
#define _GLEST_GAME_MENUSTATEMASTERSERVER_H_
|
|
|
|
|
|
|
|
|
|
#include "main_menu.h"
|
|
|
|
|
#include "masterserver_info.h"
|
2010-05-13 08:43:56 +02:00
|
|
|
|
#include "simple_threads.h"
|
2010-05-16 05:31:12 +02:00
|
|
|
|
#include "network_interface.h"
|
2010-05-09 23:23:13 +02:00
|
|
|
|
|
|
|
|
|
namespace Glest{ namespace Game{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ===============================
|
|
|
|
|
// ServerLine
|
|
|
|
|
// ===============================
|
|
|
|
|
|
|
|
|
|
class ServerLine {
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
MasterServerInfo *masterServerInfo;
|
|
|
|
|
int index;
|
|
|
|
|
GraphicButton selectButton;
|
|
|
|
|
|
|
|
|
|
//general info:
|
|
|
|
|
GraphicLabel glestVersionLabel;
|
|
|
|
|
GraphicLabel platformLabel;
|
|
|
|
|
GraphicLabel binaryCompileDateLabel;
|
|
|
|
|
|
|
|
|
|
//game info:
|
|
|
|
|
GraphicLabel serverTitleLabel;
|
|
|
|
|
GraphicLabel ipAddressLabel;
|
|
|
|
|
|
|
|
|
|
//game setup info:
|
|
|
|
|
GraphicLabel techLabel;
|
|
|
|
|
GraphicLabel mapLabel;
|
|
|
|
|
GraphicLabel tilesetLabel;
|
|
|
|
|
GraphicLabel activeSlotsLabel;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ServerLine( MasterServerInfo *mServerInfo, int lineIndex);
|
|
|
|
|
virtual ~ServerLine();
|
|
|
|
|
MasterServerInfo *getMasterServerInfo() const {return masterServerInfo;}
|
|
|
|
|
const int getIndex() const {return index;}
|
|
|
|
|
bool buttonMouseClick(int x, int y);
|
|
|
|
|
bool buttonMouseMove(int x, int y);
|
|
|
|
|
//void setIndex(int value);
|
|
|
|
|
void render();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ===============================
|
|
|
|
|
// class MenuStateMasterserver
|
|
|
|
|
// ===============================
|
|
|
|
|
typedef vector<ServerLine*> ServerLines;
|
|
|
|
|
typedef vector<MasterServerInfo*> MasterServerInfos;
|
|
|
|
|
|
2010-05-13 08:43:56 +02:00
|
|
|
|
class MenuStateMasterserver : public MenuState, public SimpleTaskCallbackInterface {
|
2010-05-09 23:23:13 +02:00
|
|
|
|
private:
|
|
|
|
|
GraphicButton buttonRefresh;
|
|
|
|
|
GraphicButton buttonReturn;
|
2010-05-15 20:40:58 +02:00
|
|
|
|
GraphicButton buttonCreateGame;
|
|
|
|
|
GraphicLabel labelAutoRefresh;
|
|
|
|
|
GraphicListBox listBoxAutoRefresh;
|
2010-05-09 23:23:13 +02:00
|
|
|
|
GraphicLabel labelTitle;
|
|
|
|
|
ServerLines serverLines;
|
|
|
|
|
|
|
|
|
|
GraphicMessageBox mainMessageBox;
|
|
|
|
|
int mainMessageBoxState;
|
|
|
|
|
|
2010-05-13 08:43:56 +02:00
|
|
|
|
bool needUpdateFromServer;
|
2010-05-15 20:40:58 +02:00
|
|
|
|
int autoRefreshTime;
|
|
|
|
|
time_t lastRefreshTimer;
|
2010-05-13 08:43:56 +02:00
|
|
|
|
SimpleTaskThread *updateFromMasterserverThread;
|
2010-05-09 23:23:13 +02:00
|
|
|
|
|
2010-05-16 05:31:12 +02:00
|
|
|
|
static DisplayMessageFunction pCB_DisplayMessage;
|
|
|
|
|
std::string threadedErrorMsg;
|
|
|
|
|
|
2010-05-09 23:23:13 +02:00
|
|
|
|
public:
|
|
|
|
|
MenuStateMasterserver(Program *program, MainMenu *mainMenu);
|
|
|
|
|
virtual ~MenuStateMasterserver();
|
|
|
|
|
|
|
|
|
|
void mouseClick(int x, int y, MouseButton mouseButton);
|
|
|
|
|
void mouseMove(int x, int y, const MouseState *mouseState);
|
|
|
|
|
void update();
|
|
|
|
|
void render();
|
|
|
|
|
|
2010-05-13 08:43:56 +02:00
|
|
|
|
virtual void simpleTask();
|
|
|
|
|
|
2010-05-16 05:31:12 +02:00
|
|
|
|
static void setDisplayMessageFunction(DisplayMessageFunction pDisplayMessage) { pCB_DisplayMessage = pDisplayMessage; }
|
|
|
|
|
|
2010-05-09 23:23:13 +02:00
|
|
|
|
private:
|
|
|
|
|
void showMessageBox(const string &text, const string &header, bool toggle);
|
|
|
|
|
void connectToServer(string ipString);
|
|
|
|
|
void clearServerLines();
|
|
|
|
|
void updateServerInfo();
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}}//end namespace
|
|
|
|
|
|
|
|
|
|
#endif
|