Commit 7b4b4254 by grlabu

Update gamescreen.cpp

parent 38365fdf
Showing with 28 additions and 11 deletions
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "gameengine.h" // Include gameengine.h instead of gameengine.cpp #include "gameengine.h" // Include gameengine.h instead of gameengine.cpp
#include "gamescreen.h" #include "gamescreen.h"
#include "ui_gamescreen.h" #include "ui_gamescreen.h"
#include "ui_mainwindow.h"
#include <QDebug> #include <QDebug>
#include <QRandomGenerator> #include <QRandomGenerator>
...@@ -36,17 +36,7 @@ gamescreen::~gamescreen() ...@@ -36,17 +36,7 @@ gamescreen::~gamescreen()
delete ui; delete ui;
} }
void gamescreen::on_Leftbutton_clicked() {
int result = Move(correctChoice);
handleMoveResult(result);
emit onGameFinished();
}
void gamescreen::on_Rightbutton_clicked() {
int result = Move(correctChoice); // Pass correctChoice to Move function
handleMoveResult(result);
emit onGameFinished();
}
void gamescreen::handleMoveResult(int result) void gamescreen::handleMoveResult(int result)
{ {
...@@ -94,3 +84,30 @@ void gamescreen::handlePotion() ...@@ -94,3 +84,30 @@ void gamescreen::handlePotion()
{ {
potionCount += GAIN_POTION_COUNT; potionCount += GAIN_POTION_COUNT;
} }
void gamescreen::on_Rightbutton_pressed()
{
int result = Move(correctChoice);
handleMoveResult(result);
}
void gamescreen::on_Rightbutton_released()
{
emit onGameFinished();
}
void gamescreen::on_Leftbutton_pressed()
{
int result = Move(correctChoice);
handleMoveResult(result);
}
void gamescreen::on_Leftbutton_released()
{
emit onGameFinished();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment