Skip to content
This repository was archived by the owner on Aug 17, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ crate-type = ["cdylib", "rlib"]
path = "src/game.rs"

[[bin]]
name = "one_clicker-windows"
name = "one_clicker-game"
path = "src/desktop_main.rs"

# Audio formats should be enabled only in bevy_kira_audio
Expand All @@ -35,7 +35,7 @@ rand = "0.8"
bevy_tweening = "0.6"
bevy_ninepatch = "0.9"
iyes_loopless = "0.9"
bevy_embedded_assets = "0.6"
#bevy_embedded_assets = "0.7"
bevy_asset_loader = { version = "0.14", features = ["stageless"] }
winapi = { version = "0.3", features = ["winbase","std"]}
# Native dependencies
Expand All @@ -51,7 +51,13 @@ console_error_panic_hook = "0.1"
web-sys = { version = "0.3", features = ["Window"] }
gloo-events = "0.1"
wasm-bindgen = "0.2"

[target.'cfg(target_arch = "wasm32")'.dependencies.uuid]
version = "1.17.0"
# Lets you generate random UUIDs
features = [
"v4",
"js",
]
[profile.dev.package."*"]
# Compile all dependencies as release for extra fast
opt-level=3
Expand Down
98 changes: 90 additions & 8 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
[env]
PROJECT_NAME = '${CARGO_MAKE_CRATE_FS_NAME}'
WINDOWS_TARGET = 'x86_64-pc-windows-msvc'
WINDOWS_EXE_NAME = '${PROJECT_NAME}-windows.exe' # Should match whatever is set in Cargo.toml

LINUX_WINDOWS_CC_TARGET = 'x86_64-pc-windows-gnu' # for compiling for windows on linux
WINDOWS_EXE_NAME = '${PROJECT_NAME}-game.exe' # Should match whatever is set in Cargo.toml
LINUX_TARGET = 'x86_64-unknown-linux-gnu'
LINUX_EXE_NAME = '${PROJECT_NAME}-game'

[tasks.prepare-release-dir]
condition = { env_set = ['PLATFORM'] }
script_runner = '@duckscript'
script = '''
rm -r release/${PLATFORM}
mkdir release/${PLATFORM}
mkdir release/${PLATFORM}/assets
'''



[tasks.copy_assets]
condition = { env_set = ['PLATFORM'] }
script_runner = "@shell"
script = '''
cp assets/game/embedded/* release/${PLATFORM}/assets/ -r
'''
[tasks.copy_assets_linux]
env = { 'PLATFORM' = 'linux' }
run_task = 'copy_assets'

[tasks.copy_assets_windows]
env = { 'PLATFORM' = 'windows' }
run_task = 'copy_assets'

[tasks.zip-platform]
condition = { env_set = ['PLATFORM'] }
# TODO: Use something more lightweight here to zip the files
Expand Down Expand Up @@ -100,8 +119,8 @@ install_crate = { crate_name = 'wasm-pack', test_arg = '--help' }

