/traderous

To get this branch, use:
bzr branch /bzr/traderous
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
TradeView = Subview:extend {
   drawParent = true, --default?
   onNew = function (self)
              -- create all the interface bits from the planet
              -- and add them to the view

              local boxL = the.app.width / 2 - 200
              local boxT = the.app.height / 2 - 200

              self:add(Fill:new{
                          fill = {255,255,255},
                          x = boxL - 1,
                          y = boxT - 1,
                          width = 402,
                          height = 402,
                       })

              self:add(Fill:new{
                          fill = {0,0,0},
                          x = boxL,
                          y = boxT,
                          width = 400,
                          height = 400,
                       })

              for i, good in ipairs(self.planet.goods) do
                 local t = Text:new{
                    text = good[1],
                    x = boxL + 10,
                    width = 380
                 }

                 local tw, th = t:getSize()
                 t.y = boxT + 10 + (i-1) * th -- (th + 2) -- for padding?

                 self:add(t)
              end
           end,
   activate = function (self)
                 the.cursor.visible = false
                 love.mouse.setVisible(true)
                 love.mouse.setGrab(false)

                 Subview.activate(self)
              end,

}