Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add system api #47

Merged
merged 4 commits into from
Sep 15, 2023
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ jobs:
cargo test -p=playdate-display --lib --no-default-features --features=$FEATURES_1 -- --nocapture
cargo test -p=playdate-display --lib --no-default-features --features=$FEATURES_2 -- --nocapture

cargo test -p=playdate-system --lib --no-default-features --features=$FEATURES_1 -- --nocapture
cargo test -p=playdate-system --lib --no-default-features --features=$FEATURES_2 -- --nocapture

- name: Examples
run: |
FEATURES=bindgen-runtime,bindings-derive-debug
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions api/system/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[package]
name = "playdate-system"
version = "0.1.0"
edition = "2021"

readme = "README.md"
license = "MIT OR Apache-2.0"
authors = ["Alex Koz <[email protected]>"]
description = "High-level System API built on-top of Playdate API"
homepage = "https://github.com/boozook/playdate"
repository = "https://github.com/boozook/playdate.git"


[features]
default = ["sys/default"]
# sys- features:
lang-items = ["sys/lang-items"]
allocator = ["sys/allocator"]
panic-handler = ["sys/panic-handler"]
eh-personality = ["sys/eh-personality"]
error-ctx = ["sys/error-ctx"]
bindgen-runtime = ["sys/bindgen-runtime"]
bindgen-static = ["sys/bindgen-static"]
bindings-derive-default = ["sys/bindings-derive-default"]
bindings-derive-eq = ["sys/bindings-derive-eq"]
bindings-derive-copy = ["sys/bindings-derive-copy"]
bindings-derive-debug = ["sys/bindings-derive-debug"]
bindings-derive-hash = ["sys/bindings-derive-hash"]
bindings-derive-ord = ["sys/bindings-derive-ord"]
bindings-derive-partialeq = ["sys/bindings-derive-partialeq"]
bindings-derive-partialord = ["sys/bindings-derive-partialord"]
bindings-derive-constparamty = ["sys/bindings-derive-constparamty"]
bindings-documentation = ["sys/bindings-documentation"]


[dependencies.sys]
version = "0.1"
path = "../sys"
package = "playdate-sys"
default-features = false
29 changes: 29 additions & 0 deletions api/system/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# System API for PlayDate

High-level system API built on-top of [playdate-sys][].


## Usage

```rust
use playdate_system::*;
use playdate_sys::println;

let system = System::new();

match system.language() {
PDLanguage::English => println!("Hello"),
PDLanguage::Japanese => println!("こんにちは"),
PDLanguage::Unknown => println!("Привет"),
}
system.draw_fps(20, 20);
```


[playdate-sys]: https://crates.io/crates/playdate-sys



- - -

This software is not sponsored or supported by Panic.
11 changes: 11 additions & 0 deletions api/system/src/lang.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pub use sys::ffi::PDLanguage;

pub trait PDLanguageExt {
#![allow(non_upper_case_globals)]
const English: PDLanguage = PDLanguage::kPDLanguageEnglish;
const Japanese: PDLanguage = PDLanguage::kPDLanguageJapanese;
const Unknown: PDLanguage = PDLanguage::kPDLanguageUnknown;
}


impl PDLanguageExt for PDLanguage {}
Loading