d_edit_proc(3alleg4)

πŸ’– d_edit_proc β€” Allegro manual, bestie edition πŸ’–

okay so this page lives in the Allegro manual (yes, that Allegro, the game programming library, she's iconic) and she's here to explain d_edit_proc.


✨ NAME ✨

d_edit_proc β€” it's a dialog procedure that implements an editable text object. Allegro game programming library. that's the whole vibe. πŸŽ€


🌸 SYNOPSIS 🌸

#include <allegro.h>

int d_edit_proc(int msg, DIALOG *d, int c);

like, that's the whole signature, no notes. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so bestie, picture this: it's an editable text object. the dp field is the one pointing at the string, okay? when this thing has the input focus β€” which you get by clicking on it with the mouse πŸ–±οΈ β€” you can literally just type text into it. main character behaviour tbh.

and the fields? here's the tea:

  • the d1 field says the maximum number of characters it will accept. she has boundaries, respect them. πŸ’…
  • the d2 field is the text cursor position within the string. that's where the little blinking moment happens.
⚠️ note, and this one matters, no cap: dp must point to a buffer that's at least (d1 + 1) * 4 bytes long. why? because depending on the encoding format in use, a single character can take up up to 4 bytes 😭 and you still gotta reserve room for the terminating null character. do not skip the null, she is required, periodt.

πŸ‘‘ SEE ALSO πŸ‘‘

go read them, iykyk. πŸ“šβœ¨


k byeeee, this was the Allegro manual, version 4.4.3 πŸ’– stay editable, stay slay πŸ’…πŸŽ€πŸ¦‹