/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-16 00:13:58 UTC
  • Revision ID: josh@9ix.org-20130616001358-dw3n864y37fgw1hs
buy/sell

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
                    x = boxR - 80,
50
50
                    y = boxT + 10 + (i-1) * lh - 1,
51
51
                    label = Text:new{ text = 'BUY', x = 1 },
 
52
                    onMouseDown = function (self)
 
53
                                     the.player:buy(good[1], good[2])
 
54
                                  end
52
55
                 }
53
56
                 local tw, th = b.label:getSize()
54
57
                 b.background = Fill:new{
62
65
                    x = boxR - 40,
63
66
                    y = boxT + 10 + (i-1) * lh - 1,
64
67
                    label = Text:new{ text = 'SELL', x = 1 },
 
68
                    onMouseDown = function (self)
 
69
                                     the.player:sell(good[1], good[2])
 
70
                                  end
65
71
                 }
66
72
                 local tw, th = b.label:getSize()
67
73
                 b.background = Fill:new{
91
97
 
92
98
              self:add(b)
93
99
 
 
100
              self.playerMoney = Text:new{
 
101
                 text = 'Your money: ',
 
102
                 width = 200,
 
103
                 x = boxL + 10,
 
104
                 y = boxT + 400 - th - 10
 
105
              }
 
106
              self:add(self.playerMoney)
 
107
 
94
108
              -- give the buttons a cycle to get out of the T/L corner
95
109
              self:update(0)
96
110
           end,
112
126
                 if the.keys:justPressed('escape') then
113
127
                    self:close()
114
128
                 end
 
129
 
 
130
                 self.playerMoney.text = 'Your money: ' .. the.player.money
115
131
              end
116
132
}
 
 
b'\\ No newline at end of file'