📄 monitor.h
字号:
/*************************************************************************** * Copyright (C) 2004 - 2006 by ZJUBase *
* National Lab of Industrial Control Tech. * * Zhejiang University, China *
* * * Team members: *
* Currently the team leader is, * * Hao JIANG (jianghao@iipc.zju.edu.cn; riveria@gmail.com) *
* In the next season, the leader will be * * Yifeng ZHANG (yfzhang@iipc.zju.edu.cn) *
* ZJUBase 3D agent is created by * * Dijun LUO (djluo@iipc.zju.edu.cn) *
* All the members who has ever contributed: * * Jun JIANG *
* Xinfeng DU (xfdu@iipc.zju.edu.cn) *
* Yang ZHOU (yzhou@iipc.zju.edu.cn) *
* Zhipeng YANG *
* Xiang FAN *
* *
* Team Manager: *
* Ms. Rong XIONG (rxiong@iipc.zju.edu.cn) *
* *
* If you met any problems or you have something to discuss about * * ZJUBase. Please feel free to contact us through EMails given below. * * * * This program is free software; you can redistribute it 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. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/
#ifndef _MONITOR_H_
#define _MONITOR_H_
#include "global.h"
#include "types.h"
#include "glserver.h"
#include "gamestate.h"
#include "commserverbase.h"
#include <string>
using namespace std;
//=======================
double cosDeg ( double x );
double sinDeg ( double x );
double tanDeg ( double x );
double atanDeg ( double x );
double atan2Deg( double x, double y );
double acosDeg ( double x );
double asinDeg ( double x );
double Rad2Deg ( double x );
double Deg2Rad ( double x );
//=======================
struct WM;
class Monitor {
public:
enum EReturnType { eOK, eOptions, eErrInit, eErrRun };
static Monitor* Instance() {return instMonitor;}
public:
Monitor();
bool Init(int argc, char *argv[]);
bool Run();
void Usage(int argc, char *argv[]);
void KeyBindings();
void Display(vector<string>& geoDebug, bool showReal, bool monitorOnly, WM& wm);
void MouseMotion(int x, int y);
void Keyboard(unsigned char key, int x, int y);
void SpecialKeys(int glutkey, int x, int y);
void Mouse(int button, int state, int x, int y);
void Reshape(int width, int height);
void Idle();
int& GetCycle() { return mCycle; }
void SetWindowWidth(int w) { mWidth = w; }
void SetWindowHeight(int h) { mHeight = h; }
static GLdouble sTeamColorLeft[4];
static GLdouble sTeamColorRight[4];
static GLdouble sTeamColorNoSeen[4];
private:
// typedefs, enums, constants
struct FlagInfo
{
Vector3 mOffset;
double mRadius;
GLdouble mColor[4];
};
enum ECameraMode { eFree, eFollowBall };
static Monitor* instMonitor;
typedef map<GameState::EFlagType, FlagInfo> TFlagInfoMap;
static const GLdouble sGroundColor[4];
static const GLdouble sGoalColor[4];
static const GLdouble sBorderColor[4];
static const GLdouble sLineColor[4];
static const GLdouble sSphereDefaultColor[4];
static GLdouble sBallColor[4];
static const GLdouble sUnumColor[4];
static const GLdouble sCenterRadius;
static const GLdouble sGoalBoxLength;
static const GLdouble sPenaltyLength;
static const double s2DLowX;
static const double s2DLowY;
static const double s2DScale;
private:
// methods
EReturnType InitInternal(int argc, char* argv[]);
void DrawScene(int pass, vector<string>& geoDebug, bool showReal, bool monitorOnly, WM& wm);
void DrawStatusLine();
void DrawStatusText();
Vector3 Get2DPos(const Vector3& pos);
void DrawOverview();
void DrawFlag(GameState::EFlagType i, Vector3 pos, int pass);
void DrawPlayer(TTeamIndex side, int unum, const Vector3& pos, double size, int pass);
void DrawBall(const Vector3& pos, double size, int pass);
void DrawBall(const Vector3& pos, double size, int pass, const Vector3& color);
//! successor of a camera mode
ECameraMode NextCameraMode(ECameraMode mode) const;
//! successor of a kick off mode
CommServerBase::EKickOff NextKickOffMode(CommServerBase::EKickOff mode) const;
public:
// member variables
GLServer mGLServer;
GameState mGameState;
GameState mGameStateReal;
private:
//! the zeitgeist core
// zeitgeist::Zeitgeist mZeitgeist;
//! the oxygen core
// oxygen::Oxygen mOxygen;
//! the monitor library
// MonitorLib mMonitorLib;
//! communication Server
CommServerBase* mCommServer;
//! window width
int mWidth;
//! window height
int mHeight;
//! mouse motion coordinates
Vector2 mMousePosition;
//! amount by which the camera is moved
double mCamDelta;
//! the current camera mode
ECameraMode mCameraMode;
//! the current kick off mode
CommServerBase::EKickOff mKickOff;
//! flag if we want to see uniform numbers
bool mDrawUnums;
//! flag if we want to draw the 2D overview
bool mDrawOverview;
// connection parameters
//! the server name
string mServer;
//! the port number
int mPort;
//! skip factor
int mSkip;
//! the current cycle
int mCycle;
//! flag informations for specific flags
TFlagInfoMap mFlagInfo;
//! default flag information (used for all flags not found in mFlagInfo)
FlagInfo mDefaultFlagInfo;
//JAN
//! flag for logserver
bool mLogserver;
//! flag for single step
bool mSingleStep;
//! flag for advancing 0 -- not advanced, 1 -- forward, -1 -- backward
char mAdvance;
//! flag for backward playing
bool mBackward;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -