QTfrontend/hwform.cpp
changeset 2012 76fff564246b
parent 2010 bac82fb13a42
child 2026 21c986c528ba
--- a/QTfrontend/hwform.cpp	Mon Apr 20 17:45:01 2009 +0000
+++ b/QTfrontend/hwform.cpp	Thu Apr 23 13:54:25 2009 +0000
@@ -53,6 +53,7 @@
 #include "playrecordpage.h"
 #include "input_ip.h"
 #include "ammoSchemeModel.h"
+#include "bgwidget.h"
 
 HWForm::HWForm(QWidget *parent)
   : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
@@ -166,6 +167,12 @@
 	ui.pageScheme->setModel(ammoSchemeModel);
 	ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel);
 
+	wBackground = new BGWidget(this);
+	wBackground->setFixedSize(this->width(), this->height());
+	wBackground->lower();
+	wBackground->init();
+	wBackground->startAnimation();
+
 	PagesStack.push(ID_PAGE_MAIN);
 	GoBack();
 }
@@ -731,6 +738,7 @@
 	switch(gameState) {
 		case gsStarted: {
 			Music(false);
+			if (wBackground) wBackground->stopAnimation();	
 			GoToPage(ID_PAGE_INGAME);
 			ui.pageGameStats->clear();
 			if (pRegisterServer)
@@ -743,6 +751,7 @@
 		case gsFinished: {
 			GoBack();
 			Music(ui.pageOptions->CBEnableMusic->isChecked());
+			if (wBackground) wBackground->startAnimation();	
 			GoToPage(ID_PAGE_GAMESTATS);
 			if (hwnet) hwnet->gameFinished();
 			break;
@@ -752,6 +761,7 @@
 			if (id == ID_PAGE_INGAME) {
 				GoBack();
 				Music(ui.pageOptions->CBEnableMusic->isChecked());
+				if (wBackground) wBackground->startAnimation();	
 				if (hwnet) hwnet->gameFinished();
 			}
 		};
@@ -892,3 +902,11 @@
 	else
 		qWarning("Left room while not in room");
 }
+
+void HWForm::resizeEvent(QResizeEvent * event)
+{
+	int w = event->size().width();
+	int h = event->size().height();
+	wBackground->setFixedSize(w, h);
+	wBackground->move(0, 0);
+}