Compare commits
9 Commits
508405b00c
...
xpack
| Author | SHA1 | Date | |
|---|---|---|---|
|
a836dd31e2
|
|||
|
94e5450a74
|
|||
|
7977fb976b
|
|||
|
86a034a4ac
|
|||
|
9208a5750d
|
|||
|
7301c40ba9
|
|||
|
792bf73e79
|
|||
|
c9d5cc35ff
|
|||
|
7040ce3381
|
@@ -1,2 +1,2 @@
|
||||
#!/bin/sh
|
||||
JMINOS_DATA="/app/share" /app/bin/graph
|
||||
JMINOS_DATA="/app/share" JMINOS_CONFIG=$XDG_CONFIG_HOME /app/bin/graph
|
||||
@@ -3,6 +3,7 @@ Type=Application
|
||||
Version=1.0
|
||||
Name=Jminos
|
||||
Exec=/usr/bin/graph
|
||||
Icon=org.zulianc.jminos
|
||||
Terminal=false
|
||||
Categories=Game;
|
||||
Comment=Amazing stacker game by the J
|
||||
BIN
flatpak/org.zulianc.jminos.ico
Normal file
BIN
flatpak/org.zulianc.jminos.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
71
flatpak/org.zulianc.jminos.metainfo.xml
Normal file
71
flatpak/org.zulianc.jminos.metainfo.xml
Normal 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>
|
||||
BIN
flatpak/org.zulianc.jminos.png
Normal file
BIN
flatpak/org.zulianc.jminos.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
@@ -1,4 +1,4 @@
|
||||
id: org.zulianc.jminos
|
||||
app-id: org.zulianc.jminos
|
||||
runtime: org.freedesktop.Platform
|
||||
runtime-version: "24.08"
|
||||
sdk: org.freedesktop.Sdk
|
||||
@@ -9,18 +9,7 @@ finish-args:
|
||||
- --device=dri
|
||||
|
||||
modules:
|
||||
- name: xmake
|
||||
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
|
||||
- xmake.yml
|
||||
|
||||
- name: jminos
|
||||
buildsystem: simple
|
||||
@@ -34,7 +23,9 @@ modules:
|
||||
- install -D output/bin/* /app/bin
|
||||
- cp -r output/data /app/share
|
||||
- install -D flatpak/FlatpakLaunch.sh /app/bin
|
||||
- install -D -t /app/share/applications flatpak/org.zulianc.jminos.desktop
|
||||
- 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:
|
||||
- type: dir
|
||||
path: ..
|
||||
|
||||
12
flatpak/xmake.yml
Normal file
12
flatpak/xmake.yml
Normal 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
|
||||
@@ -21,7 +21,7 @@ Keybinds::Keybinds(int layoutNumber) :
|
||||
}
|
||||
|
||||
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) {
|
||||
this->keybinds.at(action).clear();
|
||||
@@ -48,7 +48,7 @@ void Keybinds::loadKeybindsFromFile() {
|
||||
void Keybinds::saveKeybindsToFile() const {
|
||||
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;
|
||||
for (Action action : ACTION_LIST_IN_ORDER) {
|
||||
|
||||
@@ -50,7 +50,7 @@ void Settings::loadPieces(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;
|
||||
|
||||
// file format version
|
||||
@@ -159,7 +159,7 @@ void Settings::saveSettingsToFile() const {
|
||||
|
||||
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;
|
||||
|
||||
// file format version
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
[[nodiscard]] bool resetKeybindFile(int layout);
|
||||
|
||||
|
||||
int main() {
|
||||
int main(int arc, char** args) {
|
||||
std::srand(std::time(NULL));
|
||||
|
||||
bool everythingIsOK = true;
|
||||
@@ -59,19 +59,19 @@ int main() {
|
||||
|
||||
// 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;
|
||||
everythingIsOK &= resetSettingsFile();
|
||||
|
||||
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;
|
||||
everythingIsOK &= resetKeybindFile(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
settingsFile.get(byte);
|
||||
@@ -101,11 +101,11 @@ int main() {
|
||||
|
||||
|
||||
bool resetSettingsFile() {
|
||||
if (!std::filesystem::exists(AssetManager::getResourcePath("data/config"))) {
|
||||
std::filesystem::create_directories(AssetManager::getResourcePath("data/config"));
|
||||
if (!std::filesystem::exists(AssetManager::getConfigPath("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);
|
||||
if (!settingsFile.good()) {
|
||||
std::cerr << "ERROR: Could not open file " << filePath << std::endl;
|
||||
@@ -182,11 +182,11 @@ bool resetKeybindFile(int layout) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!std::filesystem::exists(AssetManager::getResourcePath("data/config/keybinds"))) {
|
||||
std::filesystem::create_directories(AssetManager::getResourcePath("data/config/keybinds"));
|
||||
if (!std::filesystem::exists(AssetManager::getConfigPath("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);
|
||||
if (!layoutFile.good()) {
|
||||
std::cerr << "ERROR: Could not open file " << filePath << std::endl;
|
||||
|
||||
@@ -151,6 +151,6 @@ bool PiecesFiles::getFilePath(int polyominoSize, std::string& filePath) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
filePath = dataFolderPath / (std::to_string(polyominoSize) + "minos.bin");
|
||||
filePath = (dataFolderPath / (std::to_string(polyominoSize) + "minos.bin")).string();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,42 @@
|
||||
#include "AssetManager.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h> //GetModuleFileNameW
|
||||
#else
|
||||
#include <limits.h>
|
||||
#include <unistd.h> //readlink
|
||||
#endif
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
std::string AssetManager::getResourcePrefix() {
|
||||
char* env = std::getenv("JMINOS_DATA");
|
||||
return env ? env : std::string{};
|
||||
static fs::path getExeDirectory(){
|
||||
#ifdef _WIN32
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
@@ -6,6 +6,13 @@
|
||||
|
||||
class AssetManager {
|
||||
public:
|
||||
static std::string getResourcePrefix();
|
||||
/**
|
||||
* @brief Used to load things (might be read-only)
|
||||
*/
|
||||
static std::filesystem::path getResourcePath(const std::string& resource);
|
||||
|
||||
/**
|
||||
* @brief Used to save things
|
||||
*/
|
||||
static std::filesystem::path getConfigPath(const std::string& resource);
|
||||
};
|
||||
16
xmake.lua
16
xmake.lua
@@ -11,6 +11,7 @@ option_end()
|
||||
|
||||
if has_config("external_build") then
|
||||
add_requires("sfml 3.0.0", "zlib", {system = false})
|
||||
add_defines("JMINOS_IGNORE_WORKDIR")
|
||||
else
|
||||
add_requires("sfml 3.0.0", "zlib")
|
||||
end
|
||||
@@ -52,20 +53,7 @@ if is_plat("mingw") then
|
||||
add_ldflags("-static-libstdc++", "-static")
|
||||
end
|
||||
|
||||
xpack("jminos")
|
||||
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)
|
||||
includes("xmake/xpack.lua")
|
||||
|
||||
--
|
||||
-- If you want to known more usage about xmake, please see https://xmake.io
|
||||
|
||||
36
xmake/xpack.lua
Normal file
36
xmake/xpack.lua
Normal 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
|
||||
Reference in New Issue
Block a user