numworks / epsilon-sample-app-rust

A sample Rust app for the NumWorks graphing calculator
BSD 3-Clause "New" or "Revised" License
50 stars 11 forks source link

[Feature] More eadk.rs features #15

Closed Adi-df closed 2 years ago

Adi-df commented 2 years ago

Add some features to the external app development kit, including some C++ sample-app features missing in the rust one.

Colors

Create colors with new, from_rgb888 and from_hsv to convert from usual color systems to rgb565. Use const fn to make functions usable in const contexts. Add some pure colors constants.

Display

Add screen width and height constants. Create Rect with new and a SCREEN (full screen rect) constant. Point struct with new and a ZERO (top left corner) constant. Implement draw_string using string slice to pointer conversion.

Keyboard

Implementing scan which return a wrapper State around an u64. This State type can query the internal state through the key_down method. Create the key mod containing key codes.

Panic handler

Fill the screen in red with a message : "Error !" in top left.