summaryrefslogtreecommitdiff
path: root/grid.go
blob: 0adedffdae20af3ad08abb325d3316f144b8ce8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package widget

// This is how grids are handled. On the application side,
// things are mostly handled this way. Web browsers, etc
//
// On the toolkit side, this must be translated into the display
// code. This is particularly complicated with ncurses but once
// done in the toolkits, bears fruit in the application code simplicity

// NOTE: X numbers horizontally, Y is numbered down. Like in mathematics, EXCEPT Y IS DOWN
// this is the only sensible way. It's way too confusing to use negative numbers for Y.
// This is an attempt to make it simple for people to program against this code,
// then we hide these implementation details in the toolkit plugins

// Grid numbering examples (H) or (W,H)
// -----------------------
// -- (1) -- (2) -- (3) -- (X)
// -----------------------
//
//    (Y)
// ---------
// -- (1) --
// -- (2) --
// ---------
//
//    (X,Y)
// --------------------------------------
// -- (1,1) -- (2,1) -- (3,1) -- (4,1) --
// -- (1,2) -- (2,2) -- (3,2) --       --
// -- (1,3) --       -- (3,3) -- (4,3) --
// --------------------------------------

type GridSize struct {
	Width int
	Height int
}

type GridOffset struct {
	X int
	Y int
}