Expand description
Just jotting down differences from sokol_app here:
- C’s “everything is an int” is still awful.
- RAII makes life SO MUCH EASIER
- Because of that we don’t need wonky multi-stage constructors and destructors
- Or state variables to keep track of whether or not something is initialized
- Not allowing things to create invalid values is so much easier – Option where you need it, dawg
- The Default trait makes life so much easier
- Structs of function pointers as vtables is sometimes honestly more convenient than traits
- And sometimes not, they’re basically trait objects
- Having a real stdlib with things like Vec::with_capacity() and mem::zeroed() and panic!() are real effin’ nice – lots of C code reinvents the same damn wheels over and over.
- C encouraging everything to be static’s is basically horrible…
- …and part of that is due to lack of generics and other powerful type systems
- People get antsy when cargo downloads 200 crates but nobody seems to care when
apt install xorg-dev
chucks 30 MB of header files into random places - ifdef’s are basically awful, and C’s lack of modules makes them more common
- The best C API doc generator is
rustdoc
Modules§
Structs§
- Desc
- sapp_desc type TODO: Pull functions out into a trait or such
- Event
- TODO: Not make it heckin’ C
- GlFb
Config - Framebuffer config info for OpenGL
- Touch
Point - WFApp
- Basic application context, should be toplevel type where state lives.
This is
_sapp_state
, give or take some. Basically all the window state that isn’t part of a particular backend.
Enums§
- Event
Type - Eventt
- Semi-experimental refactor of Event type to use real enums instead of C BS.
- Keycode
- key codes are the same names and values as GLFW
- Mouse
Button
Constants§
- MAX_
KEYCODES - MAX_
MOUSEBUTTONS - MAX_
TOUCHPOINTS - MOD_ALT
- MOD_
CTRL - MOD_
SHIFT - Modifier keys. TODO: Bitflags crate???
- MOD_
SUPER
Traits§
- Window
- Basically the public API, the sapp_*() functions in Sokol Backends implement this, for now.