1
TradeView = Subview:extend {
2
drawParent = true, --default?
3
onNew = function (self)
4
-- create all the interface bits from the planet
5
-- and add them to the view
7
local boxL = the.app.width / 2 - 200
8
local boxT = the.app.height / 2 - 200
9
local boxR = boxL + 400
11
local lh = 17 -- line height
29
for i, good in ipairs(self.planet.goods) do
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 },
53
local tw, th = b.label:getSize()
54
b.background = Fill:new{
63
y = boxT + 10 + (i-1) * lh - 1,
64
label = Text:new{ text = 'SELL', x = 1 },
66
local tw, th = b.label:getSize()
67
b.background = Fill:new{
77
label = Text:new{ text = 'Close', x = 3, y = 2 },
78
onMouseDown = function()
83
local tw, th = b.label:getSize()
84
b.background = Fill:new{
89
b.x = boxR - b.background.width - 10
90
b.y = boxT + 400 - b.background.height - 10
94
-- give the buttons a cycle to get out of the T/L corner
97
activate = function (self)
98
the.cursor.visible = false
99
love.mouse.setVisible(true)
100
love.mouse.setGrab(false)
102
Subview.activate(self)
104
close = function (self)
105
the.cursor.visible = true
106
love.mouse.setVisible(false)
107
love.mouse.setGrab(true)
111
onUpdate = function (self)
112
if the.keys:justPressed('escape') then
b'\\ No newline at end of file'