-
Notifications
You must be signed in to change notification settings - Fork 14
Я пытался сделать хоть что-нибудь #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| QT += core gui | ||
| QT += multimedia | ||
| greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
|
|
||
| CONFIG += c++11 | ||
|
|
||
| # You can make your code fail to compile if it uses deprecated APIs. | ||
| # In order to do so, uncomment the following line. | ||
| #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 | ||
|
|
||
| SOURCES += \ | ||
| main.cpp \ | ||
| tetrixboard.cpp \ | ||
| tetrixpiece.cpp \ | ||
| tetrixwindow.cpp | ||
|
|
||
| HEADERS += \ | ||
| tetrixboard.h \ | ||
| tetrixpiece.h \ | ||
| tetrixwindow.h | ||
|
|
||
| FORMS += | ||
|
|
||
| # Default rules for deployment. | ||
| qnx: target.path = /tmp/$${TARGET}/bin | ||
| else: unix:!android: target.path = /opt/$${TARGET}/bin | ||
| !isEmpty(target.path): INSTALLS += target | ||
|
|
||
| DISTFILES += \ | ||
| Video_Game_Players_-_Tetris_Theme_48152782.mp3 |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,22 @@ | ||
| #include <QApplication> | ||
|
|
||
| #include "tetris.h" | ||
|
|
||
| int main(int argc, char *argv[]) { | ||
| QApplication a(argc, argv); | ||
| Tetris w; | ||
| w.show(); | ||
| return a.exec(); | ||
| } | ||
| #include "tetrixwindow.h" | ||
|
|
||
| #include <QApplication> | ||
| #include <QMediaPlayer> | ||
| #include <QMediaPlaylist> | ||
| #include <QDir> | ||
| #include <QUrl> | ||
|
|
||
| int main(int argc, char *argv[]) | ||
| { | ||
| QApplication app(argc, argv); | ||
| TetrixWindow window; | ||
| window.show(); | ||
| QMediaPlaylist *playlist = new QMediaPlaylist(); | ||
| playlist->addMedia(QUrl("qrc:/tetris_music/background.wav")); | ||
| playlist->setPlaybackMode(QMediaPlaylist::Loop); | ||
| QMediaPlayer *player = new QMediaPlayer; | ||
| player->setMedia(playlist); | ||
| player->setVolume(10); | ||
| player->play(); | ||
| return app.exec(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #include "tetrisform.h" | ||
| #include "ui_tetrisform.h" | ||
|
|
||
| tetrisForm::tetrisForm(QWidget *parent) : | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Названия классов с большой буквы |
||
| QWidget(parent), | ||
| ui(new Ui::tetrisForm) | ||
| { | ||
| ui->setupUi(this); | ||
| } | ||
|
|
||
| tetrisForm::~tetrisForm() | ||
| { | ||
| delete ui; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #include "tetrismainwindow.h" | ||
| #include "ui_tetrismainwindow.h" | ||
|
|
||
| TetrisMainWindow::TetrisMainWindow(QWidget *parent) | ||
| : QWidget(parent) | ||
| , ui(new Ui::TetrisMainWindow) | ||
| { | ||
| ui->setupUi(this); | ||
| } | ||
|
|
||
| TetrisMainWindow::~TetrisMainWindow() | ||
| { | ||
| delete ui; | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #ifndef TETRISMAINWINDOW_H | ||
| #define TETRISMAINWINDOW_H | ||
|
|
||
| #include <QWidget> | ||
|
|
||
| QT_BEGIN_NAMESPACE | ||
| namespace Ui { class TetrisMainWindow; } | ||
| QT_END_NAMESPACE | ||
|
|
||
| class TetrisMainWindow : public QWidget | ||
| { | ||
| Q_OBJECT | ||
|
|
||
| public: | ||
| TetrisMainWindow(QWidget *parent = nullptr); | ||
| ~TetrisMainWindow(); | ||
|
|
||
| private: | ||
| Ui::TetrisMainWindow *ui; | ||
| QLabel *createLabel(const QString &text); | ||
|
|
||
| TetrisBoard *board; | ||
| QLabel *nextPieceLabel; | ||
| QLCDNumber *scoreLcd; | ||
| QLCDNumber *levelLcd; | ||
| QLCDNumber *linesLcd; | ||
| QPushButton *startButton; | ||
| QPushButton *quitButton; | ||
| QPushButton *pauseButton; | ||
|
Comment on lines
+22
to
+29
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. У полей с модификаторами доступа private и protected добавляем постфикс "_".
|
||
| }; | ||
| #endif // TETRISMAINWINDOW_H | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <ui version="4.0"> | ||
| <class>TetrisMainWindow</class> | ||
| <widget class="QWidget" name="TetrisMainWindow"> | ||
| <property name="geometry"> | ||
| <rect> | ||
| <x>0</x> | ||
| <y>0</y> | ||
| <width>800</width> | ||
| <height>600</height> | ||
| </rect> | ||
| </property> | ||
| <property name="windowTitle"> | ||
| <string>TetrisMainWindow</string> | ||
| </property> | ||
| </widget> | ||
| <resources/> | ||
| <connections/> | ||
| </ui> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В отрыве можно подумать, что это какой-то игрок, уточните, что это все же mediaPlayer