Stuff
This commit is contained in:
parent
9cc7ebab3c
commit
0471f7702a
|
@ -16,6 +16,7 @@ type
|
|||
Well* = ref object
|
||||
panes: Deque[Pane]
|
||||
width, height: int
|
||||
textWidth, textHeight: int
|
||||
|
||||
using
|
||||
pane: Pane
|
||||
|
@ -27,7 +28,7 @@ proc newWell*(width, height: int): Well =
|
|||
|
||||
proc dimensions(well): Vec2 = vec2(float well.width, float well.height)
|
||||
|
||||
proc margins*(well): (int, int) = (well.width div 9, well.height div 9)
|
||||
proc margins*(well): tuple[w: int, h: int] = (well.width div 9, well.height div 9)
|
||||
|
||||
proc rect*(well): Rect =
|
||||
result.wh = well.dimensions
|
||||
|
@ -52,7 +53,7 @@ proc rectAt(well; i: int): Rect =
|
|||
result.y = fullWh.y - result.h
|
||||
else: discard
|
||||
|
||||
proc place*(well; offset, width, height: int): (Pane, Rect) =
|
||||
proc place(well; offset, width, height: int): (Pane, Rect) =
|
||||
## Return the `Pane` at `offset` from the top of `well` or `nil` if
|
||||
## the offset is too deep. The position and size of the `Pane` is
|
||||
## returned as well.
|
||||
|
@ -82,16 +83,6 @@ proc append*(well; stream: Stream; font: Font) =
|
|||
while readLine(stream, line):
|
||||
append(well, line, font)
|
||||
|
||||
#[
|
||||
proc render*(well; index: Natural; scale: float): Image =
|
||||
if index < well.panes.len:
|
||||
let dimensions = well.dimensions * scale
|
||||
if dimensions.x > 8 and dimensions.y > 8:
|
||||
result = newImage(int dimensions.x, int dimensions.y)
|
||||
fill(result, rgba(255, 255, 255, 255))
|
||||
fillText(well.panes[index].arrangment, translate(well.margins))
|
||||
]#
|
||||
|
||||
type Intersection = tuple
|
||||
src, dst: Rect
|
||||
index: int
|
||||
|
|
|
@ -2,4 +2,4 @@ bin = @["well_of_text"]
|
|||
license = "Unlicense"
|
||||
requires: "nim", "syndicate", "sdl2"
|
||||
srcDir = "src"
|
||||
version = "20230908"
|
||||
version = "20230911"
|
||||
|
|
Loading…
Reference in New Issue