Perspective(3I)

πŸ’– Perspective(3I) πŸ’–

okay bestie, gather round, we're doing the InterViews Reference Manual today and honestly? this one's a little cutie. it's Perspective(3I), it lives in the 3I section, and it's about figuring out what part of a thing you can actually see. iconic behavior.


✨ NAME ✨

Perspective β€” the visible portion of an interactor 🫢


🌸 SYNOPSIS 🌸

#include <InterViews/perspective.h>

πŸ¦‹ DESCRIPTION πŸ¦‹

so a perspective object describes which part of an interactor's total display area is actually visible inside the interactor's canvas. that's it, that's the whole vibe. and the main use of perspectives? scrolling, panning, and zooming interactors β€” the trio, the moment, the main character energy ✨

let's meet the member variables, because they're doing all the work here:

  • the member variables (x0, y0) define the origin of the interactor's display area πŸ’…
  • width and height define the total height of the area
  • the member variables (curx, cury) define the lower-left corner of the interactor's canvas, relative to the total area πŸŽ€
  • curwidth and curheight define how much of the total area is displayed in the canvas

and then there's the little squad of increments:

  • the member variables sx, sy, lx, and ly specify small and large increments in each dimension 🌈

these increments are what a scroller uses to implement line and page scrolling. no cap, that's literally their whole job.


πŸ‘‘ PUBLIC OPERATIONS πŸ‘‘

πŸ’œ Perspective()

define a new perspective with all member variables initialized to zero. blank slate, fresh start, clean girl aesthetic fr fr.

πŸ’œ void Attach(Interactor*)

add to the list of interactors that are interested in updates to the perspective. these interactors reflect the perspective visually β€” examples include scrollers and sliders πŸ’–

πŸ’œ void Detach(Interactor*)

remove an interactor from the list of those interested in updates. this operation should be called from the interactor's destructor β€” don't skip this one bestie, it's not optional.

πŸ’œ void Init(Coord x0, Coord y0, Coord width, Coord height)

initialize the perspective display area ✨ (yes, the same x0, y0, width, height from up top, they're getting their official setup moment).

πŸ’œ void Update()

notify all the interactors interested in the perspective that it has changed. and listen: the perspective's interactor should call Update after modifying its perspective β€” otherwise everyone's just out here looking at stale info and that's embarrassing 😭


πŸ”₯ SEE ALSO πŸ”₯

Adjuster(3I), Interactor(3I), Panner(3I), Scroller(3I)

go read those too, they're all in the friend group 🫢


and that's the whole page, bestie!! this one came from the InterViews era, dated 15 June 1987 β€” vintage but still slaying πŸ’…βœ¨ love that for us. mwah πŸŽ€