• v0.0.2-u 0e2fb647d4

    v0.0.2-unstable Pre-release

    flipfloppy1 released this 2024-07-13 21:23:40 +09:30 | 13 commits to master since this release

    v0.0.2-unstable

    New Features

    New Lua Globals:

    VUI_mouse: a table for all mouse-related info, including:

    • VUI_mouse.onPress: true if the mouse has just been pressed.
    • VUI_mouse.onRelease: true if the mouse has just been released.
    • VUI_mouse.down: true if the mouse button is currently down.
    • VUI_mouse.x, VUI_mouse.y: the normalised mouse coordinates relative to the upper left corner.

    VUI_signal: set flags through Lua that can be toggled to call conditional code in your C++ program. Set a field of VUI_signal to true to turn on the signal of that name; e.g:

    VUI_signal.quit = true.
    

    Triggers:

    if (uiHandler.HasSignalled("quit"))
      // VUI_signal.quit is true
    else
      // false or nil
    

    For more information on use, see the examples provided in the lua scripts of this build.

    UI Text and Font Properties:

    Font rendering now works, which means that the text field now specifies a string of UTF8-encoded (possibly subject to change) characters that will be drawn to the screen. Other font and text-related properties include:

    • uiElement.textPos: The position of the top-left corner of the element's text, in normalised coordinates starting from the top-left of the viewport.
    • uiElement.font: The filepath to the font file, relative to the current working directory. See freetype's supported font types for the list of compatible font formats, excluding fixed-size font formats.
    • uiElement.fontColor: An RGBA value that determines the font color of the text. Doesn't actually do anything yet, but it's there.
    • uiElement.textSize: Also currently does nothing, but it is there.

    Note: text is always drawn one layer higher than its element's main vertices.

    image
    Try out the simple demo below, and mess around with the Lua script behind it!

    Downloads
  • v0.0.1-u 045dc0bcad

    v0.0.1-unstable Pre-release

    flipfloppy1 released this 2024-07-09 04:27:21 +09:30 | 17 commits to master since this release

    0.0.1 Unstable

    Features

    Lua Script Global Variables:

    • VUI_dt: The time between the last frame and the current one (deltatime).
    • VUI_winX: The length of the viewport, in pixels.
    • VUI_winY: The height of the viewport, in pixels.
    • VUI_nextScript: The Lua script to be run on the next frame.

    Specifying UI Elements in Lua:

    • The base class for UI Elements is ui.buttons.

    The objects under "ui" are soon to be categories, but for now "buttons" is the only one. This will be changing soon; note that the category doesn't change the behaviour of UI elements.

    • Specify a new element using ui.buttons.x where "x" is the name of the element you want to create. Take a look at the provided scripts in the win-demo to see how elements can be created and modified.

    Element Properties:

    • position: the top-left corner of the box that forms the element, in normalised screen coordinates; (0,0) is the top-left corner, whereas (1,1) is the bottom-right. fields: x, y.
    • dimensions: the bottom-right corner of the box that forms the element, in normalised screen coordinates; (0,0) is the top-left corner, whereas (1,1) is the bottom-right. fields: x,y.
    • texture: a string that contains a path to an image file to be used for the element, relative to the current working directory.
    • layer: an integer representing the z-index, or order of the element. For elements that overlap, elements with a higher layer are drawn on top of elements with a lower one.
    • color: a field representing the rgba values that an element is drawn with. If a texture is set, the color is multiplied by the texture color. fields: r,g,b,a.
    Downloads