Grid(3U)

✨ Grid(3U) ✨

okay so bestie, welcome to the InterViews Reference Manual πŸŽ€ this is the Grid page and honestly? she's lowkey doing the most and we love her for it πŸ’…


🌸 NAME 🌸

Grid β€” displays a grid in a viewer and constrains points to lie on it


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <Unidraw/grid.h>

✨ DESCRIPTION ✨

so the Grid object is out here doing two whole jobs at once, main character energy fr fr:

  • it displays a grid in a viewer πŸ‘‘
  • and it can constrain points to lie on the grid 🎯

the base class draws the grid as a simple array of dots ✨ but subclasses are absolutely free to draw arbitrarily complex grids β€” go off, customize your little heart out πŸ’–


πŸ’… PUBLIC OPERATIONS πŸ’…

  • Grid(float w, float h, float xincr, float yincr) β€” the constructor parameters are, in order: a width, a height, and independent units of graduation for the horizontal and vertical axes, and literally all of them are in pixels. the Grid base class uses a special-purpose graphic to render itself, one that draws an array of dots based on the info you hand over in this constructor 🫢
  • virtual Graphic* GetGraphic() β€” returns the graphic that's used to render the grid πŸ–ΌοΈ
  • virtual void Constrain(Coord&, Coord&) β€” constrains the given coordinate pair to fall on the grid. by default, the pair gets changed to fall on the nearest grid point πŸ“
  • virtual void Visiblity(boolean) β€” makes the grid visible (pass true) or invisible (pass false) πŸ™ˆ (yes, that's really how it's spelled, we don't make the rules πŸ’€)
  • virtual boolean IsVisible() β€” returns whether the grid is visible or not πŸ‘€
  • virtual void SetSpacing(float xincr, float yincr) β€” resets the grid's units of graduation πŸ“

🧚 PROTECTED OPERATIONS 🧚

  • Grid(Graphic*) β€” this protected constructor lets subclasses specify an arbitrary graphic for rendering the grid 🌈
⚠️ heads up bestie: subclasses that use this constructor must also redefine the Constrain operation. no skipping, periodt πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘

Graphic(3U), Viewer(3U)


and that's the whole vibe ✨ this page came straight out of the Unidraw corner of the world, dated 30 July 1990, and it's literally titled Grid(3U) β€” iconic, no cap πŸ’–πŸ¦‹πŸŽ€