bzr branch
http://9ix.org/bzr/ld27
20
by Josh C
pause/quit screen |
1 |
PauseView = Subview:extend { |
2 |
onNew = function (self) |
|
3 |
local boxW = 200 |
|
4 |
local boxH = 90 |
|
5 |
local boxL = the.app.width / 2 - boxW / 2 |
|
6 |
local boxT = the.app.height / 2 - boxH / 2 |
|
7 |
local boxR = boxL + boxW |
|
8 |
local boxB = boxT + boxH |
|
9 |
||
10 |
self:add(Fill:new{ |
|
11 |
fill = {0,0,0}, |
|
12 |
x = boxL - 16, |
|
13 |
y = boxT - 16, |
|
14 |
width = boxW + 32, |
|
15 |
height = boxH + 32, |
|
16 |
}) |
|
17 |
||
18 |
self:add(Fill:new{ |
|
19 |
fill = {255,255,255}, |
|
20 |
x = boxL, |
|
21 |
y = boxT, |
|
22 |
width = boxW, |
|
23 |
height = boxH, |
|
24 |
}) |
|
25 |
||
26 |
self:add(Text:new{ |
|
27 |
text = 'Quit?', |
|
28 |
x = boxL, |
|
29 |
y = boxT + 16, |
|
30 |
width = boxW, |
|
31 |
font = 24, |
|
32 |
align = 'center', |
|
33 |
tint = {0,0,0} |
|
34 |
}) |
|
35 |
||
36 |
self:add(Text:new{ |
|
37 |
text = 'Y/N', |
|
38 |
x = boxL, |
|
39 |
y = boxT + 48, |
|
40 |
width = boxW, |
|
41 |
font = 24, |
|
42 |
align = 'center', |
|
43 |
tint = {0,0,0} |
|
44 |
}) |
|
45 |
||
46 |
||
47 |
end, |
|
48 |
onUpdate = function (self) |
|
49 |
if the.keys:justPressed('escape', 'n') then |
|
50 |
self:deactivate() |
|
51 |
elseif the.keys:justPressed('q', 'y') then |
|
52 |
if the.profiler then |
|
53 |
the.profiler:stop() |
|
54 |
local outfile = io.open( "profile.txt", "w+" ) |
|
55 |
the.profiler:report( outfile ) |
|
56 |
outfile:close() |
|
57 |
end |
|
58 |
||
59 |
the.app:quit() |
|
60 |
end |
|
61 |
end |
|
62 |
} |