Skip to content

Commit

Permalink
I can't do this anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
opaulosoares committed Jan 8, 2022
1 parent d517b2c commit 77aeeb4
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 21 deletions.
1 change: 0 additions & 1 deletion TalesOfLieselReborn.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
QT += core gui multimedia

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11
Expand Down
22 changes: 11 additions & 11 deletions TalesOfLieselReborn.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 5.0.3, 2022-01-07T20:53:30. -->
<!-- Written by QtCreator 5.0.3, 2022-01-07T22:13:34. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down Expand Up @@ -94,16 +94,16 @@
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 6.2.1 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.2.1 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.621.win64_mingw81_kit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5152.win64_mingw81_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\grid\Documents\GitHub\build-TalesOfLieselReborn-Desktop_Qt_6_2_1_MinGW_64_bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/grid/Documents/GitHub/build-TalesOfLieselReborn-Desktop_Qt_6_2_1_MinGW_64_bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\grid\Documents\GitHub\build-TalesOfLieselReborn-Desktop_Qt_5_15_2_MinGW_64_bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/grid/Documents/GitHub/build-TalesOfLieselReborn-Desktop_Qt_5_15_2_MinGW_64_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
Expand Down Expand Up @@ -140,8 +140,8 @@
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\grid\Documents\GitHub\build-TalesOfLieselReborn-Desktop_Qt_6_2_1_MinGW_64_bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/grid/Documents/GitHub/build-TalesOfLieselReborn-Desktop_Qt_6_2_1_MinGW_64_bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\grid\Documents\GitHub\build-TalesOfLieselReborn-Desktop_Qt_5_15_2_MinGW_64_bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/grid/Documents/GitHub/build-TalesOfLieselReborn-Desktop_Qt_5_15_2_MinGW_64_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
Expand Down Expand Up @@ -180,8 +180,8 @@
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\grid\Documents\GitHub\build-TalesOfLieselReborn-Desktop_Qt_6_2_1_MinGW_64_bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/grid/Documents/GitHub/build-TalesOfLieselReborn-Desktop_Qt_6_2_1_MinGW_64_bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\grid\Documents\GitHub\build-TalesOfLieselReborn-Desktop_Qt_5_15_2_MinGW_64_bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/grid/Documents/GitHub/build-TalesOfLieselReborn-Desktop_Qt_5_15_2_MinGW_64_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
Expand Down Expand Up @@ -247,7 +247,7 @@
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/grid/Documents/GitHub/build-TalesOfLieselReborn-Desktop_Qt_6_2_1_MinGW_64_bit-Debug</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/grid/Documents/GitHub/build-TalesOfLieselReborn-Desktop_Qt_5_15_2_MinGW_64_bit-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
Expand Down
3 changes: 3 additions & 0 deletions lib/frontend/widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ private slots:
void on_newGameButton_clicked();
void on_saveGoMenuButton_clicked();

void on_exitGameButton_clicked();

private:
Ui::Widget *ui;

Expand All @@ -47,6 +49,7 @@ private slots:
void setupMainWindow();

// Setup and allocate each auxiliary class.
void setupMusic();
void setupHealthbar();
void setupEnemyButton();
void setupEventPanel();
Expand Down
8 changes: 4 additions & 4 deletions src/frontend/components/healthbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void Healthbar::changeColorOnDamage() {
int relativeValue = 100 * ratio;

switch (relativeValue) {
case 76 ... 101:
case 100:
this->Bar->setStyleSheet(
"QProgressBar { \
background-color: rgb(255, 255, 255); \
Expand All @@ -48,7 +48,7 @@ void Healthbar::changeColorOnDamage() {
);
break;

case 51 ... 75:
case 75:
this->Bar->setStyleSheet(
"QProgressBar { \
background-color: rgb(255, 255, 255); \
Expand All @@ -63,7 +63,7 @@ void Healthbar::changeColorOnDamage() {
);
break;

case 26 ... 50:
case 50:
this->Bar->setStyleSheet(
"QProgressBar { \
background-color: rgb(255, 255, 255); \
Expand All @@ -78,7 +78,7 @@ void Healthbar::changeColorOnDamage() {
);
break;

case 0 ... 25:
case 25:
this->Bar->setStyleSheet(
"QProgressBar { \
background-color: rgb(255, 255, 255); \
Expand Down
40 changes: 36 additions & 4 deletions src/frontend/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
#include <./lib/gamemacros.h>
#include <QMovie>
#include <QPair>
#include <QMediaPlayer>
#include <QMediaPlaylist>

// Variables only used in this file.
// Mainly Qt components that doesnt need to be defined in the class.
QMovie *movies[2];
QMediaPlayer *title;
QMediaPlayer *gameplay;
QMediaPlaylist *gamePlaylist;

// Auxiliary enum to identify each Qt StackedWidgets.
enum Screen {
Expand All @@ -29,10 +34,7 @@ Widget::Widget(QWidget *parent)
setupDestructionAuraInfo();
setupGame();
connectAll();

// This is a test induced call of these functions, DELETE those for release.
// game->playerInstance->fireSkill.updateExp(5000);
// game->playerInstance->destructionSkill.updateExp(5000);
setupMusic();

initAllComponents();
GENERATE_FIRST_ENEMY;
Expand All @@ -51,6 +53,25 @@ Widget::~Widget()
delete ui;
}

void Widget::setupMusic() {
title = new QMediaPlayer();
gameplay = new QMediaPlayer();
gamePlaylist = new QMediaPlaylist();

title->setMedia(QUrl("qrc:/music/music/0-tavern.mp3"));
title->play();
title->setVolume(25);
gameplay->setVolume(25);

gamePlaylist->addMedia(QUrl("qrc:/music/music/1-highland.mp3"));
gamePlaylist->addMedia(QUrl("qrc:/music/music/2-streets-of-plague.mp3"));
gamePlaylist->addMedia(QUrl("qrc:/music/music/3-battle-of-the-creek.mp3"));
gamePlaylist->addMedia(QUrl("qrc:/music/music/4-medieval.mp3"));

gamePlaylist->setPlaybackMode(QMediaPlaylist::Loop);
gameplay->setPlaylist(gamePlaylist);
}

void Widget::startAnimationIcons()
{
// Start Firball Attack Icon GIF.
Expand Down Expand Up @@ -164,10 +185,21 @@ void Widget::setupMainWindow() {
void Widget::on_newGameButton_clicked()
{
ui->stackedWidget->setCurrentIndex(GAME);
title->stop();
gamePlaylist->shuffle();
gameplay->play();
}

void Widget::on_saveGoMenuButton_clicked()
{
ui->stackedWidget->setCurrentIndex(MENU);
gameplay->stop();
title->play();
}


void Widget::on_exitGameButton_clicked()
{
this->close();
}

1 change: 0 additions & 1 deletion src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Game::Game(QWidget *parent) : QObject(parent){
Game::~Game() {
delete this->playerInstance;
delete this->currEnemyInstance;

delete this->clickExec;
delete this->fireballExec;
delete this->destAuraExec;
Expand Down

0 comments on commit 77aeeb4

Please sign in to comment.