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--2012: 00011 Stephane Magnenat <stephane at magnenat dot net> 00012 (http://stephane.magnenat.net) 00013 and other contributors, see authors.txt for details 00014 00015 This program is free software: you can redistribute it and/or modify 00016 it under the terms of the GNU Lesser General Public License as published 00017 by the Free Software Foundation, version 3 of the License. 00018 00019 This program is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 GNU Lesser General Public License for more details. 00023 00024 You should have received a copy of the GNU Lesser General Public License 00025 along with this program. If not, see <http://www.gnu.org/licenses/>. 00026 */ 00027 00028 #ifndef __CHALLENGE_H 00029 #define __CHALLENGE_H 00030 00031 #include <viewer/Viewer.h> 00032 #include <dashel/dashel.h> 00033 #include <QVector> 00034 00035 class QPushButton; 00036 class QCheckBox; 00037 #ifdef USE_SDL 00038 typedef struct _SDL_Joystick SDL_Joystick; 00039 #endif 00040 00041 namespace Enki 00042 { 00043 class PlaygroundViewer : public ViewerWidget, public Dashel::Hub 00044 { 00045 public: 00046 // these have to be public for the aseba C interface 00047 Dashel::Stream* stream; 00048 uint16 lastMessageSource; 00049 std::valarray<uint8> lastMessageData; 00050 QFont font; 00051 unsigned energyPool; 00052 #ifdef USE_SDL 00053 QVector<SDL_Joystick *> joysticks; 00054 #endif // USE_SDL 00055 00056 public: 00057 PlaygroundViewer(World* world); 00058 virtual ~PlaygroundViewer(); 00059 World* getWorld() { return world; } 00060 00061 protected: 00062 virtual void renderObjectsTypesHook(); 00063 virtual void sceneCompletedHook(); 00064 00065 virtual void connectionCreated(Dashel::Stream *stream); 00066 virtual void incomingData(Dashel::Stream *stream); 00067 virtual void connectionClosed(Dashel::Stream *stream, bool abnormal); 00068 00069 virtual void timerEvent(QTimerEvent * event); 00070 }; 00071 } 00072 00073 #endif 00074