[tasks.distrib-web]
env = { 'PLATFORM' = 'web' }
dependencies = ['prepare-release-dir-web', 'compile-web']
script_runner = '@duckscript'
dependencies = ['prepare-release-dir-web', 'compile-web','copy_assets']
script = '''
cp pkg/${PROJECT_NAME}_bg.wasm release/${PLATFORM}/${PROJECT_NAME}.wasm
cp pkg/${PROJECT_NAME}.js release/${PLATFORM}/${PROJECT_NAME}.js
Expand Down Expand Up @@ -136,13 +155,25 @@ run_task = 'prepare-release-dir'
command = 'cargo'
args = ['build', '--release', '--target', '${WINDOWS_TARGET}']

[tasks.compile-linux2windows]
command = 'cargo'
args = ['build', '--release', '--target', '${LINUX_WINDOWS_CC_TARGET}']


[tasks.distrib-windows]
env = { 'PLATFORM' = 'windows' }
dependencies = ['prepare-release-dir-windows', 'compile-windows']
dependencies = ['prepare-release-dir-windows', 'compile-windows','copy_assets_windows']
script_runner = '@duckscript'
script = '''
cp target/${WINDOWS_TARGET}/release/${WINDOWS_EXE_NAME} release/${PLATFORM}/${WINDOWS_EXE_NAME}
'''
[tasks.distrib-linux2windows]
env = { 'PLATFORM' = 'windows' }
dependencies = ['prepare-release-dir-windows', 'compile-linux2windows','copy_assets_windows']
script_runner = '@duckscript'
script = '''
cp target/${LINUX_WINDOWS_CC_TARGET}/release/${WINDOWS_EXE_NAME} release/${PLATFORM}/${WINDOWS_EXE_NAME}
'''

[tasks.zip-windows]
env = { 'PLATFORM' = 'windows' }
Expand All @@ -157,14 +188,65 @@ script_runner = '@duckscript'
script = '''
exec ${BUTLER_EXE} push release/windows ${ITCH_USER}/${ITCH_GAME}:windows --userversion ${CARGO_MAKE_PROJECT_VERSION}
'''
[tasks.zip-linux2windows]
env = { 'PLATFORM' = 'windows' }
dependencies = ['distrib-linux2windows']
run_task = 'zip-platform'

[tasks.publish-linux2windows]
env = { 'PLATFORM' = 'windows' }
dependencies = ['distrib-linux2windows']
condition = { env_set = ['BUTLER_EXE'] }
script_runner = '@duckscript'
script = '''
exec ${BUTLER_EXE} push release/windows ${ITCH_USER}/${ITCH_GAME}:windows --userversion ${CARGO_MAKE_PROJECT_VERSION}
'''

[tasks.prepare-release-dir-linux]
env = { 'PLATFORM' = 'linux' }
run_task = 'prepare-release-dir'

[tasks.compile-linux]
command = 'cargo'
args = ['build', '--release', '--target', '${LINUX_TARGET}']

[tasks.distrib-linux]
env = { 'PLATFORM' = 'linux' }
dependencies = ['prepare-release-dir-linux', 'compile-linux', 'copy_assets_linux']
script_runner = '@duckscript'
script = '''
cp target/${LINUX_TARGET}/release/${LINUX_EXE_NAME} release/${PLATFORM}/${LINUX_EXE_NAME}
'''
[tasks.run-linux]
condition = { env_set = ['PLATFORM'] }
dependencies = ['distrib-linux']
script = '''
release/${PLATFORM}/${LINUX_EXE_NAME}
'''
[tasks.run-windows]
condition = { env_set = ['PLATFORM'] }
dependencies = ['distrib-windows']
script = '''
start release/${PLATFORM}/${WINDOWS_EXE_NAME}
'''
[tasks.run-linux2windows]
condition = { env_set = ['PLATFORM'] }
dependencies = ['distrib-linux2windows']
script = '''
wine release/${PLATFORM}/${WINDOWS_EXE_NAME}
'''
[tasks.zip-linux]
env = { 'PLATFORM' = 'linux' }
dependencies = ['distrib-linux']
run_task = 'zip-platform'

[tasks.distrib]
description = 'Builds Web and Windows versions and places them into the release directory'
run_task = { name = ['distrib-web', 'distrib-windows'] }
description = 'Builds Web, Windows and Linux versions and places them into the release directory'
run_task = { name = ['distrib-web', 'distrib-windows', 'distrib-linux'] }

[tasks.zip]
description = 'Creates a ZIP archive containing both Web and Windows builds'
run_task = { name = ['zip-web', 'zip-windows'] }
description = 'Creates a ZIP archive containing all three builds'
run_task = { name = ['zip-web', 'zip-windows', 'zip-linux'] }

[tasks.publish]
env_files = [ './butler.env' ]
Expand Down
6 changes: 4 additions & 2 deletions src/game.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use bevy::prelude::*;
use bevy_asset_loader::prelude::*;
use bevy_embedded_assets::EmbeddedAssetPlugin;
use bevy_kira_audio::AudioPlugin;
use bevy_ninepatch::NinePatchPlugin;
use bevy_tweening::TweeningPlugin;
Expand Down Expand Up @@ -28,8 +27,11 @@ pub fn run(app: &mut App) {
..default()
})
.build()
.add_before::<AssetPlugin, _>(EmbeddedAssetPlugin),
)
//.add_plugin(AssetPlugin{
// asset_folder: "assets\\game\\embedded".to_string(),
// watch_for_changes: true,
//})
.add_plugin(AudioPlugin)
.add_plugin(NinePatchPlugin::<()>::default())
.add_plugin(TweeningPlugin)
Expand Down