update of the docs and readme

This commit is contained in:
ZennCode 2023-08-08 08:36:49 +02:00
parent 24f794ce8a
commit 2287869945
4 changed files with 33 additions and 14 deletions

View file

@ -40,7 +40,11 @@ Your game is located in the Project/game folder. This is also the folder you are
Inside the game folder you will find a lib.rs file which contains the setup and loop function as you know it from a normal Arduboy C project. Inside the game folder you will find a lib.rs file which contains the setup and loop function as you know it from a normal Arduboy C project.
You can use the following command to open the Rust doc of the arduboy_rust crate You can find the Docs here:
- [arduboy-rust Crate Docs](https://zenndev1337.github.io/Rust-for-Arduboy-Docs/arduboy_rust/index.html)
or you can use the following command to open the arduboy-rust Crate docs locally
```bash ```bash
cargo doc -p arduboy-rust --open cargo doc -p arduboy-rust --open

View file

@ -20,11 +20,7 @@ pub const WIDTH: u8 = 128;
/// ///
/// this is to calculate with it. /// this is to calculate with it.
pub const HEIGHT: u8 = 64; pub const HEIGHT: u8 = 64;
#[doc(hidden)]
#[derive(Copy, Clone)]
pub struct Pstring {
pub pointer: *const i8,
}
/// This item is to chose between Black or White /// This item is to chose between Black or White
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)] #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)]
#[repr(u8)] #[repr(u8)]
@ -44,15 +40,23 @@ impl Not for Color {
} }
} }
} }
/// This struct is used by a few Arduboy functions.
pub struct Rect { pub struct Rect {
x: i16, /// Position X
y: i16, pub x: i16,
width: u8, /// Position Y
height: u8, pub y: i16,
/// Rect width
pub width: u8,
/// Rect height
pub height: u8,
} }
/// This struct is used by a few Arduboy functions.
pub struct Point { pub struct Point {
x: i16, /// Position X
y: i16, pub x: i16,
/// Position Y
pub y: i16,
} }
/// This is the struct to interact in a save way with the Arduboy2 C++ library. /// This is the struct to interact in a save way with the Arduboy2 C++ library.

View file

@ -82,3 +82,12 @@ macro_rules! f {
}}; }};
} }
pub(super) use f; pub(super) use f;
/// This struct is important for the Progmem functionality.
///
/// Typically you will never use this by your self.
/// It will be used by the get_string_addr macro in combination with a print command.
#[derive(Copy, Clone)]
pub struct Pstring {
pub pointer: *const i8,
}

View file

@ -1,9 +1,10 @@
//! This is the imported one to use this library effective in your project //! This is the important one to use this library effective in your project
pub use crate::library::arduboy::Arduboy; pub use crate::library::arduboy::Arduboy;
pub use core::ffi::{ pub use core::ffi::{
c_char, c_double, c_float, c_int, c_long, c_longlong, c_size_t, c_uchar, c_uint, c_ulong, c_char, c_double, c_float, c_int, c_long, c_longlong, c_size_t, c_uchar, c_uint, c_ulong,
c_ulonglong, c_ulonglong,
}; };
#[doc(hidden)]
pub use core::ptr::addr_of; pub use core::ptr::addr_of;
///The main [Arduboy] struct ready to use in your project ///The main [Arduboy] struct ready to use in your project
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
@ -12,11 +13,12 @@ pub const arduboy: Arduboy = Arduboy {};
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
pub const sound: Sound = Sound {}; pub const sound: Sound = Sound {};
pub use crate::hardware::buttons::*; pub use crate::hardware::buttons::*;
pub use crate::library::arduboy::{Color, Point, Pstring, Rect, FONT_SIZE, HEIGHT, WIDTH}; pub use crate::library::arduboy::{Color, Point, Rect, FONT_SIZE, HEIGHT, WIDTH};
pub use crate::library::arduboy_tone::*; pub use crate::library::arduboy_tone::*;
pub use crate::library::arduino::*; pub use crate::library::arduino::*;
pub use crate::library::c::*; pub use crate::library::c::*;
pub use crate::library::eeprom::EEPROM; pub use crate::library::eeprom::EEPROM;
pub use crate::library::progmem::Pstring;
pub use crate::library::sprites; pub use crate::library::sprites;
pub use crate::print::*; pub use crate::print::*;
pub use crate::{f, get_sprite_addr, get_string_addr, get_tones_addr, progmem}; pub use crate::{f, get_sprite_addr, get_string_addr, get_tones_addr, progmem};