00001 /* 00002 Playground - An active arena to learn multi-robots programming 00003 Copyright (C) 1999 - 2008: 00004 Stephane Magnenat <stephane at magnenat dot net> 00005 (http://stephane.magnenat.net) 00006 3D models 00007 Copyright (C) 2008: 00008 Basilio Noris 00009 Aseba - an event-based framework for distributed robot control 00010 Copyright (C) 2007--2009: 00011 Stephane Magnenat <stephane at magnenat dot net> 00012 (http://stephane.magnenat.net) 00013 Mobots group (http://mobots.epfl.ch) 00014 Laboratory of Robotics Systems (http://lsro.epfl.ch) 00015 EPFL, Lausanne (http://www.epfl.ch) 00016 00017 This program is free software: you can redistribute it and/or modify 00018 it under the terms of the GNU General Public License as published by 00019 the Free Software Foundation, either version 3 of the License, or 00020 any other version as decided by the two original authors 00021 Stephane Magnenat and Valentin Longchamp. 00022 00023 This program is distributed in the hope that it will be useful, 00024 but WITHOUT ANY WARRANTY; without even the implied warranty of 00025 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00026 GNU General Public License for more details. 00027 00028 You should have received a copy of the GNU General Public License 00029 along with this program. If not, see <http://www.gnu.org/licenses/>. 00030 */ 00031 00032 #ifndef __CHALLENGE_H 00033 #define __CHALLENGE_H 00034 00035 #include <viewer/Viewer.h> 00036 #include <dashel/dashel.h> 00037 #include <QVector> 00038 00039 class QPushButton; 00040 class QCheckBox; 00041 #ifdef USE_SDL 00042 typedef struct _SDL_Joystick SDL_Joystick; 00043 #endif 00044 00045 namespace Enki 00046 { 00047 class PlaygroundViewer : public ViewerWidget, public Dashel::Hub 00048 { 00049 public: 00050 // these have to be public for the aseba C interface 00051 Dashel::Stream* stream; 00052 uint16 lastMessageSource; 00053 std::valarray<uint8> lastMessageData; 00054 QFont font; 00055 unsigned energyPool; 00056 #ifdef USE_SDL 00057 QVector<SDL_Joystick *> joysticks; 00058 #endif // USE_SDL 00059 00060 public: 00061 PlaygroundViewer(World* world); 00062 virtual ~PlaygroundViewer(); 00063 World* getWorld() { return world; } 00064 00065 protected: 00066 virtual void renderObjectsTypesHook(); 00067 virtual void sceneCompletedHook(); 00068 00069 virtual void connectionCreated(Dashel::Stream *stream); 00070 virtual void incomingData(Dashel::Stream *stream); 00071 virtual void connectionClosed(Dashel::Stream *stream, bool abnormal); 00072 00073 virtual void timerEvent(QTimerEvent * event); 00074 }; 00075 } 00076 00077 #endif 00078