11 Commits

Author SHA1 Message Date
a836dd31e2 fix exec path
All checks were successful
Linux arm64 / Build (push) Successful in 2m13s
2025-07-29 21:36:18 +02:00
94e5450a74 fix icon path 2025-07-29 21:36:01 +02:00
7977fb976b nsis packaging
All checks were successful
Linux arm64 / Build (push) Successful in 2m16s
2025-07-29 21:13:10 +02:00
86a034a4ac update flatpak metainfo
All checks were successful
Linux arm64 / Build (push) Successful in 2m13s
2025-07-28 10:31:06 +02:00
9208a5750d zip windows packing 2025-07-28 10:29:42 +02:00
7301c40ba9 fix mingw build
All checks were successful
Linux arm64 / Build (push) Successful in 2m13s
2025-07-25 11:54:58 +02:00
792bf73e79 split xmake module in its own file
All checks were successful
Linux arm64 / Build (push) Successful in 2m15s
2025-07-25 10:50:38 +02:00
c9d5cc35ff fix config save (flatpak)
All checks were successful
Linux arm64 / Build (push) Successful in 2m12s
2025-07-25 10:22:45 +02:00
7040ce3381 add flatpak metadata
All checks were successful
Linux arm64 / Build (push) Successful in 2m30s
2025-07-24 17:45:44 +02:00
508405b00c fix desktop file
All checks were successful
Linux arm64 / Build (push) Successful in 2m17s
2025-07-24 15:12:55 +02:00
6dbcc717f7 fix normal build 2025-07-24 15:12:48 +02:00
15 changed files with 199 additions and 55 deletions

View File

@@ -1,2 +1,2 @@
#!/bin/sh #!/bin/sh
JMINOS_DATA="/app/share" /app/bin/graph JMINOS_DATA="/app/share" JMINOS_CONFIG=$XDG_CONFIG_HOME /app/bin/graph

View File

