Merge branch 'ZennDev1337:main' into main
This commit is contained in:
commit
a485c43f6c
5 changed files with 86 additions and 3 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -31,6 +31,13 @@ version = "1.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cracker"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"arduboy-rust",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "critical-section"
|
name = "critical-section"
|
||||||
version = "1.1.2"
|
version = "1.1.2"
|
||||||
|
|
|
@ -15,5 +15,6 @@ members = [
|
||||||
"Examples/rustacean",
|
"Examples/rustacean",
|
||||||
"Examples/snake",
|
"Examples/snake",
|
||||||
"Project/game",
|
"Project/game",
|
||||||
|
"Project/cracker",
|
||||||
]
|
]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
74
README.md
74
README.md
|
@ -183,6 +183,80 @@ Windows:
|
||||||
.\run.bat tone
|
.\run.bat tone
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Create a new project
|
||||||
|
|
||||||
|
In the root of the repo use the command:
|
||||||
|
|
||||||
|
(Don't use "-" in the name because of a cargo feature that takes the "-" and mixes sometimes with a "\_". You will have some weird behavior with the run tool.)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo new --lib ./Project/newproject
|
||||||
|
```
|
||||||
|
|
||||||
|
Then open the Cargo.toml in your new project and add the following dependencies and settings:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[lib]
|
||||||
|
crate-type = ["staticlib"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
|
||||||
|
arduboy-rust = { path = "../../arduboy-rust" }
|
||||||
|
```
|
||||||
|
|
||||||
|
Next jump in your lib.rs file and add the following:
|
||||||
|
|
||||||
|
```rust
|
||||||
|
#![no_std]
|
||||||
|
#![allow(non_upper_case_globals)]
|
||||||
|
|
||||||
|
//Include the Arduboy Library
|
||||||
|
#[allow(unused_imports)]
|
||||||
|
use arduboy_rust::prelude::*;
|
||||||
|
#[allow(dead_code)]
|
||||||
|
const arduboy: Arduboy2 = Arduboy2::new();
|
||||||
|
|
||||||
|
// Progmem data
|
||||||
|
|
||||||
|
// dynamic ram variables
|
||||||
|
|
||||||
|
// The setup() function runs once when you turn your Arduboy on
|
||||||
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn setup() {
|
||||||
|
// put your setup code here, to run once:
|
||||||
|
}
|
||||||
|
|
||||||
|
// The loop() function repeats forever after setup() is done
|
||||||
|
#[no_mangle]
|
||||||
|
#[export_name = "loop"]
|
||||||
|
pub unsafe extern "C" fn loop_() {
|
||||||
|
// put your main code here, to run repeatedly:
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Now the last step. Go in the Cargo.toml in the root directory and add your project:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[workspace]
|
||||||
|
members = [
|
||||||
|
{All other Projects...}
|
||||||
|
"Project/newproject",
|
||||||
|
]
|
||||||
|
resolver = "2"
|
||||||
|
```
|
||||||
|
|
||||||
|
To run and upload your game use the run tool
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Linux
|
||||||
|
./run newproject
|
||||||
|
```
|
||||||
|
|
||||||
|
```ps1
|
||||||
|
# Windows
|
||||||
|
.\run.bat newproject
|
||||||
|
```
|
||||||
|
|
||||||
## Creating and building an Arduboy crate [Outdated]
|
## Creating and building an Arduboy crate [Outdated]
|
||||||
|
|
||||||
You can find instructions on how all build steps work in detail here [ArduboyRust creating and building an arduboy crate](https://github.com/Seeker14491/ArduboyRust#creating-and-building-an-arduboy-crate)
|
You can find instructions on how all build steps work in detail here [ArduboyRust creating and building an arduboy crate](https://github.com/Seeker14491/ArduboyRust#creating-and-building-an-arduboy-crate)
|
||||||
|
|
5
run
5
run
|
@ -52,6 +52,7 @@ elif [ "$option" = "demo7" ]
|
||||||
then
|
then
|
||||||
upload
|
upload
|
||||||
else
|
else
|
||||||
echo Usage: for uploading your game \|./run.sh
|
upload
|
||||||
echo Usage: for uploading an example game \| ./run.sh \<Example Game\>
|
# echo Usage: for uploading your game \|./run.sh
|
||||||
|
# echo Usage: for uploading an example game \| ./run.sh \<Example Game\>
|
||||||
fi
|
fi
|
||||||
|
|
2
run.bat
2
run.bat
|
@ -40,7 +40,7 @@ goto :eof
|
||||||
) else if %option%==demo7 (
|
) else if %option%==demo7 (
|
||||||
goto :run
|
goto :run
|
||||||
) else (
|
) else (
|
||||||
goto :help
|
goto :run
|
||||||
)
|
)
|
||||||
|
|
||||||
:run
|
:run
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue