Skip to content

Commit 5953bbf

Browse files
committed
Merge branch 'release/1.2.1'
2 parents ad44b93 + 44b8b22 commit 5953bbf

File tree

1 file changed

+24
-31
lines changed

1 file changed

+24
-31
lines changed

ScreenManager.lua

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,35 @@
2020
-- --
2121
--===============================================================================--
2222

23-
local ScreenManager = {};
23+
local ScreenManager = {
24+
_VERSION = '1.2.1',
25+
_DESCRIPTION = 'Screen/State Management for the LÖVE framework',
26+
_URL = 'https://bitbucket.org/rmcode/screenmanager/',
27+
};
2428

2529
-- ------------------------------------------------
2630
-- Local Variables
2731
-- ------------------------------------------------
2832

29-
local stack = {};
30-
local screens = {};
33+
local stack;
34+
local screens;
3135

3236
-- ------------------------------------------------
33-
-- Module Functions
37+
-- Private Functions
38+
-- ------------------------------------------------
39+
40+
---
41+
-- Close and remove all screens from the stack.
42+
--
43+
local function clear()
44+
for i = 1, #stack do
45+
stack[i]:close();
46+
stack[i] = nil;
47+
end
48+
end
49+
50+
-- ------------------------------------------------
51+
-- Public Functions
3452
-- ------------------------------------------------
3553

3654
---
@@ -41,7 +59,7 @@ local screens = {};
4159
--
4260
function ScreenManager.init(nscreens, screen)
4361
stack = {};
44-
ScreenManager.setScreens(nscreens);
62+
screens = nscreens;
4563
ScreenManager.push(screen);
4664
end
4765

@@ -52,7 +70,7 @@ end
5270
-- @param nscreen
5371
--
5472
function ScreenManager.switch(screen)
55-
ScreenManager.clear();
73+
clear();
5674
ScreenManager.push(screen);
5775
end
5876

@@ -113,16 +131,6 @@ function ScreenManager.pop()
113131
end
114132
end
115133

116-
---
117-
-- Close and remove all screens from the stack.
118-
--
119-
function ScreenManager.clear()
120-
for i = 1, #stack do
121-
stack[i]:close();
122-
stack[i] = nil;
123-
end
124-
end
125-
126134
---
127135
-- Draw all screens on the stack. Screens that are higher on the stack
128136
-- will overlay screens that are on the bottom.
@@ -220,8 +228,6 @@ end
220228

221229
---
222230
-- Reroute the mousefocus callback to the currently active screen.
223-
-- @param x
224-
-- @param y
225231
-- @param button
226232
--
227233
function ScreenManager.mousefocus(focus)
@@ -236,19 +242,6 @@ function ScreenManager.quit(dquit)
236242
ScreenManager.peek():quit(dquit);
237243
end
238244

239-
-- ------------------------------------------------
240-
-- Setters
241-
-- ------------------------------------------------
242-
243-
---
244-
-- Set a new table of screens from which to pick a new screen when
245-
-- pushing / switching.
246-
-- @param nscreens
247-
--
248-
function ScreenManager.setScreens(nscreens)
249-
screens = nscreens;
250-
end
251-
252245
-- ------------------------------------------------
253246
-- Return Module
254247
-- ------------------------------------------------

0 commit comments

Comments
 (0)