S3DW_HANDLE_CLICK(3)

S3DW_HANDLE_CLICK πŸ’– (that's section 3 of the s3d manual, bestie)

okay so. you clicked a thing. you want the thing to do something. this is the function that makes the thing do the something. let's go πŸŽ€


✨ NAME ✨

s3dw_handle_click β€” handle click on widget πŸ’…


✨ SYNOPSIS ✨

#include <s3dw.h>

int s3dw_handle_click(const struct s3d_evt *event);

✨ DESCRIPTION ✨

so here's the tea, bestie πŸ«– β€” if you want your widgets to actually react to mouseclicks (and omg you do, believe me, you want that, everyone wants that, it's giving essential), you have to call s3dw_handle_click. that's the whole vibe.

you've got two ways to do it and both are iconic, pick your fighter:

  • way 1 β€” just hand it straight to the callback setter and let it be the clickhandler itself. one line, zero drama.
  • way 2 β€” write your own clickhandler function and call s3dw_handle_click inside it first, then do your own little extra stuff after. main character energy, you get to add your own sauce πŸ“

here's how both look in actual code, no cap:

// way 1:
s3d_set_callback(S3D_EVENT_OBJ_CLICK,s3dw_handle_click);

// way 2:
...
void click(struct s3d_evt *evt)
{
        s3dw_handle_click(evt);
        ....
        // your own clickhandler code
        ...
}
....
s3d_set_callback(S3D_EVENT_OBJ_CLICK,click);
ok important note bestie: if you go with way 2 you still have to call s3dw_handle_click(evt) in there. the function isn't doing magic on its own, it needs the invite to the party. don't skip it and then wonder why your widgets are dead πŸ’€

and the return type? it's an int. that's the synopsis talking, not me. ✨


✨ AUTHOR ✨

Simon Wunderlich β€” Author of s3d πŸ‘‘ the literal legend who built this whole thing.


that's the page, babes πŸ’œ this little slice of the s3d manual lives under S3DW_HANDLE_CLICK(3) β€” go forth and make your widgets clickable, you absolute icon πŸ¦‹πŸŒΈ