about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-09-20 10:56:11 -0400
committerCharadon <dev@iotib.net>2022-09-20 10:56:11 -0400
commit6663682763d953ba20805fd6a15f79c06f4ac7f4 (patch)
treea91aa5b6034e1fcb9a7628bcdd2306bc5bb896df
parentf769bb9adcb665d08b0e9e65e8db82fc00c2347e (diff)
downloadPong-C-6663682763d953ba20805fd6a15f79c06f4ac7f4.tar.gz
Controller support for settings screen and some more build system stuff
-rw-r--r--Tupfile.ini0
-rw-r--r--flatpak.config1
-rwxr-xr-xinstall.sh5
-rw-r--r--net.iotib.Pong.metainfo.xml53
-rw-r--r--net.iotib.Pong.yml4
-rw-r--r--src/title.c22
-rw-r--r--tup-generate.vardictbin88 -> 0 bytes
-rw-r--r--tup.config1
8 files changed, 82 insertions, 4 deletions
diff --git a/Tupfile.ini b/Tupfile.ini
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tupfile.ini
diff --git a/flatpak.config b/flatpak.config
index fcf46d7..4d8fe6d 100644
--- a/flatpak.config
+++ b/flatpak.config
@@ -1,4 +1,5 @@
 CONFIG_CC=cc
+CONFIG_DEBUG=false
 CONFIG_FLATPAK=true
 CONFIG_INSTALL_PREFIX=/app/games/pong
 CONFIG_BUILD_DIR=./build
diff --git a/install.sh b/install.sh
index 3c8a612..08e74ee 100755
--- a/install.sh
+++ b/install.sh
@@ -14,14 +14,15 @@ set -u
 echo "Installing Project."
 set -x
 mkdir -p $CONFIG_INSTALL_PREFIX
-cp -r ./resources $CONFIG_INSTALL_PREFIX/resources
-cp -r ./docs $CONFIG_INSTALL_PREFIX/docs
+cp -r ./resources $CONFIG_INSTALL_PREFIX/
+cp -r ./docs $CONFIG_INSTALL_PREFIX/
 install -m755 $CONFIG_BUILD_DIR/bin/Pong* $CONFIG_INSTALL_PREFIX/
 
 if [ "$CONFIG_FLATPAK" = "true" ];
 then
 	install -Dm755 src/flatpak/flatpak_launch.sh /app/bin/flatpak_launch.sh
 	install -Dm644 src/Pong.desktop /app/share/applications/net.iotib.Pong.desktop
+	install -Dm644 net.iotib.Pong.metainfo.xml /app/share/appdata/net.iotib.Pong.metainfo.xml
 	install -Dm644 resources/icon.svg /app/share/icons/hicolor/scalable/apps/net.iotib.Pong.svg
 fi
 set +x
diff --git a/net.iotib.Pong.metainfo.xml b/net.iotib.Pong.metainfo.xml
new file mode 100644
index 0000000..6b14cb3
--- /dev/null
+++ b/net.iotib.Pong.metainfo.xml
@@ -0,0 +1,53 @@
+<?xml version='1.0' encoding='utf-8'?>
+<component type="desktop">
+  <!--Created with jdAppdataEdit 5.0-->
+  <id>net.iotib.Pong</id>
+  <name>Pong</name>
+  <summary>A pong clone made in C.</summary>
+  <developer_name>iotib</developer_name>
+  <launchable type="desktop-id">net.iotib.Pong.desktop</launchable>
+  <metadata_license>GFDL-1.3</metadata_license>
+  <project_license>GPL-3.0-only</project_license>
+  <update_contact>dev@iotib.net</update_contact>
+  <description>
+    <p>This is a clone of Pong made in C for basically every operating system.</p>
+    <p>It supports:</p>
+    <ol>
+      <li>Local Versus</li>
+      <li>Single Player Versus</li>
+      <li>Marathon w/ Scoreboard</li>
+    </ol>
+  </description>
+  <releases>
+    <release version="v0.4" date="2022-09-11" type="stable">
+      <url>https://www.opencode.net/charadon/Pong-C/-/releases</url>
+    </release>
+  </releases>
+  <url type="homepage">https://www.opencode.net/charadon/Pong-C</url>
+  <url type="bugtracker">https://www.opencode.net/charadon/Pong-C/-/issues</url>
+  <url type="faq">https://pong.iotib.net/</url>
+  <url type="help">https://pong.iotib.net/</url>
+  <url type="donation">https://liberapay.com/Charadon/</url>
+  <url type="contact">https://www.iotib.net/</url>
+  <categories>
+    <category>Game</category>
+  </categories>
+  <requires>
+    <memory>128</memory>
+  </requires>
+  <recommends>
+    <display_length compare="ge">medium</display_length>
+    <memory>256</memory>
+  </recommends>
+  <supports>
+    <control>pointing</control>
+    <control>keyboard</control>
+    <control>gamepad</control>
+  </supports>
+  <content_rating type="oars-1.1"/>
+  <keywords>
+    <keyword>pong</keyword>
+    <keyword>pong clone</keyword>
+    <keyword>clone</keyword>
+  </keywords>
+</component>
diff --git a/net.iotib.Pong.yml b/net.iotib.Pong.yml
index 23787a6..c24aa9b 100644
--- a/net.iotib.Pong.yml
+++ b/net.iotib.Pong.yml
@@ -2,7 +2,7 @@ app-id: net.iotib.Pong
 branch: '0.4'
 appdata-license: 'GPL-3.0-only'
 runtime: org.freedesktop.Platform
