Giter VIP home page Giter VIP logo

lua-lpugl's Introduction

lpugl

Licence Install

LPugl is a minimal Lua-API for building GUIs. It is based on Pugl, 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.

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 view = world:newView {
        title     = "Hello World Window",
        resizable = true
    }
    view:setSize(300, 100)
    view:setEventFunc(function(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)
            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:pollEvents()
        world:dispatchEvents()
    end

lua-lpugl's People

Contributors

osch avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.