/ld27

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

« back to all changes in this revision

Viewing changes to win_view.lua

  • Committer: Josh C
  • Date: 2013-08-24 21:15:46 UTC
  • Revision ID: josh@9ix.org-20130824211546-713om9pp99jgd6of
more map

Show diffs side-by-side

added added

removed removed

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