@@ -3,6 +3,7 @@ Type=Application
Version=1.0 Version=1.0
Name=Jminos Name=Jminos
Exec=/usr/bin/graph Exec=/usr/bin/graph
Icon=org.zulianc.jminos
Terminal=false Terminal=false
Categories=Games; Categories=Game;
Comment=Amazing stacker game by the J Comment=Amazing stacker game by the J

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>org.zulianc.jminos</id>
<launchable type="desktop-id">org.zulianc.jminos.desktop</launchable>
<name>jminos</name>
<developer_name>Zulianc</developer_name>
<summary>Amazing stacker game by the J </summary>
<!-- <metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-only</project_license> -->
<url type="homepage">https://git.ale-pri.com/TetrisNerd/jminos</url>
<description>
<p>
Modern stacker game with every polyominoes from size 1 to 15, made in C++ with SFML 3!
</p>
<p>Features</p>
<ul>
<li>Every polyominoes up to pentedecaminoes!</li>
<li>7bag with proportionnality for each polyomino size!</li>
<li>AutoRS as the Rotation System!</li>
<li>0° rotations!</li>
<li>All spin!</li>
<li>IRS, IHS, infinite hold, and other leniency mechanics!</li>
<li>Customizable board size!</li>
<li>Customizable keybinds!</li>
<li>Very bland interface!! (i'm not a designer)</li>
</ul>
<p>Available gamemodes</p>
<ul>
<li>SPRINT : clear 40 lines as fast as possible!</li>
<li>MARATHON : clear 200 lines with increasing gravity!</li>
<li>ULTRA : scores as much as possible in only 2 minutes!</li>
<li>MASTER : clear 200 lines at levels higher than maximum gravity!</li>
<li>INVISIBLE : get 1000 grade while not being able to see the board!</li>
<li>ZEN : practice indefinitely in this mode with no gravity!</li>
</ul>
</description>
<launchable type="desktop-id">
org.zulianc.jminos.desktop
</launchable>
<categories>
<category>Game</category>
</categories>
<screenshots>
<screenshot type="default">
<caption>Big piece</caption>
<image>https://git.ale-pri.com/TetrisNerd/jminos/raw/branch/main/doc/readme/big_piece.png</image>
</screenshot>
<screenshot>
<caption>Pieces selection</caption>
<image>https://git.ale-pri.com/TetrisNerd/jminos/media/branch/main/doc/readme/pieces_selection.png</image>
</screenshot>
<screenshot>
<caption>Rotations</caption>
<image>https://git.ale-pri.com/TetrisNerd/jminos/media/branch/main/doc/readme/rotations.gif</image>
</screenshot>
<screenshot>
<caption>Rotation_0</caption>
<image>https://git.ale-pri.com/TetrisNerd/jminos/media/branch/main/doc/readme/rotation_0.gif</image>
</screenshot>
</screenshots>
<releases>
<release version="1.0" date="2025-07-02">
<url>https://git.ale-pri.com/TetrisNerd/jminos/src/tag/v1.0/</url>
<description>
Inital release
</description>
</release>
</releases>
<content_rating type="oars-1.1" />
</component>

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -1,4 +1,4 @@
id: org.zulianc.jminos app-id: org.zulianc.jminos
runtime: org.freedesktop.Platform runtime: org.freedesktop.Platform
runtime-version: "24.08" runtime-version: "24.08"
sdk: org.freedesktop.Sdk sdk: org.freedesktop.Sdk
@@ -9,18 +9,7 @@ finish-args:
- --device=dri - --device=dri
modules: modules:
- name: xmake - xmake.yml
buildsystem: simple
no-autogen: true
cleanup: ['*']
build-commands:
- ./configure --prefix=/app
- make -j $(nproc)
- prefix=/app ./scripts/get.sh __local__ __install_only__
sources:
- type: git
url: https://github.com/xmake-io/xmake.git
tag: v3.0.1
- name: jminos - name: jminos
buildsystem: simple buildsystem: simple
@@ -28,13 +17,15 @@ modules:
build-args: build-args:
- --share=network - --share=network
build-commands: build-commands:
- xmake f --policies=package.install_locally -m release -y - xmake f --policies=package.install_locally --external_build=y -m release -y
- xmake - xmake
- xmake install -o output - xmake install -o output
- install -D output/bin/* ${FLATPAK_DEST}/bin - install -D output/bin/* /app/bin
- cp -r output/data ${FLATPAK_DEST}/share - cp -r output/data /app/share
- install -D flatpak/FlatpakLaunch.sh ${FLATPAK_DEST}/bin - install -D flatpak/FlatpakLaunch.sh /app/bin
- install -D flatpak/org.zulianc.jminos.desktop ${FLATPAK_DEST}/share/applications - install -D -t /app/share/applications flatpak/${FLATPAK_ID}.desktop
- install -Dm644 flatpak/${FLATPAK_ID}.metainfo.xml /app/share/metainfo/${FLATPAK_ID}.metainfo.xml
- install -D flatpak/${FLATPAK_ID}.png /app/share/icons/hicolor/512x512/apps/${FLATPAK_ID}.png
sources: sources:
- type: dir - type: dir
path: .. path: ..

12
flatpak/xmake.yml Normal file
View File

@@ -0,0 +1,12 @@
name: xmake
buildsystem: simple
no-autogen: true
cleanup: ['*']
build-commands:
- ./configure --prefix=/app
- make -j $(FLATPAK_BUILDER_N_JOBS)
- prefix=/app ./scripts/get.sh __local__ __install_only__
sources:
- type: git
url: https://github.com/xmake-io/xmake.git
tag: v3.0.1

View File

@@ -21,7 +21,7 @@ Keybinds::Keybinds(int layoutNumber) :
} }
void Keybinds::loadKeybindsFromFile() { void Keybinds::loadKeybindsFromFile() {
std::ifstream layoutFile(AssetManager::getResourcePath("data/config/keybinds/layout" + std::to_string(this->layoutNumber) + ".bin"), std::ios::binary); std::ifstream layoutFile(AssetManager::getConfigPath("data/config/keybinds/layout" + std::to_string(this->layoutNumber) + ".bin"), std::ios::binary);
for (Action action : ACTION_LIST_IN_ORDER) { for (Action action : ACTION_LIST_IN_ORDER) {
this->keybinds.at(action).clear(); this->keybinds.at(action).clear();
@@ -48,7 +48,7 @@ void Keybinds::loadKeybindsFromFile() {
void Keybinds::saveKeybindsToFile() const { void Keybinds::saveKeybindsToFile() const {
if (!this->modifiable) return; if (!this->modifiable) return;
std::ofstream layoutFile(AssetManager::getResourcePath("data/config/keybinds/layout" + std::to_string(this->layoutNumber) + ".bin"), std::ios::trunc | std::ios::binary); std::ofstream layoutFile(AssetManager::getConfigPath("data/config/keybinds/layout" + std::to_string(this->layoutNumber) + ".bin"), std::ios::trunc | std::ios::binary);
char byte; char byte;
for (Action action : ACTION_LIST_IN_ORDER) { for (Action action : ACTION_LIST_IN_ORDER) {

View File

@@ -50,7 +50,7 @@ void Settings::loadPieces(int loadablePiecesSizeRequest) {
} }
void Settings::loadSettingsFromFile(bool loadPieces, std::optional<int> loadablePiecesSizeRequest) { void Settings::loadSettingsFromFile(bool loadPieces, std::optional<int> loadablePiecesSizeRequest) {
std::ifstream settingsFile(AssetManager::getResourcePath("data/config/settings.bin"), std::ios::binary); std::ifstream settingsFile(AssetManager::getConfigPath("data/config/settings.bin"), std::ios::binary);
char byte; char byte;
// file format version // file format version
@@ -159,7 +159,7 @@ void Settings::saveSettingsToFile() const {
this->keybinds.at(CUSTOMIZABLE_KEYBINDS).saveKeybindsToFile(); this->keybinds.at(CUSTOMIZABLE_KEYBINDS).saveKeybindsToFile();
std::ofstream settingsFile(AssetManager::getResourcePath("data/config/settings.bin"), std::ios::trunc | std::ios::binary); std::ofstream settingsFile(AssetManager::getConfigPath("data/config/settings.bin"), std::ios::trunc | std::ios::binary);
char byte; char byte;
// file format version // file format version

View File

@@ -10,7 +10,7 @@
[[nodiscard]] bool resetKeybindFile(int layout); [[nodiscard]] bool resetKeybindFile(int layout);
int main() { int main(int arc, char** args) {
std::srand(std::time(NULL)); std::srand(std::time(NULL));
bool everythingIsOK = true; bool everythingIsOK = true;
@@ -59,19 +59,19 @@ int main() {
// CHECK CONFIG FILES // CHECK CONFIG FILES
if (!std::filesystem::exists(AssetManager::getResourcePath("data/config/settings.bin"))) { if (!std::filesystem::exists(AssetManager::getConfigPath("data/config/settings.bin"))) {
std::cout << "INFO: Settings file not found, generating..." << std::endl; std::cout << "INFO: Settings file not found, generating..." << std::endl;
everythingIsOK &= resetSettingsFile(); everythingIsOK &= resetSettingsFile();
for (int i = 0; i < NUMBER_OF_KEYBINDS; i++) { for (int i = 0; i < NUMBER_OF_KEYBINDS; i++) {
if (!std::filesystem::exists(AssetManager::getResourcePath("data/config/keybinds/layout" + std::to_string(i) + ".bin"))) { if (!std::filesystem::exists(AssetManager::getConfigPath("data/config/keybinds/layout" + std::to_string(i) + ".bin"))) {
std::cout << "INFO: Keybind file number " << (i + 1) << "/" << NUMBER_OF_KEYBINDS << " not found, generating..." << std::endl; std::cout << "INFO: Keybind file number " << (i + 1) << "/" << NUMBER_OF_KEYBINDS << " not found, generating..." << std::endl;
everythingIsOK &= resetKeybindFile(i); everythingIsOK &= resetKeybindFile(i);
} }
} }
} }
else { else {
std::ifstream settingsFile(AssetManager::getResourcePath("data/config/settings.bin"), std::ios::binary); std::ifstream settingsFile(AssetManager::getConfigPath("data/config/settings.bin"), std::ios::binary);
char byte; char byte;
settingsFile.get(byte); settingsFile.get(byte);
@@ -101,11 +101,11 @@ int main() {
bool resetSettingsFile() { bool resetSettingsFile() {
if (!std::filesystem::exists(AssetManager::getResourcePath("data/config"))) { if (!std::filesystem::exists(AssetManager::getConfigPath("data/config"))) {
std::filesystem::create_directories(AssetManager::getResourcePath("data/config")); std::filesystem::create_directories(AssetManager::getConfigPath("data/config"));
} }
auto filePath = AssetManager::getResourcePath("data/config/settings.bin"); auto filePath = AssetManager::getConfigPath("data/config/settings.bin");
std::ofstream settingsFile(filePath, std::ios::trunc | std::ios::binary); std::ofstream settingsFile(filePath, std::ios::trunc | std::ios::binary);
if (!settingsFile.good()) { if (!settingsFile.good()) {
std::cerr << "ERROR: Could not open file " << filePath << std::endl; std::cerr << "ERROR: Could not open file " << filePath << std::endl;
@@ -182,11 +182,11 @@ bool resetKeybindFile(int layout) {
return false; return false;
} }
if (!std::filesystem::exists(AssetManager::getResourcePath("data/config/keybinds"))) { if (!std::filesystem::exists(AssetManager::getConfigPath("data/config/keybinds"))) {
std::filesystem::create_directories(AssetManager::getResourcePath("data/config/keybinds")); std::filesystem::create_directories(AssetManager::getConfigPath("data/config/keybinds"));
} }
auto filePath = AssetManager::getResourcePath("data/config/keybinds/layout" + std::to_string(layout) + ".bin"); auto filePath = AssetManager::getConfigPath("data/config/keybinds/layout" + std::to_string(layout) + ".bin");
std::ofstream layoutFile(filePath, std::ios::trunc | std::ios::binary); std::ofstream layoutFile(filePath, std::ios::trunc | std::ios::binary);
if (!layoutFile.good()) { if (!layoutFile.good()) {
std::cerr << "ERROR: Could not open file " << filePath << std::endl; std::cerr << "ERROR: Could not open file " << filePath << std::endl;

View File

@@ -151,6 +151,6 @@ bool PiecesFiles::getFilePath(int polyominoSize, std::string& filePath) const {
return false; return false;
} }
filePath = dataFolderPath / (std::to_string(polyominoSize) + "minos.bin"); filePath = (dataFolderPath / (std::to_string(polyominoSize) + "minos.bin")).string();
return true; return true;
} }

View File

@@ -1,12 +1,42 @@
#include "AssetManager.h" #include "AssetManager.h"
#ifdef _WIN32
#include <windows.h> //GetModuleFileNameW
#else
#include <limits.h>
#include <unistd.h> //readlink
#endif
namespace fs = std::filesystem; namespace fs = std::filesystem;
std::string AssetManager::getResourcePrefix() { static fs::path getExeDirectory(){
char* env = std::getenv("JMINOS_DATA"); #ifdef _WIN32
return env ? env : std::string{}; wchar_t path[MAX_PATH] = { 0 };
GetModuleFileNameW(NULL, path, MAX_PATH);
return path;
#else
char result[PATH_MAX];
ssize_t count = readlink("/proc/self/exe", result, PATH_MAX);
return std::string(result, (count > 0) ? count : 0);
#endif
}
static fs::path getEnv(const std::string& var) {
char* env = std::getenv(var.c_str());
return env ? env :
#ifdef JMINOS_IGNORE_WORKDIR
getExeDirectory().parent_path().parent_path();
#else
"";
#endif
} }
fs::path AssetManager::getResourcePath(const std::string& resource) { fs::path AssetManager::getResourcePath(const std::string& resource) {
return fs::path{getResourcePrefix()} / resource; return fs::path{getEnv("JMINOS_DATA")} / resource;
}
fs::path AssetManager::getConfigPath(const std::string& resource) {
return fs::path{getEnv("JMINOS_CONFIG")} / resource;
} }

View File

@@ -6,6 +6,13 @@
class AssetManager { class AssetManager {
public: public:
static std::string getResourcePrefix(); /**
* @brief Used to load things (might be read-only)
*/
static std::filesystem::path getResourcePath(const std::string& resource); static std::filesystem::path getResourcePath(const std::string& resource);
/**
* @brief Used to save things
*/
static std::filesystem::path getConfigPath(const std::string& resource);
}; };

