/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-05-13 20:41:14 UTC
  • Revision ID: josh@9ix.org-20130513204114-wtg735gs4b38wad4
extract wrapping behavior, wrap bullets

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
6
 
 
7
 
              local boxL = the.app.width / 2 - 200
8
 
              local boxT = the.app.height / 2 - 200
9
 
 
10
 
              self:add(Fill:new{
11
 
                          fill = {255,255,255},
12
 
                          x = boxL - 1,
13
 
                          y = boxT - 1,
14
 
                          width = 402,
15
 
                          height = 402,
16
 
                       })
17
 
 
18
 
              self:add(Fill:new{
19
 
                          fill = {0,0,0},
20
 
                          x = boxL,
21
 
                          y = boxT,
22
 
                          width = 400,
23
 
                          height = 400,
24
 
                       })
25
 
 
26
 
              for i, good in ipairs(self.planet.goods) do
27
 
                 local t = Text:new{
28
 
                    text = good[1],
29
 
                    x = boxL + 10,
30
 
                    width = 380
31
 
                 }
32
 
 
33
 
                 local tw, th = t:getSize()
34
 
                 t.y = boxT + 10 + (i-1) * th -- (th + 2) -- for padding?
35
 
 
36
 
                 self:add(t)
37
 
              end
38
 
           end,
39
 
   activate = function (self)
40
 
                 the.cursor.visible = false
41
 
                 love.mouse.setVisible(true)
42
 
                 love.mouse.setGrab(false)
43
 
 
44
 
                 Subview.activate(self)
45
 
              end,
46
 
 
47
 
}
 
 
b'\\ No newline at end of file'