-runtime-version: '21.08'
+runtime-version: '22.08'
 sdk: org.freedesktop.Sdk
 command: flatpak_launch.sh
 modules:
@@ -21,6 +21,8 @@ modules:
       - type: file
         path: install.sh
       - type: file
+        path: net.iotib.Pong.metainfo.xml
+      - type: file
         path: flatpak.config
       - type: file
         path: build-flatpak.sh
diff --git a/src/title.c b/src/title.c
index d16ff84..7594ed9 100644
--- a/src/title.c
+++ b/src/title.c
@@ -243,6 +243,8 @@ static void settings(Camera2D *MainCamera, Mix_Music *TitleScreenMusic) {
     Vector2 NewPosition = GetMousePosition();
     Texture2D MouseCursorSprite = LoadTexture("resources/cursor.png");
     bool MouseCursorIn = true;
+	bool OnBackButton = true;
+	int Choice = 0;
     while(SettingsGoing == true && GameGoing == true) {
 
         MainCamera->zoom = GetScreenHeight()/720.0f;
@@ -263,6 +265,24 @@ static void settings(Camera2D *MainCamera, Mix_Music *TitleScreenMusic) {
             }
         }
 
+		int KeyPressed = player_controls_pressed();
+
+		switch(KeyPressed) {
+			case CONTROLLER_ACTIVATE:
+				if ( OnBackButton == true ) {
+					SettingsGoing = false;
+				}
+				OnBackButton = true;
+				Choice = 0;
+				break;
+			case CONTROLLER_UP:
+				--Choice;
+				break;
+			case CONTROLLER_DOWN:
+				++Choice;
+				break;
+		}
+
         if (IsKeyPressed(KEY_ESCAPE)) {
             EnableCursor();
             MouseCursorIn = false;
@@ -277,7 +297,7 @@ static void settings(Camera2D *MainCamera, Mix_Music *TitleScreenMusic) {
         BeginMode2D(*MainCamera);
             DrawRectangle(0, 0, 1280, 720, (Color){20, 20, 20, 255});
             /* Back Button */
-            if (CheckCollisionRecs(MouseCursor, BackButton)) {
+            if (CheckCollisionRecs(MouseCursor, BackButton) || OnBackButton == true) {
                 DrawRectangleRec(BackButton, RED);
                 if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
                     SettingsGoing = false;
diff --git a/tup-generate.vardict b/tup-generate.vardict
deleted file mode 100644
index 55356ad..0000000
--- a/tup-generate.vardict
+++ /dev/null
Binary files differdiff --git a/tup.config b/tup.config
index 226a926..d3997b7 100644
--- a/tup.config
+++ b/tup.config
@@ -1,4 +1,5 @@
 CONFIG_CC=cc
+CONFIG_DEBUG=true
 CONFIG_FLATPAK=false
 CONFIG_INSTALL_PREFIX=./app
 CONFIG_BUILD_DIR=./build