[][src]Crate winflip

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

x11

Structs

Desc

sapp_desc type TODO: Pull functions out into a trait or such

Event

TODO: Not make it heckin' C

GlFbConfig

Framebuffer config info for OpenGL

TouchPoint
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

EventType
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

MouseButton

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.