#ifdef QT_WINDOW #include "hivewindow.h" #include "hive.h" #include "vanillahive.h" #include "settings.h" #include <QTimerEvent> Hive* hive; HiveWindow::HiveWindow(QWidget *parent, Qt::WFlags flags) : QGLWidget(parent, 0, flags) { loadsettings(); frametimer = startTimer( 10 ); eventtimer = startTimer( settings.eventms ); } HiveWindow::~HiveWindow() { } void HiveWindow::initializeGL() { hive = new VanillaHive( width(), height() ); } void HiveWindow::paintGL() { hive->step(); hive->paint(); } void HiveWindow::resizeGL( int w, int h ) { if ( hive ) hive->setSize( w, h ); } void HiveWindow::timerEvent( QTimerEvent* e ) { if ( e->timerId() == frametimer ) { update(); } if ( e->timerId() == eventtimer ) { hive->doEvent(); } } void HiveWindow::keyPressEvent(QKeyEvent*) { hive->doEvent(); } #endif
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 5898 | Sam Stafford |
Added a quick and dirty settings file, and with it, a bit of configurability. Still tweaking the numbers on maximum velocity and acceleration for the bees. |
||
#1 | 5893 | Sam Stafford | Check in work to date on "hive". |