Merge driver.love
This commit is contained in:
commit
2c62076108
|
@ -1 +1,2 @@
|
||||||
Viewport = {}
|
-- Viewport width,height should match screen/window width,height at all times.
|
||||||
|
Viewport = {}
|
||||||
|
|
3
edit.lua
3
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:
|
-- 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
|
-- 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 codepoint indices if it wraps over more than one screen line
|
||||||
-- screen_line_starting_pos: optional array of grapheme indices if it wraps over more than one screen line
|
|
||||||
line_cache = {},
|
line_cache = {},
|
||||||
|
|
||||||
-- Given wrapping, any potential location for the text cursor can be described in two ways:
|
-- Given wrapping, any potential location for the text cursor can be described in two ways:
|
||||||
|
|
14
reference.md
14
reference.md
|
@ -48,7 +48,7 @@ two categories.
|
||||||
* `on.resize(w,h)` -- called when you resize the app window. Provides new
|
* `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`
|
window dimensions in `w` and `h`. Don't bother updating `App.screen.width`
|
||||||
and `App.screen.height`, that will happen automatically before calling
|
and `App.screen.height`, that will happen automatically before calling
|
||||||
`App.resize`.
|
`on.resize`.
|
||||||
(Based on [LÖVE](https://love2d.org/wiki/love.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
|
* `on.file_drop(file)` -- called when a file icon is dragged and dropped on
|
||||||
|
@ -114,7 +114,7 @@ two categories.
|
||||||
|
|
||||||
* `on.text_input(t)` -- called when you press a key combination that yields
|
* `on.text_input(t)` -- called when you press a key combination that yields
|
||||||
(roughly) a printable character. For example, `shift` and `a` pressed
|
(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).)
|
(Based on [LÖVE](https://love2d.org/wiki/love.textinput).)
|
||||||
|
|
||||||
* `on.key_release(key)` -- called when you press a key on the keyboard.
|
* `on.key_release(key)` -- called when you press a key on the keyboard.
|
||||||
|
@ -292,9 +292,9 @@ clicked. It requires setting up 3 things:
|
||||||
- a `state` table housing all buttons. Can be the same `state` variable the
|
- a `state` table housing all buttons. Can be the same `state` variable the
|
||||||
text-editor widget uses, but doesn't have to be.
|
text-editor widget uses, but doesn't have to be.
|
||||||
- specifying buttons to create in `state`. This must happen either directly
|
- 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
|
- 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:
|
The following facilities help set these things up:
|
||||||
|
|
||||||
|
@ -315,7 +315,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)
|
rectangle with the given dimensions and trigger the provided (zero-arg)
|
||||||
`onpress1` callback when the primary mouse button is clicked within.
|
`onpress1` callback when the primary mouse button is clicked within.
|
||||||
It will also optionally paint the rectangle with the specified background
|
It will also optionally paint the rectangle with the specified background
|
||||||
|
@ -327,7 +327,7 @@ The following facilities help set these things up:
|
||||||
|
|
||||||
* `mouse_press_consumed_by_any_button(state, x,y, mouse_button)`
|
* `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
|
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
|
ensure clicks on a button don't have other effects, so I prefer the
|
||||||
following boilerplate early in `mousepressed`:
|
following boilerplate early in `mousepressed`:
|
||||||
|
@ -345,7 +345,7 @@ The following facilities help set these things up:
|
||||||
(Based on [LÖVE](https://love2d.org/wiki/love.mouse.setPosition).)
|
(Based on [LÖVE](https://love2d.org/wiki/love.mouse.setPosition).)
|
||||||
|
|
||||||
* `App.mouse_down(mouse_button)` -- returns `true` if the button
|
* `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).)
|
(Based on [LÖVE](https://love2d.org/wiki/love.mouse.isDown).)
|
||||||
|
|
||||||
* `App.mouse_x()` -- returns the x coordinate of the current position of the
|
* `App.mouse_x()` -- returns the x coordinate of the current position of the
|
||||||
|
|
Loading…
Reference in New Issue