Example #1
0
MainWindow::MainWindow()  {
    //We need a scene and a view to do graphics in QT
    scene = new QGraphicsScene();
    view = new QGraphicsView( scene );
		
		//This adds a button to the window and connects it to the timer
		button = new QPushButton("Start/Stop", view);
    connect(button, SIGNAL(clicked()), this, SLOT(buttonPress()));

    //To fill a rectangle use a QBrush. To draw the border of a shape, use a QPen
    QBrush redBrush(Qt::red);

    //First 2 arguments are the x, y, of the upper left of the rectangle.
    //The second 2 arguments are the width and height
    //The last 2 arguments are the velocity in the x, and y, directions
    item = new BouncingRectangle( 11.0, 74.0, 20.0, 20.0, 2, 3 );
    item->setBrush( redBrush );
    scene->addItem( item );

    //This sets the size of the window and gives it a title.
    view->setFixedSize( WINDOW_MAX_X*2, WINDOW_MAX_Y*2 );
    view->setWindowTitle( "Bouncing Rectangles!");

    //This is how we do animation. We use a timer with an interval of 5 milliseconds
    //We connect the signal from the timer - the timeout() function to a function
    //of our own - called handleTimer - which is in this same MainWindow class
    timer = new QTimer(this);
    timer->setInterval(5);
    connect(timer, SIGNAL(timeout()), this, SLOT(handleTimer()));
    
    timer2 = new QTimer(this);
    timer2->setInterval(250);
    connect(timer2, SIGNAL(timeout()), this, SLOT(addRectangle()));

}
Example #2
0
GameOver::GameOver(MainWindow* parent)
{
    parent_ = parent;

    scene_ = new QGraphicsScene();
    setScene(scene_);

    QBrush silverBrush(QColor(227,228,229));
    gameOverText = new QGraphicsSimpleTextItem("GAME OVER");
    QFont myFont("Helvetica [Cronyx]",70,QFont::Bold);
    gameOverText->setFont(myFont);
    gameOverText->setBrush(silverBrush);
    scene_->addItem(gameOverText);
    gameOverText->setPos(300,170);

    QBrush blackBrush(QColor(0,0,0));
    clickText = new QGraphicsSimpleTextItem("Click File->New Game to play again!");
    QFont bFont("Helvetica [Cronyx]",30,QFont::Bold);
    clickText->setFont(bFont);
    clickText->setBrush(blackBrush);
    scene_->addItem(clickText);
    clickText->setPos(250,300);

    counter = 0;
    timer_ = new QTimer(this);
    timer_->setInterval(1000);
    connect(timer_,SIGNAL(timeout()),this,SLOT(handleTimer()));
    timer_->start();
}
WarningWidget::WarningWidget(QWidget *parent) : TWidget(parent)
, _secondsLeft(kWaitBeforeRevertMs / 1000)
, _keepChanges(this, lang(lng_theme_keep_changes), st::defaultBoxButton)
, _revert(this, lang(lng_theme_revert), st::defaultBoxButton) {
	_keepChanges->setClickedCallback([] { Window::Theme::KeepApplied(); });
	_revert->setClickedCallback([] { Window::Theme::Revert(); });
	_timer.setTimeoutHandler([this] { handleTimer(); });
	updateText();
}
ConsoleWidget::ConsoleWidget(MainWindow *main) : QPlainTextEdit((QWidget *)main)
{
    m_main = main;
    m_suppress = false;
    m_histIndex = -1;
    // a block is a line, so this is the maximum number of lines to buffer
    setMaximumBlockCount(CW_SCROLLHEIGHT);
    acceptInput(false);
    connect(&m_timer, SIGNAL(timeout()), this, SLOT(handleTimer()));
}
// The ctor.
ScintillaQt::ScintillaQt(QsciScintillaBase *qsb_)
    : capturedMouse(false), qsb(qsb_)
{
    wMain = qsb->viewport();

    // We aren't a QObject so we use the API class to do QObject related things
    // for us.
    qsb->connect(&qtimer, SIGNAL(timeout()), SLOT(handleTimer()));
    
    Initialise();
}
Example #6
0
/** Constructor. Loads pictures, builds the game area, and initializes flag values
* @param parent Pointer to the parent MainWindow. This is passed to QGraphicsView
*/
GameSpace::GameSpace(MainWindow* parent)
:
	QGraphicsView(parent)
{
	parent_ = parent;
	
	// Initialize scene
	scene_ = new QGraphicsScene;
	setScene(scene_);
	
	// Create the background (important that this is the first image added to the scene)
	backgroundPics_.push_back(new QPixmap("images/dirt_background_800.png")); // 0 (theoretically, a title screen)
	backgroundPics_.push_back(new QPixmap("images/dirt_background_800.png")); // 1
	backgroundPics_.push_back(new QPixmap("images/netherBrick_background_800.png")); // 2
	backgroundPics_.push_back(new QPixmap("images/whiteStone_background_800.png")); // 3
	backgroundPicItem_ = new QGraphicsPixmapItem(*backgroundPics_[0]);
	scene_->addItem(backgroundPicItem_);
	backgroundPicItem_->setZValue(-1);
	
	// Initialize player
	stevePic_ = new QPixmap("images/steve.png");
	player_ = NULL; // we will initialize Steve in the first game
	
	// Initialize pixmaps for enemies
	zombiePic_ = new QPixmap("images/zombie.png");
	spiderPic_ = new QPixmap("images/spider.png");
	creeperPic_ = new QPixmap("images/creeper.png");
	skeletonPic_ = new QPixmap("images/skeleton.png");
	endermanPic_ = new QPixmap("images/enderman.png");
	
	// Initialize item pixmaps
	heartPic_ = new QPixmap("images/heart.png");
	potionStrengthPic_ = new QPixmap("images/potion_strength.png");
	
	// Initialize timer
	timer_ = new QTimer(this);
	timer_->setInterval(1); // this is kept low so that the player's update speed is fast and so we have specific control over the speed of all game events
	connect(timer_, SIGNAL(timeout()), this, SLOT(handleTimer()));
	
	// Enable mouse capture
	setMouseTracking(true);
	setFocus();
	
	// Initialize score
	score_ = 0;
	
	// Initialize level
	level_ = 0; // because we haven't started a game yet
	
	// Initialize game status flags
	gameInProgress_ = false;
	gameOverFlag_ = false;
}
QvisReflectWidget::QvisReflectWidget(QWidget *parent) : 
    QWidget(parent), renderer(250,250)
{
    setMinimumSize(250,250);
    rendererCreated = false;
    mode2D = true;

    for(int i = 0; i < 8; ++i)
        octantOn[i] = false;
    originOctant = 0;
    octantOn[originOctant] = true;

    createSharedElements();

    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()),
            this, SLOT(handleTimer()));
    cameraInterpolant = 0.;
    switchingCameras = false;
    activeCamera = 0;
}
Example #8
0
void DlgFmncPrjImpelb::handleRequest(
			DbsFmnc* dbsfmnc
			, ReqFmnc* req
		) {
	if (req->ixVBasetype == ReqFmnc::VecVBasetype::CMD) {
		reqCmd = req;

		if (req->cmd.compare("cmdset") == 0) {

		} else {
			cout << "\tinvalid command!" << endl;
		};

		if (!req->retain) reqCmd = NULL;

	} else if (req->ixVBasetype == ReqFmnc::VecVBasetype::REGULAR) {
		if (req->dpchapp->ixFmncVDpch == VecFmncVDpch::DPCHAPPFMNCINIT) {
			handleDpchAppFmncInit(dbsfmnc, (DpchAppFmncInit*) (req->dpchapp), &(req->dpcheng));

		} else if (req->dpchapp->ixFmncVDpch == VecFmncVDpch::DPCHAPPDLGFMNCPRJIMPELBDATA) {
			DpchAppData* dpchappdata = (DpchAppData*) (req->dpchapp);

			if (dpchappdata->has(DpchAppData::CONTIAC)) {
				handleDpchAppDataContiac(dbsfmnc, &(dpchappdata->contiac), &(req->dpcheng));
			};

		} else if (req->dpchapp->ixFmncVDpch == VecFmncVDpch::DPCHAPPDLGFMNCPRJIMPELBDO) {
			DpchAppDo* dpchappdo = (DpchAppDo*) (req->dpchapp);

			if (dpchappdo->ixVDo != 0) {
				if (dpchappdo->ixVDo == VecVDo::BUTDNECLICK) {
					handleDpchAppDoButDneClick(dbsfmnc, &(req->dpcheng));
				};

			} else if (dpchappdo->ixVDoImp != 0) {
				if (dpchappdo->ixVDoImp == VecVDoImp::BUTRUNCLICK) {
					handleDpchAppDoImpButRunClick(dbsfmnc, &(req->dpcheng));
				} else if (dpchappdo->ixVDoImp == VecVDoImp::BUTSTOCLICK) {
					handleDpchAppDoImpButStoClick(dbsfmnc, &(req->dpcheng));
				};

			};

		} else if (req->dpchapp->ixFmncVDpch == VecFmncVDpch::DPCHAPPFMNCALERT) {
			handleDpchAppFmncAlert(dbsfmnc, (DpchAppFmncAlert*) (req->dpchapp), &(req->dpcheng));

		};
// IP handleRequest.upload --- BEGIN

	} else if (req->ixVBasetype == ReqFmnc::VecVBasetype::UPLOAD) {
		handleUpload(dbsfmnc, req->filename);
// IP handleRequest.upload --- END
// IP handleRequest.download --- BEGIN

	} else if (req->ixVBasetype == ReqFmnc::VecVBasetype::DOWNLOAD) {
		req->filename = handleDownload(dbsfmnc);
// IP handleRequest.download --- END
// IP handleRequest.timer --- BEGIN

	} else if (req->ixVBasetype == ReqFmnc::VecVBasetype::TIMER) {
		handleTimer(dbsfmnc, req->sref);
// IP handleRequest.timer --- END
	};
};
Example #9
0
MainWindow::MainWindow() : QMainWindow(){
	// Initialize variables
	pvx = 0; pvy = 0;
	attack = 1;
	pattack = false;
	paused = false;
	maxhp = 10;
	level = 1;
	pauseMe = 0;
	human = NULL;
	anim = 0;

	// Master Timer
	timer = new QTimer;
	gameSpeed = 14;
	timer->setInterval(gameSpeed);
	srand(time(0));

	// Secondary Timer
	timer2 = new QTimer;
	timer2->setInterval(100);

	// Load ALL THE PICTURES
	ab1 = new QPixmap("images/actualblue-1.png");
	ab2 = new QPixmap("images/actualblue-2.png");
	ag1 = new QPixmap("images/actualgreen-1.png");
	ag2 = new QPixmap("images/actualgreen-2.png");
	apl = new QPixmap("images/actualplayer.png");
	ap = new QPixmap("images/actualpurple.png");
	ar1 = new QPixmap("images/actualred-1.png");
	ar2 = new QPixmap("images/actualred-2.png");
	ar3 = new QPixmap("images/actualred-3.png");
	ay = new QPixmap("images/actualyellow.png");
	app = new QPixmap("images/actualpink.png");

	pbullet = new QPixmap("images/bullet.png");
	bbullet = new QPixmap("images/bluebullet.png");
	gbullet = new QPixmap("images/greenbullet.png");
	ppbullet = new QPixmap("images/pinkbullet.png");
	ybullet = new QPixmap("images/yellowbullet.png");
	widebulletpic = new QPixmap("images/redbullet.png");
	heartpic = new QPixmap("images/heart.png");
	rainbow = new QPixmap("images/rainbow.png");

	bg1 = new QPixmap("images/background.png");
	bg2 = new QPixmap("images/background2.png");
	bg3 = new QPixmap("images/background3.png");

	// This is for the hearts
	h1 = new QGraphicsPixmapItem(*heartpic);
	h1->setPos(400, 575);
	h1->setVisible(false);
	h2 = new QGraphicsPixmapItem(*heartpic);
	h2->setPos(375, 575);
	h2->setVisible(false);
	h3 = new QGraphicsPixmapItem(*heartpic);
	h3->setPos(350, 575);
	h3->setVisible(false);
	h4 = new QGraphicsPixmapItem(*heartpic);
	h4->setPos(325, 575);
	h4->setVisible(false);
	h5 = new QGraphicsPixmapItem(*heartpic);
	h5->setPos(300, 575);
	h5->setVisible(false);

	// Initialize the Scenes and Views
	gameScene = new GScene(this);
	gameView = new QGraphicsView(gameScene);
	mainScene = new QGraphicsScene;
	mainView = new QGraphicsView(mainScene);

	mainView->setWindowTitle("Starships (were meant to fly...)");

	// Now add the hearts 
	gameScene->addItem(h1);
	gameScene->addItem(h2);
	gameScene->addItem(h3);
	gameScene->addItem(h4);
	gameScene->addItem(h5);

	// Make the layouts
	holder = new QWidget;
	holder2 = new QWidget;
	holder3 = new QWidget;
	layout = new QVBoxLayout(holder);
	layout2 = new QHBoxLayout(holder2);
	layout3 = new QHBoxLayout(holder3);

	//Set the attributes to the game scene
	QBrush bg(*bg1);
	gameScene->setBackgroundBrush(bg);
	gameScene->setSceneRect(0,0,425,600);
	gameView->setFixedSize(430,605);
	gameView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	gameView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	// Make buttons
	// Players love buttons
	startB = new QPushButton("Start");
	startB->setGeometry(160, 475, 100, 60);
	startB->setStyleSheet("background-color:rgba(0,0,0,0); color:#ffffff; font-size:36px;");
	gameScene->addWidget(startB);

	restartB = new QPushButton("Start");
	restartB->setFixedHeight(28);
	pauseB = new QPushButton("Pause");
	pauseB->setFixedHeight(28);
	endB = new QPushButton("Quit");
	endB->setFixedHeight(28);

	nameB = new QTextEdit;
	nameB->setFixedHeight(28);
	nameB->setStyleSheet("background-color:rgb(0,0,0); color:#ffffff;");

	// Connecting the timers and buttons 
	connect(timer, SIGNAL(timeout()), this, SLOT(handleTimer()));
	connect(timer2, SIGNAL(timeout()), this, SLOT(nextLevel()));
	connect(startB, SIGNAL(clicked()), this, SLOT(startGame()));
	connect(pauseB, SIGNAL(clicked()), this, SLOT(pauseGame()));
	connect(endB, SIGNAL(clicked()), this , SLOT(quitGame()));
	connect(restartB, SIGNAL(clicked()), this , SLOT(restartGame()));

	// Make the labels  
	nameL = new QTextEdit;
	nameL->setStyleSheet("background-color:rgb(0,0,0); color:#ffffff;");
	nameL->setFixedHeight(28);
	nameL->setFixedWidth(200);
	nameL->setReadOnly(true);
	layout3->addWidget(nameL);

	scoreL = new QTextEdit;
	scoreL->setStyleSheet("background-color:rgb(0,0,0); color:#ffffff;");
	scoreL->setFixedHeight(28);
	scoreL->setFixedWidth(130);
	scoreL->setReadOnly(true);
	layout3->addWidget(scoreL);

	hpL = new QTextEdit;
	hpL->setStyleSheet("background-color:rgb(0,0,0); color:#ffffff;");
	hpL->setFixedHeight(28);
	hpL->setFixedWidth(80);
	hpL->setReadOnly(true);
	layout3->addWidget(hpL);

	errorL = new QLabel;
	errorL->setStyleSheet("background-color:rgba(0,0,0,1); color:#ffffff; font-size:24px;");
	errorL->setGeometry(QRect(60,520,380,80));
	gameScene->addWidget(errorL);

	nextWave = new QLabel("Get ready for the next wave!");
	nextWave->setStyleSheet("background-color:rgba(0,0,0,1); color:#ffffff; font-size:24px;");
	nextWave->setGeometry(QRect(55,220,380,80));
	nextWave->hide();
	gameScene->addWidget(nextWave);

	endScore = new QLabel;
	endScore->setStyleSheet("background-color:rgba(0,0,0,1); color:#ffffff; font-size:26px;");
	endScore->setGeometry(QRect(0,40,425,80));
	endScore->setAlignment(Qt::AlignCenter);
	endScore->hide();
	gameScene->addWidget(endScore);

	scoreList = new QLabel;
	scoreList->setStyleSheet("background-color:rgba(0,0,0,1); color:#ffffff; font-size:26px;");
	scoreList->setGeometry(QRect(0,55,425,500));
	scoreList->setAlignment(Qt::AlignCenter);
	scoreList->hide();
	gameScene->addWidget(scoreList);

	// Set the layouts
	layout2->addWidget(restartB);
	layout2->addWidget(pauseB);
	layout2->addWidget(endB);
	layout->addWidget(holder2);
	layout->addWidget(gameView);
	layout->addWidget(nameB);
	holder3->setVisible(false);
	layout->addWidget(holder3);
	layout->setContentsMargins(0, 0, 0, 0);
	layout->setMargin(0);
	layout2->setContentsMargins(0, 0, 0, 0);
	layout2->setMargin(0);
	layout3->setContentsMargins(0, 0, 0, 0);
	layout3->setMargin(0);

	mainScene->addWidget(holder);
	mainView->setFixedSize(460,710);
	mainView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	mainView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	// Setting these for faster rendering
	gameView->setAttribute(Qt::WA_OpaquePaintEvent);
	gameView->setAttribute(Qt::WA_NoSystemBackground);
	mainView->setAttribute(Qt::WA_OpaquePaintEvent);
	mainView->setAttribute(Qt::WA_NoSystemBackground);
	mainView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
	gameView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
}
/*!

*/
MonitorClient::MonitorClient( QObject * parent,
                              DispHolder & disp_holder,
                              const char * hostname,
                              const int port,
                              const int version )

    : QObject( parent )
    , M_disp_holder( disp_holder )
    , M_server_port( static_cast< quint16 >( port ) )
    , M_socket( new QUdpSocket( this ) )
    , M_timer( new QTimer( this ) )
    , M_version( version )
    , M_waited_msec( 0 )
{
    assert( parent );

    // check protocl versin range
    if ( version < 1 )
    {
        M_version = 1;
    }

    if ( 4 < version )
    {
        M_version = 4;
    }

    QHostInfo host = QHostInfo::fromName( QString::fromAscii( hostname ) );

    if ( host.error() != QHostInfo::NoError )
    {
        qDebug() << "Error " << host.errorString();
        return;
    }

    M_server_addr = host.addresses().front();

    // INADDR_ANY, bind random created port to local
    if ( ! M_socket->bind( 0 ) )
    {
        std::cerr << "MonitorClient. failed to bind the socket."
                  << std::endl;
        return;
    }

    if ( ! isConnected() )
    {
        std::cerr << "MonitorClient. failed to initialize the socket."
                  << std::endl;
        return;
    }

    // setReadBufferSize() makes no effect for QUdpSocet...
    // M_socket->setReadBufferSize( 8192 * 256 );

    connect( M_socket, SIGNAL( readyRead() ),
             this, SLOT( handleReceive() ) );

    connect( M_timer, SIGNAL( timeout() ),
             this, SLOT( handleTimer() ) );

}
Example #11
0
/** Default constructor */
MainWindow::MainWindow() : QWidget()
{
	/** constructor() that has in input file for scores */
	ifstream fin;
	fin.open("scores.txt");
	if(fin.fail())
	{
		cout << "Could not find the scores file" << endl;
	}
	else
	{
	  string temp;
	  int temp2;
	  getline(fin,temp,'|');
	  fin >> temp2;
		while(fin.good())
		{
			scorenames.push_back(temp);
			scores.push_back(temp2);
			getline(fin,temp,'|');
			fin >> temp2;
		}
	}
	  
	/** Set the Pixmaps */
	ez=new QPixmap("ezreal.png");
		*ez=ez->scaled(75,75,Qt::KeepAspectRatioByExpanding);
	melee=new QPixmap("meleeminion.png");
		*melee=melee->scaled(50,50,Qt::KeepAspectRatioByExpanding);
	caster=new QPixmap("casterminion.png");
		*caster=caster->scaled(45,45,Qt::KeepAspectRatioByExpanding);
	siege=new QPixmap("siegeminion.png");
		*siege=siege->scaled(65,65,Qt::KeepAspectRatioByExpanding);
	basic=new QPixmap("basicattack.gif");
		*basic=basic->scaled(10,10,Qt::KeepAspectRatioByExpanding);
	mystic=new QPixmap("basicattack.gif");
		*mystic=mystic->scaled(30,30,Qt::KeepAspectRatioByExpanding);
	trueshot=new QPixmap("trueshot.png");
		*trueshot=trueshot->scaled(75,75,Qt::KeepAspectRatioByExpanding);
	heal=new QPixmap("heal.png");
		*heal=heal->scaled(50,50,Qt::KeepAspectRatioByExpanding);
	clarity=new QPixmap("clarity.png");
		*clarity=clarity->scaled(50,50,Qt::KeepAspectRatioByExpanding);
	ignite=new QPixmap("ignite.png");
		*ignite=ignite->scaled(50,50,Qt::KeepAspectRatioByExpanding);
	energy=new QPixmap("energybolt.gif");
		*energy=energy->scaled(50,50,Qt::KeepAspectRatioByExpanding);
	cannon=new QPixmap("cannonshot.png");
		*cannon=cannon->scaled(55,55,Qt::KeepAspectRatioByExpanding);
	/** color is the default color set for spacers and background of widgets*/
	color.setRgb(240,240,240,255);
	/** MainWidget which holds everything */
	mainwidget= new QWidget;
	mainwidget->setFixedSize(1200,800);
	/** Main Layout for MainWindow */
	mainLayout = new QVBoxLayout;
	mainwidget->setLayout(mainLayout);
	  /** TITLE above row1*/
	  row0 = new QHBoxLayout;
	  	/** IconObject used to display QPixmap */
	    	hold_spacer0 = new IconObject;
	  	/** Used to hold a space */
	  	spacer0 = new QPixmap(100,64);
	  	spacer0->fill(color);
	  	/** IconObject used to display QPixmap */
	    	hold_title = new IconObject;
	    	/** Ability display icon */
	  	title = new QPixmap("title.png");
	  	/** IconObject used to display QPixmap */
	    	hold_spacer01 = new IconObject;
	  	/** Used to hold a space */
	  	spacer01 = new QPixmap(100,64);
	  	spacer01->fill(color);
	  	// set pixmaps
	  	hold_spacer0->setPixmap(*spacer0);
	  	hold_title->setPixmap(title->scaled(700,40,Qt::KeepAspectRatioByExpanding));
	  	hold_spacer0->setPixmap(*spacer01);
	  	//add to layout row0
	  	row0->addWidget(hold_spacer0);
	  	row0->addWidget(hold_title);
	  	row0->addWidget(hold_spacer01);
	  	mainLayout->addLayout(row0);
	  /** Horizontal box for row 1*/
	  row1= new QHBoxLayout;
	  	/** Button which initiates/restarts game*/
		start= new QPushButton("Start");
		/** Button which pauses/continues game*/
		pause = new QPushButton("Pause");
		/** quits the game*/
		quit = new QPushButton("Quit");
		/** Score display*/
		name = new QTextEdit("Name");
		name->setMaximumHeight(30);
		name->setMaximumWidth(200);
		/** level display*/
		level = new QLabel("LEVEL: 00");
		/** score display*/
		score = new QLabel("SCORE: 00");
	    row1->addWidget(start);
	    row1->addWidget(pause);
	    row1->addWidget(quit);
	    row1->addWidget(name);
	    row1->addWidget(level);
	    row1->addWidget(score);
	    mainLayout->addLayout(row1);
	  /** Horizontal box for row 2*/
	  row2 = new QHBoxLayout;
	  	/** Scene which holds monsters, player and powerups*/
	  	scene = new QGraphicsScene;
	  	/** View which holds gameplay*/
	  	view = new GameWindow(scene);
	    row2->addWidget(view);
	    mainLayout->addLayout(row2);
	  /** Horizontal box for row 3*/
	  row3 = new QHBoxLayout;
	    //left
	    	/** IconObject used to display QPixmap */
	    	hold_basicattackicon = new IconObject;
	    	/** Ability display icon */
	  	basicattackicon = new QPixmap("basicattack.gif");
	  	/** IconObject used to display QPixmap */
	    	hold_mysticshoticon = new IconObject;
	  	/** Ability display icon */
	  	mysticshoticon = new QPixmap("basicattack.gif");
	  	//mysticshoticon->scaledToHeight(64,Qt::FastTransformation);
	  	/** IconObject used to display QPixmap */
	    	hold_trueshoticon = new IconObject;
	  	/** Ability display icon */
	  	trueshoticon = new QPixmap("trueshot.png");
	  	/** IconObject used to display QPixmap */
	    	hold_spacer1 = new IconObject;
	  	/** Used to hold a space */
	  	spacer1 = new QPixmap(400,64);
	  	spacer1->fill(color);
	    //midleft
	    	/** IconObject used to display QPixmap */
	    	hold_heart = new IconObject;
	    	/** Heart Icon */
	    	heart = new QPixmap("heart.gif");
	    	/** Health display */
	    	health = new QLabel("200");
	    	health->setMaximumHeight(25);
	    	/** IconObject used to display QPixmap */
	    	hold_spacer2 = new IconObject;
	    	/** Used to hold a space */
	  	spacer2 = new QPixmap(64,64);
	  	spacer2->fill(color);
	    //midright
	    	/** IconObject used to display QPixmap */
	    	hold_potion = new IconObject;
	    	/** Mana Icon */
	    	potion = new QPixmap("mana.gif");
	    	/** Mana display */
	    	mana= new QLabel("50");
	    	mana->setMaximumHeight(25);
	    	
	    /*Add the Pixmaps to the IconObjects*/
	    hold_basicattackicon->setPixmap(basicattackicon->scaledToHeight(10));
	    hold_mysticshoticon->setPixmap(mysticshoticon->scaledToHeight(20));
	    hold_trueshoticon->setPixmap(trueshoticon->scaled(40,60,Qt::KeepAspectRatioByExpanding));
	    hold_spacer1->setPixmap(*spacer1);
	    hold_heart->setPixmap(*heart);
	    hold_spacer2->setPixmap(*spacer2);
	    hold_potion->setPixmap(*potion);
	    /* Add IconObjects to row3 */
	    row3->addWidget(hold_basicattackicon);
	    row3->addWidget(hold_mysticshoticon);
	    row3->addWidget(hold_trueshoticon);
	    row3->addWidget(hold_spacer1);
	    row3->addWidget(hold_heart);
	    row3->addWidget(health);
	    row3->addWidget(hold_spacer2);
	    row3->addWidget(hold_potion);
	    row3->addWidget(mana);
	    /* Add layout to main widget*/
	    mainLayout->addLayout(row3);
	    
	// set player
	  //objects.push_back(
	//set bool variables
	trueshotfiring = false;
	inGame = false;
	gamePaused = false;
	playerAlive = false;
	up = false;
	down = false;
	left = false;
	right = false;
	grabbedignite=false;
	lostgame=false;
	//set counters
	/** Level identifies which level the game is at */
	levelff=1;
	/** Leftclickcounter determines how many times left click is pressed */
	leftclickcounter=0;
	/** Leftclickholdcounter determines how long left click is pressed */
	leftclickholdcounter=0;
	/** Spawn counter for a meleeminoin */
	spawnmelee=0;
	/** Spawn counter for a Siegeminion*/
	spawnsiege=0;	
	/** Spawn counter for a Casterminion*/
	spawncaster=0;
	/** Ez can not be hurt immediately at next clock 
	  *giving the player time to move out of the way*/
	ezhurt=0;
	/** Points scored*/
	points=0;
	/** Icon spawning at 200*/
	iconspawn=0;
	
	// set timer
	timer = new QTimer(this);// timer->start(val) later on in show()
	//connections
	connect(start,SIGNAL(clicked()),this,SLOT(clickedStart()));
	connect(pause,SIGNAL(clicked()),this,SLOT(clickedPause()));
	connect(view,SIGNAL(leftButtonClicked()),this,SLOT(leftClick()));
	connect(view,SIGNAL(rightButtonClicked()),this,SLOT(rightClick()));
	connect(view,SIGNAL(leftButtonHoldStart()),this,SLOT(leftHoldstart()));
	connect(view,SIGNAL(leftButtonHoldCancel()),this,SLOT(leftHoldcancel()));
	connect(view,SIGNAL(uparrow()),this,SLOT(moveup()));
	connect(view,SIGNAL(downarrow()),this,SLOT(movedown()));
	connect(view,SIGNAL(leftarrow()),this,SLOT(moveleft()));
	connect(view,SIGNAL(rightarrow()),this,SLOT(moveright()));
	connect(timer,SIGNAL(timeout()),this,SLOT(handleTimer()));
	connect(quit,SIGNAL(clicked()),this,SLOT(clickedQuit()));
}