GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - rm-code/screenmanager at example

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

104 Commits
104 Commits

Folders and files

NameName
Last commit message
Last commit date
.luacheckrc
.luacheckrc
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE.md
LICENSE.md
 
 
MainScreen.lua
MainScreen.lua
 
 
Overlay.lua
Overlay.lua
 
 
README.md
README.md
 
 
Screen.lua
Screen.lua
 
 
ScreenManager.lua
ScreenManager.lua
 
 
config.ld
config.ld
 
 
main.lua
main.lua
 
 

Repository files navigation

ScreenManager

Version LOVE License

The ScreenManager library is a state manager at heart which allows some nifty things, like stacking multiple screens on top of each other.

It also offers hooks for most of LÖVE's callback functions. Based on the type of callback the calls are rerouted to either only the active screen (love.keypressed, love.quit, ...) or to all screens (love.resize, love.visible, ...).

Example

For a more complete example check out the example branch in this repository.

This is a simple example of how the ScreenManager should be used (note: You will have to change the paths in the example to fit your setup).

-- main.lua

local ScreenManager = require('lib.ScreenManager')

function love.load()
    local screens = {
        main = require('src.screens.MainScreen')
    }

    ScreenManager.init(screens, 'main')
end

function love.draw()
    ScreenManager.draw()
end

function love.update(dt)
    ScreenManager.update(dt)
end

Note how MainScreen inherits from Screen.lua. This isn't mandatory, but recommended since Screen.lua already has templates for most of the callback functions.

-- MainScreen.lua

local Screen = require('lib.Screen')

local MainScreen = {}

function MainScreen.new()
    local self = Screen.new()

    local x, y, w, h = 20, 20, 40, 20

    function self:draw()
        love.graphics.rectangle('fill', x, y, w, h)
    end

    function self:update(dt)
        w = w + 2
        h = h + 1
    end

    return self
end

return MainScreen

Documentation

An online documentation is available here.

About

Stackable Screen/State Management for the LÖVE framework.

rm-code.github.io/screenmanager/

Topics

love2dluascreenmanagerstate-management

Resources

Readme
License
Activity

Stars

35 stars

Watchers

2 watching

Forks

7 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.