⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 monitorframe.hh

📁 2007年机器人足球世界杯3D仿真组亚军
💻 HH
字号:
/* *  Little Green BATS (2006) * *  Authors: 	Martin Klomp (martin@ai.rug.nl) *		Mart van de Sanden (vdsanden@ai.rug.nl) *		Sander van Dijk (sgdijk@ai.rug.nl) *		A. Bram Neijt (bneijt@gmail.com) *		Matthijs Platje (mplatje@gmail.com) * *  Date: 	September 14, 2006 * *  Website:	http://www.littlegreenbats.nl * *  Comment:	Please feel free to contact us if you have any  *		problems or questions about the code. * * *  License: 	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 _BATS_MONITORFRAME_HH_#define _BATS_MONITORFRAME_HH_#include <wx/wx.h>#include <wx/glcanvas.h>#include <map>#include <vector>#include "vector3.hh"#include "gfxobject.hh"#include "gamemodel.hh"#include "monitorglcanvas.hh"#include "gameobject.hh"// Event type used to refresh the GL from other threads. Usage://// wxCommandEvent event(wxDO_REFRESH_EVT, -1);// wxPostEvent(pointerToMonitorFrame, event);DECLARE_EVENT_TYPE(wxDO_REFRESH_EVT, -1)DECLARE_EVENT_TYPE(wxDO_UPDATE_EVT, -1)namespace bats{  /**   *  The MonitorFrame is the graphical users interface of the monitor.   *  It uses wxGTK.   *   *   @see http://www.wxwidgets.org/   */  class MonitorFrame : public wxFrame  {  public:    enum    {      ID_Quit = 1,      ID_About,      ID_KickOff,      ID_CenterOnBall,      ID_SelectLeft,      ID_SelectRight,      ID_LeftCheck = 7,      ID_RightCheck = 18,    };        /**     *  @param title the window title.     *  @param pos the window initial position.     *  @param size the windows initial size.     *  @param the window style (see wxwidgets reference).     *  @param gameModel the monitors game model.     */    MonitorFrame(const wxString& title, const wxPoint& pos, const wxSize& size, int style, GameModel& gameModel);    /// Quite event    void OnQuit(wxCommandEvent& event);    void OnAbout(wxCommandEvent& event);      void OnKey(wxKeyEvent& event);    void OnPaint(wxPaintEvent& event) { wxCommandEvent e; paintGL(e); }    void update(wxCommandEvent& event);    void paintGL(wxCommandEvent& event);    void OnSelectTeam(wxCommandEvent& event);    /**     *  Sends the kickoff command to the socker server.     */    void kickOff(wxCommandEvent& event)    {      d_gameModel.lock();      std::cout << "Kickofff!!!" << endl;      d_gameModel.pushToSendQueue("(kickOff None)");      d_gameModel.unlock();    }    /**     *  @returns the camera position.     */    Vector3D const &getCamPos() const { return d_camPos; }    /**     *  @returns the camera lookat position.     */    Vector3D const &getCamLookAt() const { return d_camLookAt; }    /**     *  @returns the camera up heading.     */    Vector3D const &getCamUp() const { return d_camUp; }    /**     *  Sets the camera position to pos.     */    void moveCamPosTo(Vector3D pos) { d_camPos = pos; }    /**     *  Updates the camera position by dpos.     */    void moveCamPosBy(Vector3D dpos) { d_camPos = d_camPos + dpos; }    /**     *  Makes the camera look at pos.     */    void moveCamLookAtTo(Vector3D pos) { d_camLookAt = pos; }    /**     *  Updates the position to which the camera looks by dpos.     */    void moveCamLookAtBy(Vector3D dpos) { d_camLookAt = d_camLookAt + dpos; }    /**     *  Rotates the camera up to heading.     */    void rotateCamUpTo(Vector3D heading) { d_camUp = heading; }    /**     *  Rotates the camera up by dheading.     */    void rotateCamUpBy(Vector3D dheading) { d_camUp = d_camUp + dheading; }        /**     *  Resets the camera up to its default heading.     */    void resetCamUp();      private:    GFXObject      * d_gfxBall,      * d_gfxPlayerA,      * d_gfxPlayerB,      * d_gfxGoal,      * d_gfxFlag;    enum GameObjectID {      TeamOnePlayerFirst = 0, TeamOnePlayerLast = 10,      TeamTwoPlayerFirst = 11, TeamTwoPlayerLast = 21,      Ball = 22,      GoalFirst = 23, GoalLast = 26,      FlagFirst = 27, FlagLast = 30,      GameObjectCount,    };    std::vector<GameObject> d_gameObjects;    GameModel& d_gameModel;    // Widgets    wxBoxSizer*                   d_mainSizer;    wxBoxSizer*                   d_viewSizer;    wxFlexGridSizer*              d_settingsSizer;    wxBoxSizer*                   d_teamScoreSizer;    wxStaticText*                 d_leftTeamNameLabel;    wxStaticText*                 d_scoreLabel;    wxStaticText*                 d_rightTeamNameLabel;    wxTextCtrl*                   d_sayText;    wxCheckBox*                   d_selectAllLeft;    wxCheckBox*                   d_selectAllRight;    vector<wxCheckBox*>           d_playerCheckBoxes[2];      MonitorGLCanvas*              d_glCanvas;    wxButton*                     d_kickoffButton;    wxCheckBox*                   d_centerOnBallCheck;        char d_grassTex[512 * 512 * 3];    Vector3D d_camPos;    Vector3D d_camLookAt;    Vector3D d_camUp;    bool d_centerOnBall;        /**     *  Initalizes the graphics objects.     */    void createGFXObjects();    /**     *  Initializes the game objects.     */    void initGameObjects();    void drawField();    void drawObject(GameObject& object, bool shadow = true, bool gllist = true);    DECLARE_EVENT_TABLE();    };};#endif // _BATS_MONITORFRAME_HH_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -