diff --git a/Cargo.toml b/Cargo.toml index f4df5ae..a250f00 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ license = "MIT OR Apache-2.0" repository = "https://forgejo.fireturlte.net/lazy-supplements" [workspace.dependencies] -bevy = "0.16.1" +bevy = { git = "https://github.com/bevyengine/bevy.git", rev="16ffdaea0daec11e4347d965f56c9c8e1122a488" } chrono = "0.4.41" ciborium = "0.2.2" clap = { version = "4.5.38", features = ["derive"] } diff --git a/core/src/config/storage.rs b/core/src/config/storage.rs index a6f2ead..8cd8607 100644 --- a/core/src/config/storage.rs +++ b/core/src/config/storage.rs @@ -66,7 +66,7 @@ impl PartialStorageConfig { Ok(cache_dir.to_string()) } - #[cfg(target_os="ios")] + #[cfg(false)] fn default_ios(){ unsafe { let file_manager: *mut Object = msg_send![Class::get("NSFileManager").unwrap(), defaultManager]; diff --git a/examples/desktop/Cargo.toml b/examples/desktop/Cargo.toml index a5943e1..42b4277 100644 --- a/examples/desktop/Cargo.toml +++ b/examples/desktop/Cargo.toml @@ -6,8 +6,6 @@ description.workspace = true license.workspace = true repository.workspace = true -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] clap.workspace = true caretta-sync = { path = "../..", features = ["cli", "bevy", "test"] } diff --git a/examples/desktop/Dioxus.toml b/examples/desktop/Dioxus.toml deleted file mode 100644 index 659b7b6..0000000 --- a/examples/desktop/Dioxus.toml +++ /dev/null @@ -1,21 +0,0 @@ -[application] - -[web.app] - -# HTML title tag content -title = "desktop" - -# include `assets` in web platform -[web.resource] - -# Additional CSS style files -style = [] - -# Additional JavaScript files -script = [] - -[web.resource.dev] - -# Javascript code file -# serve: [dev-server] only -script = [] diff --git a/examples/desktop/README.md b/examples/desktop/README.md deleted file mode 100644 index 1e629b6..0000000 --- a/examples/desktop/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Development - -Your new bare-bones project includes minimal organization with a single `main.rs` file and a few assets. - -``` -project/ -├─ assets/ # Any assets that are used by the app should be placed here -├─ src/ -│ ├─ main.rs # main.rs is the entry point to your application and currently contains all components for the app -├─ Cargo.toml # The Cargo.toml file defines the dependencies and feature flags for your project -``` - -### Serving Your App - -Run the following command in the root of your project to start developing with the default platform: - -```bash -dx serve -``` - -To run for a different platform, use the `--platform platform` flag. E.g. -```bash -dx serve --platform desktop -``` - diff --git a/examples/desktop/clippy.toml b/examples/desktop/clippy.toml deleted file mode 100644 index 40456af..0000000 --- a/examples/desktop/clippy.toml +++ /dev/null @@ -1,8 +0,0 @@ -await-holding-invalid-types = [ - "generational_box::GenerationalRef", - { path = "generational_box::GenerationalRef", reason = "Reads should not be held over an await point. This will cause any writes to fail while the await is pending since the read borrow is still active." }, - "generational_box::GenerationalRefMut", - { path = "generational_box::GenerationalRefMut", reason = "Write should not be held over an await point. This will cause any reads or writes to fail while the await is pending since the write borrow is still active." }, - "dioxus_signals::Write", - { path = "dioxus_signals::Write", reason = "Write should not be held over an await point. This will cause any reads or writes to fail while the await is pending since the write borrow is still active." }, -] diff --git a/examples/desktop/src/ipc.rs b/examples/desktop/src/ipc.rs deleted file mode 100644 index e69de29..0000000 diff --git a/examples/desktop/src/main.rs b/examples/desktop/src/main.rs index 9132165..bf2420b 100644 --- a/examples/desktop/src/main.rs +++ b/examples/desktop/src/main.rs @@ -4,9 +4,6 @@ use clap::Parser; use crate::cli::Cli; -mod cli; -mod ipc; - fn main() { let args = Cli::parse(); args.run(APP_NAME); diff --git a/examples/desktop/src/message.rs b/examples/desktop/src/message.rs deleted file mode 100644 index e69de29..0000000 diff --git a/examples/mobile/.gitignore b/examples/mobile/.gitignore new file mode 100644 index 0000000..0f1f32c --- /dev/null +++ b/examples/mobile/.gitignore @@ -0,0 +1,7 @@ +/build +.gradle +.idea +.DS_Store +build +.cxx +local.properties diff --git a/examples/mobile/Cargo.toml b/examples/mobile/Cargo.toml index a5f75a3..939a63b 100644 --- a/examples/mobile/Cargo.toml +++ b/examples/mobile/Cargo.toml @@ -6,5 +6,15 @@ description.workspace = true license.workspace = true repository.workspace = true +[[bin]] +name = "caretta_sync_example" +path = "src/main.rs" + +[lib] +name = "caretta_sync_example" +crate-type = ["lib", "cdylib"] + [dependencies] +bevy.workspace = true caretta-sync-example-core.path = "../core" +caretta-sync.path = "../.." diff --git a/examples/mobile/ios/Makefile b/examples/mobile/ios/Makefile new file mode 100644 index 0000000..30f0654 --- /dev/null +++ b/examples/mobile/ios/Makefile @@ -0,0 +1,25 @@ +.PHONY: xcodebuild run install boot-sim generate clean + +DEVICE = ${DEVICE_ID} +ifndef DEVICE_ID + DEVICE=$(shell xcrun simctl list devices 'iOS' | grep -v 'unavailable' | grep -v '^--' | grep -v '==' | head -n 1 | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})") +endif + +run: install + xcrun simctl launch --console $(DEVICE) net.fireturtle.caretta-sync-example + +boot-sim: + xcrun simctl boot $(DEVICE) || true + +install: xcodebuild-simulator boot-sim + xcrun simctl install $(DEVICE) build/Build/Products/Debug-iphonesimulator/caretta_sync_example.app + +xcodebuild-simulator: + IOS_TARGETS=x86_64-apple-ios xcodebuild -scheme caretta_sync_example -configuration Debug -derivedDataPath build -destination "id=$(DEVICE)" + +xcodebuild-iphone: + IOS_TARGETS=aarch64-apple-ios xcodebuild -scheme caretta_sync_example -configuration Debug -derivedDataPath build -arch arm64 + +clean: + rm -r build + cargo clean diff --git a/examples/mobile/ios/build_rust_deps.sh b/examples/mobile/ios/build_rust_deps.sh new file mode 100755 index 0000000..3764f3a --- /dev/null +++ b/examples/mobile/ios/build_rust_deps.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +# based on https://github.com/mozilla/glean/blob/main/build-scripts/xc-universal-binary.sh + +set -eux + +PATH=$PATH:$HOME/.cargo/bin + +PROFILE=debug +RELFLAG= +if [[ "$CONFIGURATION" != "Debug" ]]; then + PROFILE=release + RELFLAG=--release +fi + +set -euvx + +# add homebrew bin path, as it's the most commonly used package manager on macOS +# this is needed for cmake on apple arm processors as it's not available by default +export PATH="$PATH:/opt/homebrew/bin" + +# Make Cargo output cache files in Xcode's directories +export CARGO_TARGET_DIR="$DERIVED_FILE_DIR/cargo" + +# Xcode places `/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin` +# at the front of the path, with makes the build fail with `ld: library 'System' not found`, upstream issue: +# . +# +# Work around it by resetting the path, so that we use the system `cc`. +export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" + +IS_SIMULATOR=0 +if [ "${LLVM_TARGET_TRIPLE_SUFFIX-}" = "-simulator" ]; then + IS_SIMULATOR=1 +fi + +EXECUTABLES= +for arch in $ARCHS; do + case "$arch" in + x86_64) + if [ $IS_SIMULATOR -eq 0 ]; then + echo "Building for x86_64, but not a simulator build. What's going on?" >&2 + exit 2 + fi + + # Intel iOS simulator + export CFLAGS_x86_64_apple_ios="-target x86_64-apple-ios" + TARGET=x86_64-apple-ios + ;; + + arm64) + if [ $IS_SIMULATOR -eq 0 ]; then + # Hardware iOS targets + TARGET=aarch64-apple-ios + else + # M1 iOS simulator + TARGET=aarch64-apple-ios-sim + fi + esac + cd .. + cargo build $RELFLAG --target $TARGET --bin caretta_sync_example + cd - + # Collect the executables + EXECUTABLES="$EXECUTABLES $DERIVED_FILE_DIR/cargo/$TARGET/$PROFILE/caretta_sync_example" +done + +# Combine executables, and place them at the output path excepted by Xcode +lipo -create -output "$TARGET_BUILD_DIR/$EXECUTABLE_PATH" $EXECUTABLES diff --git a/examples/mobile/ios/caretta_sync_example.xcodeproj/project.pbxproj b/examples/mobile/ios/caretta_sync_example.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c18418f --- /dev/null +++ b/examples/mobile/ios/caretta_sync_example.xcodeproj/project.pbxproj @@ -0,0 +1,307 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXFileReference section */ + B617AE7C2E5D5E5A0013202E /* caretta_sync_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = caretta_sync_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + B698F93D2E5E743A00C7EE06 /* caretta_sync_example.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; name = caretta_sync_example.app; path = "build/Build/Products/Debug-iphonesimulator/caretta_sync_example.app"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXGroup section */ + B617AE732E5D5E5A0013202E = { + isa = PBXGroup; + children = ( + B617AE7D2E5D5E5A0013202E /* Products */, + B698F93D2E5E743A00C7EE06 /* caretta_sync_example.app */, + ); + sourceTree = ""; + }; + B617AE7D2E5D5E5A0013202E /* Products */ = { + isa = PBXGroup; + children = ( + B617AE7C2E5D5E5A0013202E /* caretta_sync_example.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + B617AE7B2E5D5E5A0013202E /* caretta_sync_example */ = { + isa = PBXNativeTarget; + buildConfigurationList = B617AE872E5D5E5B0013202E /* Build configuration list for PBXNativeTarget "caretta_sync_example" */; + buildPhases = ( + B698F8CE2E5D609900C7EE06 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = caretta_sync_example; + packageProductDependencies = ( + ); + productName = caretta_sync_example; + productReference = B617AE7C2E5D5E5A0013202E /* caretta_sync_example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + B617AE742E5D5E5A0013202E /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = NO; + LastSwiftUpdateCheck = 1640; + LastUpgradeCheck = 1640; + TargetAttributes = { + B617AE7B2E5D5E5A0013202E = { + CreatedOnToolsVersion = 16.4; + }; + }; + }; + buildConfigurationList = B617AE772E5D5E5A0013202E /* Build configuration list for PBXProject "caretta_sync_example" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = B617AE732E5D5E5A0013202E; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = B617AE7D2E5D5E5A0013202E /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + B617AE7B2E5D5E5A0013202E /* caretta_sync_example */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXShellScriptBuildPhase section */ + B698F8CE2E5D609900C7EE06 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(SRCROOT)/build_rust_deps.sh", + ); + outputFileListPaths = ( + ); + outputPaths = ( + $TARGET_BUILD_DIR/$EXECUTABLE_PATH, + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "./build_rust_deps.sh\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + B617AE852E5D5E5B0013202E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.5; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + B617AE862E5D5E5B0013202E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.5; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + B617AE882E5D5E5B0013202E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_PREVIEWS = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "net.fireturtle.caretta-sync-example"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + B617AE892E5D5E5B0013202E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_PREVIEWS = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "net.fireturtle.caretta-sync-example"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B617AE772E5D5E5A0013202E /* Build configuration list for PBXProject "caretta_sync_example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B617AE852E5D5E5B0013202E /* Debug */, + B617AE862E5D5E5B0013202E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + B617AE872E5D5E5B0013202E /* Build configuration list for PBXNativeTarget "caretta_sync_example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B617AE882E5D5E5B0013202E /* Debug */, + B617AE892E5D5E5B0013202E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = B617AE742E5D5E5A0013202E /* Project object */; +} diff --git a/examples/mobile/ios/caretta_sync_example.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/examples/mobile/ios/caretta_sync_example.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/examples/mobile/ios/caretta_sync_example.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/examples/mobile/ios/caretta_sync_example.xcodeproj/project.xcworkspace/xcuserdata/fluo10.xcuserdatad/UserInterfaceState.xcuserstate b/examples/mobile/ios/caretta_sync_example.xcodeproj/project.xcworkspace/xcuserdata/fluo10.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..b3211a6 Binary files /dev/null and b/examples/mobile/ios/caretta_sync_example.xcodeproj/project.xcworkspace/xcuserdata/fluo10.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/examples/mobile/ios/caretta_sync_example.xcodeproj/xcuserdata/fluo10.xcuserdatad/xcschemes/xcschememanagement.plist b/examples/mobile/ios/caretta_sync_example.xcodeproj/xcuserdata/fluo10.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..a26e37f --- /dev/null +++ b/examples/mobile/ios/caretta_sync_example.xcodeproj/xcuserdata/fluo10.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + caretta_sync_example.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/examples/mobile/src/lib.rs b/examples/mobile/src/lib.rs new file mode 100644 index 0000000..4681831 --- /dev/null +++ b/examples/mobile/src/lib.rs @@ -0,0 +1,70 @@ +use bevy::{ + color::palettes::basic::*, + input::{gestures::RotationGesture, touch::TouchPhase}, + log::{Level, LogPlugin}, + prelude::*, + window::{AppLifecycle, ScreenEdge, WindowMode}, + winit::WinitSettings, +}; + +#[bevy_main] +pub fn main() { + let mut app = App::new(); + app.add_plugins( + DefaultPlugins.set(LogPlugin { + level: Level::DEBUG, + filter: "wgpu=error,bevy_render=info,bevy_ecs_trace".to_string(), + ..Default::default() + }) + .set(WindowPlugin { + primary_window: Some(Window { + resizable: false, + mode: WindowMode::BorderlessFullscreen(MonitorSelection::Primary), + recognize_rotation_gesture: true, + prefers_home_indicator_hidden: true, + prefers_status_bar_hidden: true, + preferred_screen_edges_deferring_system_gestures: ScreenEdge::Bottom, + ..default() + }), + ..default() + }), + ) + .insert_resource(WinitSettings::mobile()) + .add_systems(Startup, setup_scene) + .run(); +} + +fn setup_scene( + mut commands: Commands, +) { + commands.spawn(( + Camera3d::default(), + Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y), + // MSAA makes some Android devices panic, this is under investigation + // https://github.com/bevyengine/bevy/issues/8229 + #[cfg(target_os = "android")] + Msaa::Off, + )); + commands + .spawn(( + Button, + Node { + justify_content: JustifyContent::Center, + align_items: AlignItems::Center, + position_type: PositionType::Absolute, + left: Val::Px(50.0), + right: Val::Px(50.0), + bottom: Val::Px(50.0), + ..default() + } + )) + .with_child(( + Text::new(format!( "{:?}", std::fs::read_dir(std::env::current_dir().unwrap()).unwrap().map(|x| x.unwrap().path()).collect::>())), + TextFont { + font_size: 16.0, + ..default() + }, + TextColor::BLACK, + TextLayout::new_with_justify(Justify::Center), + )); +} \ No newline at end of file diff --git a/examples/mobile/src/main.rs b/examples/mobile/src/main.rs index e830a8c..7171f42 100644 --- a/examples/mobile/src/main.rs +++ b/examples/mobile/src/main.rs @@ -1,3 +1 @@ -fn main() { - dioxus::launch(caretta_sync_example_core::ui::plain::App); -} \ No newline at end of file +use caretta_sync_example::main; \ No newline at end of file