All Projects → osch → lua-lpugl

osch / lua-lpugl

Licence: other
A minimal Lua-API for building GUIs using Cairo or OpenGL (see: https://github.com/osch/lua-lpugl#lpugl)

Programming Languages

c
50402 projects - #5 most used programming language
objective c
16641 projects - #2 most used programming language
lua
6591 projects

Projects that are alternatives of or similar to lua-lpugl

vger
2D GPU renderer for dynamic UIs
Stars: ✭ 122 (+542.11%)
Mutual labels:  nanovg
blynk-library-lua
Blynk library for Lua. Works with Lua 5.1+, LuaJIT, NodeMCU.
Stars: ✭ 35 (+84.21%)
Mutual labels:  lua-library
war1
A remake of Warcraft: Orcs & Humans written in C
Stars: ✭ 107 (+463.16%)
Mutual labels:  nanovg
batteries
Reusable dependencies for games made with lua (especially with love)
Stars: ✭ 194 (+921.05%)
Mutual labels:  lua-library
QGame
用于快速开发的跨平台高性能Lua游戏库(A Cross-platform high performance Lua game library for rapid development)
Stars: ✭ 17 (-10.53%)
Mutual labels:  lua-library
ElementaryLua
Lua + GTK + Granite + Flatpak
Stars: ✭ 19 (+0%)
Mutual labels:  lua-gui
strong
A Lua library that makes your strings stronger!
Stars: ✭ 62 (+226.32%)
Mutual labels:  lua-library
LuaCSP
Communicating Sequential Processes in Lua
Stars: ✭ 40 (+110.53%)
Mutual labels:  lua-library
koi
Immediate mode UI for Nim
Stars: ✭ 27 (+42.11%)
Mutual labels:  nanovg
u-test
Sane and simple unit testing framework for Lua
Stars: ✭ 60 (+215.79%)
Mutual labels:  lua-library
PICO-EC
A tiny scene-entity-component library created for the PICO-8 fantasty console.
Stars: ✭ 37 (+94.74%)
Mutual labels:  lua-library
nanovg vulkan
Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations. (added Vulkan support)
Stars: ✭ 26 (+36.84%)
Mutual labels:  nanovg
Sol2
Sol3 (sol2 v3.0) - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:
Stars: ✭ 2,791 (+14589.47%)
Mutual labels:  lua-binding
TypeScriptXX
🧷 Stay safe! Type-safe scripting for C++ using TypeScriptToLua and CMake with auto-generated declarations.
Stars: ✭ 33 (+73.68%)
Mutual labels:  lua-binding

lpugl

Licence Install

LPugl is a minimal Lua-API for building GUIs. It is based on Pugl (PlUgin Graphics Library), a minimal portable API for embeddable GUIs.

LPugl provides only a very minimal API. See lwtk (Lua Widget Toolkit) for implementing GUI widgets on top of LPugl.

Like Pugl, LPugl does only have explicit context and no static data, so it's possible to have several instances within the same program and even within the same Lua main state. Therefore LPugl is especially suited for building GUIs for plugins or components within larger applications. For example see LDPF-Examples: here LPugl is used for the GUI of audio processing plugins with DPF (DISTRHO Plugin Framework).

Supported platforms:

  • X11
  • Windows
  • Mac OS X

Supported rendering backends:

Thanks to the modular architecture of Pugl, more rendering backends could be possible in the future. Different rendering backends can be combined in one application and also in the same window by embedding different view objects.

LuaRocks modules:

Further reading:

First Example

  • Simple example for using the Cairo backend:

    local lpugl = require"lpugl_cairo"
    
    local world = lpugl.newWorld("Hello World App")
    local scale = world:getScreenScale()
    
    local view = world:newView 
    {
        title     = "Hello World Window",
        size      = {300*scale, 100*scale},
        resizable = true,
        
        eventFunc = function(view, event, ...)
            print(event, ...)
            if event == "EXPOSE" then
                local cairo = view:getDrawContext()
                local w, h  = view:getSize()
                cairo:set_source_rgb(0.9, 0.9, 0.9)
                cairo:rectangle(0, 0, w, h)
                cairo:fill()
                cairo:set_source_rgb(0, 0, 0)
                cairo:select_font_face("sans-serif", "normal", "normal")
                cairo:set_font_size(24*scale)
                local text = "Hello World!"
                local ext = cairo:text_extents(text)
                cairo:move_to((w - ext.width)/2, (h - ext.height)/2 + ext.height)
                cairo:show_text(text)
            elseif event == "CLOSE" then
                view:close()
            end
        end
    }
    view:show()
    
    while world:hasViews() do
        world:update()
    end
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].