Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
build: add app QtFlappyBird
Browse files Browse the repository at this point in the history
Qt编写的 FlappyBird

log: add game
  • Loading branch information
Van020530 authored and kamiyadm committed May 29, 2024
1 parent 010c735 commit 6790a8b
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 0 deletions.
29 changes: 29 additions & 0 deletions io.github.QtFlappyBird/linglong.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package:
id: io.github.QtFlappyBird
name: QtFlappyBird
version: 1.1.1.1
kind: app
description: |
Qt编写的 FlappyBird
runtime:
id: org.deepin.Runtime
version: 23.0.0

source:
kind: git
url: https://github.com/giarld/QtFlappyBird.git
commit: 30c821152e7bacaf3a70c1f77ce04482b6fe75a3
patch: patches/0001-fix.patch


build:
kind: qmake
manual :
configure: |
cp Images/bird1.png Images/FlappyBirdIcon.png
qmake -makefile ${conf_args} ${extra_args}
build: |
make ${jobs}
install: |
make ${jobs} DESTDIR=${dest_dir} install
93 changes: 93 additions & 0 deletions io.github.QtFlappyBird/patches/0001-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
From a0114de67bde0ceb9287f2641d40040436895cd5 Mon Sep 17 00:00:00 2001
From: van <[email protected]>
Date: Thu, 9 May 2024 16:37:30 +0800
Subject: [PATCH] fix

---
FlappyBird.desktop | 9 +++++++++
FlappyBird.pro | 14 ++++++++++++++
mainwindow.cpp | 13 +++++++------
3 files changed, 30 insertions(+), 6 deletions(-)
create mode 100644 FlappyBird.desktop

diff --git a/FlappyBird.desktop b/FlappyBird.desktop
new file mode 100644
index 0000000..bb10f10
--- /dev/null
+++ b/FlappyBird.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Categories=Tool;Qt;
+Exec=FlappyBird
+Name=FlappyBird
+Icon=FlappyBirdIcon
+StartupNotify=false
+Terminal=false
+Type=Application
+X-Deepin-Vendor=user-custom
diff --git a/FlappyBird.pro b/FlappyBird.pro
index aa65704..7955897 100644
--- a/FlappyBird.pro
+++ b/FlappyBird.pro
@@ -37,3 +37,17 @@ FORMS +=

RESOURCES += \
flappy.qrc
+
+
+BINDIR = $$PREFIX/bin
+DATADIR = $$PREFIX/share
+target.path = $$BINDIR
+desktop.files = FlappyBird.desktop
+desktop.path = $$DATADIR/applications/
+icon.files = Images/FlappyBirdIcon.png
+icon.path= $$DATADIR/icons/hicolor/48x48/apps/
+bgm.files= sounds/*
+bgm.path= $$DATADIR/sounds/
+DEFINES += \"BGM_sfx_wing_DIR=\\\"$$DATADIR/sounds/sfx_wing.mp3\\\"\" \"BGM_sfx_point_DIR=\\\"$$DATADIR/sounds/sfx_point.mp3\\\"\" \"BGM_sfx_die_DIR=\\\"$$DATADIR/sounds/sfx_die.mp3\\\"\" \"BGM_sfx_hit_DIR=\\\"$$DATADIR/sounds/sfx_hit.mp3\\\"\" \"BGM_sfx_swooshing_DIR=\\\"$$DATADIR/sounds/sfx_swooshing.mp3\\\"\" \"BGM_sfx_wing_DIR=\\\"$$DATADIR/sounds/sfx_wing.mp3\\\"\"
+
+INSTALLS += target desktop icon bgm
\ No newline at end of file
diff --git a/mainwindow.cpp b/mainwindow.cpp
index cda48ce..392d014 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -3,6 +3,7 @@
#include <QMessageBox>
#include <ctime>
#include <iostream>
+
using namespace std;

MainWindow::MainWindow(QWidget *parent) :
@@ -87,21 +88,21 @@ MainWindow::MainWindow(QWidget *parent) :
//////sound
playList=new QMediaPlaylist;
QFileInfo info;
- info.setFile("sounds/sfx_wing.mp3");
+ info.setFile(BGM_sfx_wing_DIR);
playList->addMedia(QUrl::fromLocalFile(info.absoluteFilePath()));
- info.setFile("sounds/sfx_point.mp3");
+ info.setFile(BGM_sfx_point_DIR);
playList->addMedia(QUrl::fromLocalFile(info.absoluteFilePath()));
- info.setFile("sounds/sfx_die.mp3");
+ info.setFile(BGM_sfx_die_DIR);
playList->addMedia(QUrl::fromLocalFile(info.absoluteFilePath()));
- info.setFile("sounds/sfx_hit.mp3");
+ info.setFile(BGM_sfx_hit_DIR);
playList->addMedia(QUrl::fromLocalFile(info.absoluteFilePath()));
- info.setFile("sounds/sfx_swooshing.mp3");
+ info.setFile(BGM_sfx_swooshing_DIR);
playList->addMedia(QUrl::fromLocalFile(info.absoluteFilePath()));

playList->setPlaybackMode(QMediaPlaylist::CurrentItemOnce);

playList_wing=new QMediaPlaylist;
- info.setFile("sounds/sfx_wing.mp3");
+ info.setFile(BGM_sfx_wing_DIR);
playList_wing->addMedia(QUrl::fromLocalFile(info.absoluteFilePath()));
playList_wing->setPlaybackMode(QMediaPlaylist::CurrentItemOnce);
playList_wing->setCurrentIndex(1);
--
2.33.1

0 comments on commit 6790a8b

Please sign in to comment.