View File

@@ -5,7 +5,16 @@ set_project("org.zulianc.jminos")
includes("@builtin/xpack") includes("@builtin/xpack")
option("external_build")
set_default(false)
option_end()
if has_config("external_build") then
add_requires("sfml 3.0.0", "zlib", {system = false}) add_requires("sfml 3.0.0", "zlib", {system = false})
add_defines("JMINOS_IGNORE_WORKDIR")
else
add_requires("sfml 3.0.0", "zlib")
end
set_languages("c++20") set_languages("c++20")
@@ -44,20 +53,7 @@ if is_plat("mingw") then
add_ldflags("-static-libstdc++", "-static") add_ldflags("-static-libstdc++", "-static")
end end
xpack("jminos") includes("xmake/xpack.lua")
set_formats("flatpak")
set_extension("")
set_title("jminos")
set_author("zulianc")
set_description("A test installer.")
set_homepage("https://git.ale-pri.com/TetrisNerd/jminos")
set_company("org.zulianc")
on_package(function (package)
os.cd("flatpak")
os.exec("flatpak-builder --force-clean --user --install-deps-from=flathub --repo=repo --install builddir org.zulianc.jminos.yml")
os.exec("flatpak build-bundle repo jminos.flatpak org.zulianc.jminos --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo")
os.mv("jminos.flatpak", package:outputdir())
end)
-- --
-- If you want to known more usage about xmake, please see https://xmake.io -- If you want to known more usage about xmake, please see https://xmake.io

