S3D_GET_CALLBACK(3)
π S3D_GET_CALLBACK π
okay bestie, so this is a page from the s3d Manual β section 3, the library calls, the ones you actually call from your own code. and today's main character is s3d_get_callback, aka the little function that hands you back your event handler. no cap, it's short, it's sweet, let's go π¦
β¨ NAME β¨
s3d_get_callback β get callback of event π
like... literally, it gets you the callback of an event. that's the whole job. icon behavior.
πΈ SYNOPSIS πΈ
#include <s3d.h>
s3d_cb s3d_get_callback(uint8_t event);
so you pull in <s3d.h> first (obvi), and then boom π₯ β you've got a function that takes a uint8_t called event and gives you back an s3d_cb. that's your callback type, your little function pointer bestie.
π«Ά DESCRIPTION π«Ά
Returns the Callback-function of the event. that's it. that's the vibe. π
so when you have an event and you wanna know which function is currently handling it, you ask this girl and she tells you. then you can call it yourself. watch this:
struct s3d_evt e;
...
s3d_get_callback(S3D_EVENT_KEY)(e);
// will call the key-handling function with argument e.
okay so look at that second line again, because the way that works is so satisfying: s3d_get_callback(S3D_EVENT_KEY) gives you the function, and then the (e) right after it calls that function with e as its argument. one line, two steps, no notes. the comment even says it: // will call the key-handling function with argument e. slay π₯
and yeah, struct s3d_evt e; is just your event struct sitting there first, chillin', waiting to be passed in. the ... in between is you, living your life, doing your own setup. not our business. π
ngl the syntax looks a lil spooky the first time you see a function call chained onto a function call β but that's just how you call a function you got back from another function. read it left to right, you got this π
π AUTHOR π
Simon Wunderlich Author of s3d
yeah, he wrote s3d. legend behavior honestly. π
so that's the whole page, bestie β short, adorable, does exactly one thing and does it well. main character energy fr fr β
s3d β S3D_GET_CALLBACK(3) β and that's the sign-off, mwah π π§ β¨
π¦ where this page comes from
- debian bookworm: s3d-doc 0.2.2.1-5 Β· GPL-2.0-or-later
- debian trixie: s3d-doc 0.2.2.1-7 Β· GPL-2.0-or-later
- ubuntu jammy: s3d-doc 0.2.2.1-3build1 Β· GPL-2.0-or-later
- ubuntu noble: s3d-doc 0.2.2.1-6build3 Β· GPL-2.0-or-later
- ubuntu questing: s3d-doc 0.2.2.1-7build1
- ubuntu resolute: s3d-doc 0.2.2.1-7build3 Β· GPL-2.0-or-later
- ubuntu stonking: s3d-doc 0.2.3-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms