/traderous

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

« back to all changes in this revision

Viewing changes to trade_view.lua

  • Committer: Josh C
  • Date: 2013-06-15 19:58:24 UTC
  • Revision ID: josh@9ix.org-20130615195824-62r7gwrujgyijmh9
prices, buttons

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
                    height = th
71
71
                 }
72
72
                 self:add(b)
 
73
 
73
74
              end
74
 
 
75
 
              local b = Button:new{
76
 
                 x = boxL, y = boxT,
77
 
                 label = Text:new{ text = 'Close', x = 3, y = 2 },
78
 
                 onMouseDown = function()
79
 
                                  self:close()
80
 
                               end
81
 
              }
82
 
 
83
 
              local tw, th = b.label:getSize()
84
 
              b.background = Fill:new{
85
 
                 fill = {100,100,100},
86
 
                 width = tw + 7,
87
 
                 height = th + 4
88
 
              }
89
 
              b.x = boxR - b.background.width - 10
90
 
              b.y = boxT + 400 - b.background.height - 10
91
 
 
92
 
              self:add(b)
93
 
 
94
 
              self.playerMoney = Text:new{
95
 
                 text = 'Your money: ',
96
 
                 width = 200,
97
 
                 x = boxL + 10,
98
 
                 y = boxT + 400 - th - 10
99
 
              }
100
 
              self:add(self.playerMoney)
101
 
 
102
 
              -- give the buttons a cycle to get out of the T/L corner
103
 
              self:update(0)
104
75
           end,
105
76
   activate = function (self)
106
77
                 the.cursor.visible = false
109
80
 
110
81
                 Subview.activate(self)
111
82
              end,
112
 
   close = function (self)
113
 
              the.cursor.visible = true
114
 
              love.mouse.setVisible(false)
115
 
              love.mouse.setGrab(true)
116
 
 
117
 
              self:deactivate()
118
 
           end,
119
 
   onUpdate = function (self)
120
 
                 if the.keys:justPressed('escape') then
121
 
                    self:close()
122
 
                 end
123
 
 
124
 
                 self.playerMoney.text = 'Your money: ' .. the.player.money
125
 
              end
 
83
 
126
84
}
 
 
b'\\ No newline at end of file'