From e4752fef35d08d9a4494e6cfb39a24c0b7925e75 Mon Sep 17 00:00:00 2001 From: Kevin Harrison Date: Fri, 16 Dec 2016 22:43:12 -0500 Subject: [PATCH] v1.2 --- Documentation.md | 85 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 9 deletions(-) diff --git a/Documentation.md b/Documentation.md index b7107fd..3b09655 100644 --- a/Documentation.md +++ b/Documentation.md @@ -442,9 +442,9 @@ Start a combobox widget. This form gives complete control over the drop-down lis Remember to call `nk.comboboxEnd` if the combobox is open. -#### activated = nk.comboboxItem(text, [symbol](#symbols)/image, [align](#alignment)) -#### activated = nk.comboboxItem(text, [symbol](#symbols)/image) #### activated = nk.comboboxItem(text) +#### activated = nk.comboboxItem(text, [symbol](#symbols)/image) +#### activated = nk.comboboxItem(text, [symbol](#symbols)/image, [align](#alignment)) Add a combobox item, optionally specifying a [symbol](#symbols), image, and/or [alignment](#alignment). Return `true` if the item is activated, and `false` otherwise. @@ -475,14 +475,21 @@ Return the height of the current widget. #### hovered = nk.widgetIsHovered() Return `true` if the widget is hovered by the mouse, and `false` otherwise. -#### clicked = nk.widgetIsMouseClicked() -#### clicked = nk.widgetIsMouseClicked(button) -Return `true` if the widget was just clicked by the given mouse button ('left'/'right'/'middle', defaults to 'left'), and `false` otherwise. +#### pressed = nk.widgetHasMousePressed() +#### pressed = nk.widgetHasMousePressed(button) +Return `true` if the given mouse button was pressed on the current widget and has not yet been released, and `false` otherwise. `button` is one of 'left'/'right'/'middle' (defaults to 'left'). -#### hasClick = nk.widgetHasMouseClick() -#### hasClick = nk.widgetHasMouseClick(button) -#### hasClick = nk.widgetHasMouseClick(button, down) -`button` defaults to 'left', and `down` defaults to `true`. If `down` is `true`, return `true` if the mouse was pressed down on the current widget and is still being held down. If `down` is `false`, return `true` if the mouse was released on the current widget and has not since been pressed down. +#### released = nk.widgetHasMouseReleased() +#### released = nk.widgetHasMouseReleased(button) +Return `true` if the given mouse button was released on the current widget and has not since been pressed, and `false` otherwise. `button` is one of 'left'/'right'/'middle' (defaults to 'left'). + +#### pressed = nk.widgetIsMousePressed() +#### pressed = nk.widgetIsMousePressed(button) +Return `true` if the given mouse button was pressed on the current widget this frame, and `false` otherwise. `button` is one of 'left'/'right'/'middle' (defaults to 'left'). + +#### released = nk.widgetIsMouseReleased() +#### released = nk.widgetIsMouseReleased(button) +Return `true` if the given mouse button was released on the current widget this frame, and `false` otherwise. `button` is one of 'left'/'right'/'middle' (defaults to 'left'). #### nk.spacing(cols) Empty space taking up the given number of columns. @@ -517,6 +524,66 @@ Some widgets accept alignment arguments for text, symbols, and/or images. Here i *** +## Drawing + +Use the following functions to draw custom widgets. They use the current LÖVE line thickness and color. + +#### nk.line(x1, y1, x2, y2, ...) +Draw a multi-segment line at the given screen coordinates. + +#### nk.curve(x1, y1, crtl1x, ctrl1y, ctrl2x, ctrl2y, x2, y2) +Draw a Bézier curve with the given start, control, and end points. + +#### nk.polygon('fill'/'line', x1, y1, x2, y2, x3, y3, ...) +Draw a polygon with the given draw mode and screen coordinates. + +#### nk.circle('fill'/'line', x, y, r) +Draw a circle with the given draw mode, center screen coordinates, and radius. + +#### nk.ellipse('fill'/'line', x, y, rx, ry) +Draw an ellipse with the given draw mode, center screen coordinates, and radii. + +#### nk.arc('fill'/'line', x, y, r, startAngle, endAngle) +Draw an arc with the given draw mode, screen coordinates, radius, and angles. + +#### nk.rectMultiColor(x, y, width, height, [topLeftColor](#colors), [topRightColor](#colors), [bottomLeftColor](#colors), [bottomRightColor](#colors)) +Draw a gradient rectangle with the given screen coordinates, size, and corner colors. + +#### nk.scissor(x, y, width, height) +Set the scissor area to the given screen coordinates and size. + +#### nk.image(img, x, y, width, height) +Draw the given image at the given screen bounds. + +See [LÖVE Image](https://love2d.org/wiki/Image). + +#### nk.text(str, x, y, width, height) +Draw the given string at the given screen bounds. + +*** + +## Input + +#### hovered = nk.inputWasHovered(x, y, width, height) +Return `true` if the given screen bounds were hovered by the mouse in the previous frame, and `false` otherwise. + +#### hovered = nk.inputIsHovered(x, y, width, height) +Return `true` if the given screen bounds are hovered by the mouse, and `false` otherwise. + +#### pressed = nk.inputHasMousePressed(button, x, y, width, height) +Return `true` if the given mouse button was pressed in the given screen bounds and has not yet been released, and `false` otherwise. `button` is one of 'left'/'right'/'middle' (defaults to 'left'). + +#### released = nk.inputHasMouseReleased(button, x, y, width, height) +Return `true` if the given mouse button was released in the given screen bounds and has not since been pressed, and `false` otherwise. `button` is one of 'left'/'right'/'middle' (defaults to 'left'). + +#### pressed = nk.inputIsMousePressed(button, x, y, width, height) +Return `true` if the given mouse button was pressed in the given screen bounds this frame, and `false` otherwise. `button` is one of 'left'/'right'/'middle' (defaults to 'left'). + +#### released = nk.inputIsMouseReleased(button, x, y, width, height) +Return `true` if the given mouse button was released in the given screen bounds this frame, and `false` otherwise. `button` is one of 'left'/'right'/'middle' (defaults to 'left'). + +*** + ## Styling ### Colors