Commit b1297eb1 authored by Anthony Noir's avatar Anthony Noir
Browse files

Merge branch 'master' of...

Merge branch 'master' of https://gitlab.utc.fr/lo21_pin_noir_boucher_bouri_detree/cellulutlo21 into master
parents d4c87677 12077fb8
Pipeline #79691 passed with stages
in 16 seconds
......@@ -750,9 +750,12 @@ void MainWindow::play_snake()
on_pushButton_clicked(); // reset la grille
QWidget::grabKeyboard();
static auto restore = [&]
{
ui_update_alphabet(simulation.getAlphabet());
QWidget::releaseKeyboard();
snake_timer.stop();
on_pushButton_clicked(); // reset la grille
};
......@@ -889,26 +892,26 @@ void MainWindow::closeEvent(QCloseEvent *e)
void MainWindow::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Q)
if (event->key() == Qt::Key_Q || event->key() == Qt::Key_Left)
m_arrow_key_state[0] = true;
if (event->key() == Qt::Key_S)
if (event->key() == Qt::Key_S || event->key() == Qt::Key_Down)
m_arrow_key_state[1] = true;
if (event->key() == Qt::Key_D)
if (event->key() == Qt::Key_D || event->key() == Qt::Key_Right)
m_arrow_key_state[2] = true;
if (event->key() == Qt::Key_Z)
if (event->key() == Qt::Key_Z || event->key() == Qt::Key_Up)
m_arrow_key_state[3] = true;
QMainWindow::keyPressEvent(event);
}
void MainWindow::keyReleaseEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Q)
if (event->key() == Qt::Key_Q || event->key() == Qt::Key_Left)
m_arrow_key_state[0] = false;
if (event->key() == Qt::Key_S)
if (event->key() == Qt::Key_S || event->key() == Qt::Key_Down)
m_arrow_key_state[1] = false;
if (event->key() == Qt::Key_D)
if (event->key() == Qt::Key_D || event->key() == Qt::Key_Right)
m_arrow_key_state[2] = false;
if (event->key() == Qt::Key_Z)
if (event->key() == Qt::Key_Z || event->key() == Qt::Key_Up)
m_arrow_key_state[3] = false;
QMainWindow::keyReleaseEvent(event);
}
......
......@@ -3,11 +3,6 @@ QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
equals(QT_MAJOR_VERSION, 5): QT += multimedia
!versionAtLeast(QT_VERSION, 5.14.0) {
message("Cannot use Qt $${QT_VERSION}")
error("Use Qt 5.14 or newer")
}
CONFIG += c++14
TEMPLATE = app
......
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 to comment