From 0471f7702a68c55d163fd8f7017bddc2edf0c8e3 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Mon, 11 Sep 2023 20:06:09 +0200 Subject: [PATCH] Stuff --- src/wells.nim | 15 +++------------ well_of_text.nimble | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/wells.nim b/src/wells.nim index 708f4d4..63f7cb4 100644 --- a/src/wells.nim +++ b/src/wells.nim @@ -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 diff --git a/well_of_text.nimble b/well_of_text.nimble index 14f96a6..a5c8db4 100644 --- a/well_of_text.nimble +++ b/well_of_text.nimble @@ -2,4 +2,4 @@ bin = @["well_of_text"] license = "Unlicense" requires: "nim", "syndicate", "sdl2" srcDir = "src" -version = "20230908" +version = "20230911"