diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..4c19bd0 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,16 @@ +files['.luacheckrc'].global = false +std = 'max+busted' + +globals = { + 'love', + 'getVersion', + 'getTitle' +} + +exclude_files = { + './lua_install/*' +} + +ignore = { + '/self' +} diff --git a/LICENSE.md b/LICENSE.md index de2628f..ff4e52c 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2014 - 2016 Robert Machmer +Copyright (c) 2014 - 2017 Robert Machmer This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/README.md b/README.md index 2fa0f10..ce533b0 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,27 @@ #ScreenManager +[![Version](https://img.shields.io/badge/Version-1.8.0-blue.svg)](https://github.com/rm-code/screenmanager/releases/latest) +[![LOVE](https://img.shields.io/badge/L%C3%96VE-0.10.0-EA316E.svg)](http://love2d.org/) +[![License](http://img.shields.io/badge/Licence-zlib-brightgreen.svg)](LICENSE.md) + 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](https://github.com/rm-code/screenmanager/tree/example) 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). ```lua -- main.lua -local ScreenManager = require('lib/ScreenManager'); +local ScreenManager = require('lib.ScreenManager'); function love.load() local screens = { - main = require('src/screens/MainScreen'); + main = require('src.screens.MainScreen'); }; ScreenManager.init(screens, 'main'); @@ -34,7 +40,7 @@ Note how MainScreen inherits from Screen.lua. This isn't mandatory, but recommen ```lua -- MainScreen.lua -local Screen = require('lib/Screen'); +local Screen = require('lib.Screen'); local MainScreen = {}; diff --git a/Screen.lua b/Screen.lua index 5737a74..07b3226 100644 --- a/Screen.lua +++ b/Screen.lua @@ -1,6 +1,6 @@ --===============================================================================-- -- -- --- Copyright (c) 2014 - 2016 Robert Machmer -- +-- Copyright (c) 2014 - 2017 Robert Machmer -- -- -- -- This software is provided 'as-is', without any express or implied -- -- warranty. In no event will the authors be held liable for any damages -- diff --git a/ScreenManager.lua b/ScreenManager.lua index baf342e..e9a4308 100644 --- a/ScreenManager.lua +++ b/ScreenManager.lua @@ -1,6 +1,6 @@ --===============================================================================-- -- -- --- Copyright (c) 2014 - 2016 Robert Machmer -- +-- Copyright (c) 2014 - 2017 Robert Machmer -- -- -- -- This software is provided 'as-is', without any express or implied -- -- warranty. In no event will the authors be held liable for any damages -- @@ -21,7 +21,7 @@ --===============================================================================-- local ScreenManager = { - _VERSION = '1.8.0', + _VERSION = '1.8.1', _DESCRIPTION = 'Screen/State Management for the LÖVE framework', _URL = 'https://github.com/rm-code/screenmanager/', }; @@ -193,7 +193,7 @@ end -- delay between key repeats depends on the -- user's system settings. -- -function ScreenManager.keypressed( key, scancode, isrepeat ) +function ScreenManager.keypressed( key, scancode, isrepeat ) ScreenManager.peek():keypressed( key, scancode, isrepeat ); end