36
xmake/xpack.lua Normal file
View File

@@ -0,0 +1,36 @@
if is_os("linux") then
xpack("jminos")
set_formats("flatpak")
set_extension("flatpak")
set_title("jminos")
set_author("zulianc")
set_description("A test installer.")
set_homepage("https://git.ale-pri.com/TetrisNerd/jminos")
set_company("org.zulianc")
on_package(function (package)
os.cd("flatpak")
os.exec("flatpak install org.flatpak.Builder --user -y")
os.exec("flatpak run org.flatpak.Builder --force-clean --user --install-deps-from=flathub --repo=repo --install builddir org.zulianc.jminos.yml")
os.exec("flatpak build-bundle repo jminos.flatpak org.zulianc.jminos --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo")
os.mv("jminos.flatpak", package:outputdir())
end)
on_load(function (package)
package:set("basename", package:name() .. "-v" .. package:version() .. "-" .. package:arch())
end)
else
xpack("jminos")
set_formats("zip", "nsis")
add_targets("graph")
add_installfiles("(data/**.png)")
set_iconfile("../flatpak/org.zulianc.jminos.ico")
on_load(function (package)
package:set("basename", package:name() .. "-v" .. package:version() .. "-" .. package:arch())
end)
after_installcmd(function (package, batchcmds)
batchcmds:rm(package:installdir("**/.gitkeep"))
end)
end