add wraparound support to C2 physics
[openc2e.git] / qtgui / BrainViewer.cpp
blobe00f6aa6012203014ed4d4c4311cc90b869a3c71
1 /*
2 This program is free software; you can redistribute it and/or modify
3 it under the terms of the GNU General Public License as published by
4 the Free Software Foundation; either version 2 of the License, or
5 (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License along
13 with this program; if not, write to the Free Software Foundation, Inc.,
14 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 #include "World.h"
18 #include "CreatureAgent.h"
19 #include "Creature.h"
21 #include "BrainViewer.h"
22 #include "tools/braininavat/brainview.h"
24 BrainViewer::BrainViewer(QWidget *parent) : QDialog(parent) {
25 scrollArea = new QScrollArea(this);
26 brainview = new BrainView();
27 scrollArea->setWidget(brainview);
29 brainview->threshold = 0.0f;
31 resize(600, 400);
33 QHBoxLayout *layout = new QHBoxLayout(this);
34 layout->addWidget(scrollArea);
36 setWindowTitle(tr("Brain Viewer"));
37 setAttribute(Qt::WA_QuitOnClose, false);
40 BrainViewer::~BrainViewer() {
41 delete brainview;
44 void BrainViewer::onTick() {
45 brainview->setCreature(0);
47 if (world.selectedcreature) {
48 CreatureAgent *a = dynamic_cast<CreatureAgent *>(world.selectedcreature.get());
49 if (a) {
50 brainview->setCreature(a->getCreature());
54 brainview->resize(brainview->minimumSize());
55 brainview->update();