diff --git a/0008-Viewport b/0008-Viewport index 0dc66df..e1f6041 100644 --- a/0008-Viewport +++ b/0008-Viewport @@ -1 +1,2 @@ +-- Viewport width,height should match screen/window width,height at all times. Viewport = {x=-50, y=-50, w=800,h=600, zoom=1.0} \ No newline at end of file diff --git a/edit.lua b/edit.lua index 077ca70..4f71e59 100644 --- a/edit.lua +++ b/edit.lua @@ -24,8 +24,7 @@ function edit.initialize_state(top, left, right, font, font_height, line_height) -- rendering wrapped text lines needs some additional short-lived data per line: -- startpos, the index of data the line starts rendering from, can only be >1 for topmost line on screen - -- fragments: snippets of the line guaranteed to not straddle screen lines - -- screen_line_starting_pos: optional array of grapheme indices if it wraps over more than one screen line + -- screen_line_starting_pos: optional array of codepoint indices if it wraps over more than one screen line line_cache = {}, -- Given wrapping, any potential location for the text cursor can be described in two ways: diff --git a/reference.md b/reference.md index a7cfd85..90171d8 100644 --- a/reference.md +++ b/reference.md @@ -51,7 +51,7 @@ two categories. * `on.resize(w,h)` -- called when you resize the app window. Provides new window dimensions in `w` and `h`. Don't bother updating `App.screen.width` and `App.screen.height`, that will happen automatically before calling - `App.resize`. + `on.resize`. (Based on [LÖVE](https://love2d.org/wiki/love.resize)) * `on.file_drop(file)` -- called when a file icon is dragged and dropped on @@ -117,7 +117,7 @@ two categories. * `on.text_input(t)` -- called when you press a key combination that yields (roughly) a printable character. For example, `shift` and `a` pressed - together will call `App.textinput` with `A`. + together will call `on.textinput` with `A`. (Based on [LÖVE](https://love2d.org/wiki/love.textinput).) * `on.key_release(key)` -- called when you press a key on the keyboard. @@ -289,9 +289,9 @@ clicked. It requires setting up 3 things: - a `state` table housing all buttons. Can be the same `state` variable the text-editor widget uses, but doesn't have to be. - specifying buttons to create in `state`. This must happen either directly - or indirectly within `App.draw`. + or indirectly within `on.draw`. - responding to clicks on buttons in `state`. This must happen either - directly or indirectly within `App.mousepressed`. + directly or indirectly within `on.mouse_press`. The following facilities help set these things up: @@ -312,7 +312,7 @@ The following facilities help set these things up: }) ``` - Call this either directly or indirectly from `App.draw`. It will assign a + Call this either directly or indirectly from `on.draw`. It will assign a rectangle with the given dimensions and trigger the provided (zero-arg) `onpress1` callback when the primary mouse button is clicked within. It will also optionally paint the rectangle with the specified background @@ -324,7 +324,7 @@ The following facilities help set these things up: * `mouse_press_consumed_by_any_button(state, x,y, mouse_button)` - Call this either directly or indirectly from `App.mousepressed`. It will + Call this either directly or indirectly from `on.mouse_press`. It will pass on a click to any button registered in `state`. It's also helpful to ensure clicks on a button don't have other effects, so I prefer the following boilerplate early in `mousepressed`: @@ -342,7 +342,7 @@ The following facilities help set these things up: (Based on [LÖVE](https://love2d.org/wiki/love.mouse.setPosition).) * `App.mouse_down(mouse_button)` -- returns `true` if the button - `mouse_button` is pressed. See `App.mousepressed` for `mouse_button` codes. + `mouse_button` is pressed. See `on.mouse_press` for `mouse_button` codes. (Based on [LÖVE](https://love2d.org/wiki/love.mouse.isDown).) * `App.mouse_x()` -- returns the x coordinate of the current position of the