/ld27

To get this branch, use:
bzr branch http://9ix.org/bzr/ld27

« back to all changes in this revision

Viewing changes to pause_view.lua

  • Committer: Josh C
  • Date: 2014-07-03 15:28:23 UTC
  • Revision ID: josh@9ix.org-20140703152823-4241je58pflhx7ec
scaling

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
              local nr = 'data/NewRocker-Regular.otf'
 
10
 
 
11
              self.scale = the.app.scale
 
12
 
 
13
              self:add(Fill:new{
 
14
                          fill = {240,221,58},
 
15
                          x = boxL - 16,
 
16
                          y = boxT - 16,
 
17
                          width = boxW + 32,
 
18
                          height = boxH + 32,
 
19
                       })
 
20
 
 
21
              self:add(Fill:new{
 
22
                          fill = {166,44,217},
 
23
                          x = boxL,
 
24
                          y = boxT,
 
25
                          width = boxW,
 
26
                          height = boxH,
 
27
                       })
 
28
 
 
29
              self:add(Text:new{
 
30
                          text = 'Quit?',
 
31
                          x = boxL,
 
32
                          y = boxT + 16,
 
33
                          width = boxW,
 
34
                          font = {nr, 24},
 
35
                          align = 'center',
 
36
                          tint = {0,0,0}
 
37
                       })
 
38
 
 
39
              self:add(Text:new{
 
40
                          text = 'Y/N',
 
41
                          x = boxL,
 
42
                          y = boxT + 48,
 
43
                          width = boxW,
 
44
                          font = {nr, 24},
 
45
                          align = 'center',
 
46
                          tint = {0,0,0}
 
47
                       })
 
48
 
 
49
 
 
50
           end,
 
51
   onUpdate = function (self)
 
52
                 if the.keys:justPressed('escape', 'n') then
 
53
                    self:deactivate()
 
54
                 elseif the.keys:justPressed('q', 'y') then
 
55
                    if the.profiler then
 
56
                       the.profiler:stop()
 
57
                       local outfile = io.open( "profile.txt", "w+" )
 
58
                       the.profiler:report( outfile )
 
59
                       outfile:close()
 
60
                    end
 
61
 
 
62
                    the.app:quit()
 
63
                 end
 
64
              end
 
65
}