/ld27

To get this branch, use:
bzr branch /bzr/ld27

« back to all changes in this revision

Viewing changes to win_view.lua

  • Committer: Josh C
  • Date: 2013-08-25 16:32:40 UTC
  • Revision ID: josh@9ix.org-20130825163240-ga1iviz5lgizi8bu
oops, actually check in win view

Show diffs side-by-side

added added

removed removed

 
1
WinView = Subview:extend {
 
2
   onNew = function (self)
 
3
              local boxW = 300
 
4
              local boxH = 190
 
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 = {240,221,58},
 
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 = {166,44,217},
 
20
                          x = boxL,
 
21
                          y = boxT,
 
22
                          width = boxW,
 
23
                          height = boxH,
 
24
                       })
 
25
 
 
26
              self:add(Text:new{
 
27
                          text = 'You Win!',
 
28
                          x = boxL,
 
29
                          y = boxT + 16,
 
30
                          width = boxW,
 
31
                          font = 48,
 
32
                          align = 'center',
 
33
                          tint = {0,0,0}
 
34
                       })
 
35
 
 
36
              self:add(Text:new{
 
37
                          text = 'Press Q to quit',
 
38
                          x = boxL,
 
39
                          y = boxT + 90,
 
40
                          width = boxW,
 
41
                          font = 20,
 
42
                          align = 'center',
 
43
                          tint = {0,0,0}
 
44
                       })
 
45
 
 
46
              self:add(Text:new{
 
47
                          text = 'Any other key to keep exploring',
 
48
                          x = boxL,
 
49
                          y = boxT + 120,
 
50
                          width = boxW,
 
51
                          font = 20,
 
52
                          align = 'center',
 
53
                          tint = {0,0,0}
 
54
                       })
 
55
 
 
56
 
 
57
           end,
 
58
   onUpdate = function (self)
 
59
                 if the.keys:justPressed('q') then
 
60
                    if the.profiler then
 
61
                       the.profiler:stop()
 
62
                       local outfile = io.open( "profile.txt", "w+" )
 
63
                       the.profiler:report( outfile )
 
64
                       outfile:close()
 
65
                    end
 
66
 
 
67
                    the.app:quit()
 
68
                 elseif the.keys:allJustPressed() then
 
69
                    self:deactivate()
 
70
                 end
 
71
              end
 
72
}
 
 
'\\ No newline at end of file'