30
27
local t = Text:new{
33
y = boxT + 10 + (i-1) * lh,
42
y = boxT + 10 + (i-1) * lh,
50
y = boxT + 10 + (i-1) * lh - 1,
51
label = Text:new{ text = 'BUY', x = 1 },
52
onMouseDown = function (self)
53
the.player:buy(good[1], good[2])
56
local tw, th = b.label:getSize()
57
b.background = Fill:new{
66
y = boxT + 10 + (i-1) * lh - 1,
67
label = Text:new{ text = 'SELL', x = 1 },
68
onMouseDown = function (self)
69
the.player:sell(good[1], good[2])
72
local tw, th = b.label:getSize()
73
b.background = Fill:new{
33
local tw, th = t:getSize()
34
t.y = boxT + 10 + (i-1) * th -- (th + 2) -- for padding?
83
label = Text:new{ text = 'Close', x = 3, y = 2 },
84
onMouseDown = function()
89
local tw, th = b.label:getSize()
90
b.background = Fill:new{
95
b.x = boxR - b.background.width - 10
96
b.y = boxT + 400 - b.background.height - 10
100
self.playerMoney = Text:new{
101
text = 'Your money: ',
104
y = boxT + 400 - th - 10
106
self:add(self.playerMoney)
108
-- give the buttons a cycle to get out of the T/L corner
111
39
activate = function (self)
112
40
the.cursor.visible = false
116
44
Subview.activate(self)
118
close = function (self)
119
the.cursor.visible = true
120
love.mouse.setVisible(false)
121
love.mouse.setGrab(true)
125
onUpdate = function (self)
126
if the.keys:justPressed('escape') then
130
self.playerMoney.text = 'Your money: ' .. the.player.money
b'\\ No newline at end of file'