Skip to content

Commit

Permalink
Merge pull request #15 from altalk23/main
Browse files Browse the repository at this point in the history
gdshare maintainmeny changes from 2.1
  • Loading branch information
HJfod committed Jan 28, 2024
2 parents cfe21ff + 82ddff6 commit 87c5102
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: Build Output
path: ${{ steps.build.outputs.build-output }}
path: ${{ steps.build.outputs.build-output }}
44 changes: 42 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,42 @@
build/
.vscode/
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la

# Executables
*.exe
*.out
*.app

# Macos be like
**/.DS_Store

# Cache files for Sublime Text
**/*.tmlanguage.cache
**/*.tmPreferences.cache
**/*.stTheme.cache

# Workspace files are user-specific
**/*.sublime-workspace
**/*.sublime-project
.vscode
.idea

# Ignore build folders
**/build
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@ cmake_minimum_required(VERSION 3.3.0)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

project(GDShare VERSION 1.0.0)
project(GDShare VERSION 1.0.1)

file(GLOB_RECURSE SOURCES
src/*.cpp
)

add_library(${PROJECT_NAME} SHARED ${SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")

if (NOT DEFINED ENV{GEODE_SDK})
message(FATAL_ERROR "Unable to find Geode SDK! Please define GEODE_SDK environment variable to point to Geode")
else()
message(STATUS "Found Geode: $ENV{GEODE_SDK}")
endif()

set(GEODE_LINK_NIGHTLY On)
add_subdirectory($ENV{GEODE_SDK} $ENV{GEODE_SDK}/build)
add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode)

target_link_libraries(${PROJECT_NAME} geode-sdk)
setup_geode_mod(${PROJECT_NAME} EXTERNALS geode.node-ids:1.0.0)
setup_geode_mod(${PROJECT_NAME} EXTERNALS geode.node-ids:1.0.0)
10 changes: 7 additions & 3 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"geode": "v2.0.0",
"gd": "2.204",
"version": "v1.0.4",
"geode": "2.0.0",
"gd": {
"win": "2.204",
"android": "2.205",
"mac": "2.200"
}
"version": "1.0.4",
"id": "hjfod.gdshare",
"name": "GDShare",
"developer": "HJfod",
Expand Down
22 changes: 12 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

#include <Geode/Loader.hpp>
#include <Geode/Modify.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/modify/LevelBrowserLayer.hpp>
#include <Geode/modify/LevelInfoLayer.hpp>
#include <Geode/modify/EditLevelLayer.hpp>
#include <Geode/modify/IDManager.hpp>
#include <Geode/ui/Popup.hpp>
#include <hjfod.gmd-api/include/GMD.hpp>
Expand Down Expand Up @@ -48,15 +49,15 @@ class ExportLevelLayer : public Popup<GJGameLevel*> {
void promptExportLevel(GJGameLevel* level) {
auto opts = IMPORT_PICK_OPTIONS;
opts.defaultPath = std::string(level->m_levelName) + ".gmd";
if (auto path = file::pickFile(file::PickMode::SaveFile, opts)) {
auto res = exportLevelAsGmd(level, path.unwrap());
file::pickFile(file::PickMode::SaveFile, opts, [=](auto path){
auto res = exportLevelAsGmd(level, path);
if (res) {
createQuickPopup(
"Exported",
"Succesfully exported level",
"OK", "Open File",
[path](auto, bool btn2) {
if (btn2) file::openFolder(path.unwrap());
if (btn2) file::openFolder(path);
}
);
}
Expand All @@ -67,7 +68,7 @@ void promptExportLevel(GJGameLevel* level) {
"OK"
)->show();
}
}
});
}

struct $modify(ExportMyLevelLayer, EditLevelLayer) {
Expand Down Expand Up @@ -160,12 +161,13 @@ struct $modify(ImportLayer, LevelBrowserLayer) {
}

void onImport(CCObject*) {
if (auto file = file::pickFile(
file::pickFile(
file::PickMode::OpenFile,
IMPORT_PICK_OPTIONS
)) {
this->importFile(file.value());
}
IMPORT_PICK_OPTIONS,
[=](auto file) {
this->importFile(file);
}
);
}

bool init(GJSearchObject* search) {
Expand Down

0 comments on commit 87c5102

Please sign in to comment.