fix/workaround: removed glitches with scaling and quads
[uboot.git] / graphics.lua
blob0c0a1fca23574387ccbdfc7512c283a665d0aa9a
1 local x,y
3 --[[
4 the standard graphics pipeline which draws a complete scenery
5 ]]--
6 function graphics_pipeline(batch,xCam,yCam)
7 x = xCam
8 y = yCam
9 local sonarbubblesStencil = love.graphics.newStencil(graphics_stencilFunction)
10 graphics_drawBackground()
11 love.graphics.setStencil(sonarbubblesStencil)
12 graphics_drawEntities(x,y)
13 love.graphics.setStencil()
14 graphics_drawMap(batch,x,y)
15 love.graphics.setInvertedStencil(sonarbubblesStencil)
16 graphics_drawShadow()
17 love.graphics.setInvertedStencil()
18 end
20 --[[
21 draws the background or 'water'
22 ]]--
23 function graphics_drawBackground()
24 love.graphics.push()
25 love.graphics.setColor(130,180,190)
26 love.graphics.rectangle("fill",0,0,3200,3200) --TODO
27 love.graphics.pop()
28 end
30 --[[
31 draws all entities. not visible entities will be painted over by background
32 ]]--
33 function graphics_drawEntities(x,y)
34 for i,e in ipairs(entities) do
35 e:draw(x,y)
36 end
37 end
39 --[[
40 draws the map
41 ]]--
42 function graphics_drawMap(batch,x,y)
43 love.graphics.draw(batch,-x,-y)
44 end
46 --[[
47 draws a transparent shadow
48 ]]--
49 function graphics_drawShadow()
50 love.graphics.push()
51 love.graphics.setColor(30,30,130,200)
52 love.graphics.rectangle("fill",0,0,3200,3200) --TODO
53 love.graphics.pop()
54 end
56 --[[
57 draws the controls on top of everything
58 ]]--
59 function graphics_drawControls()
60 end
62 --[[
63 iterates over all sonarbubbles and adds a circle stencil for each
64 ]]--
65 function graphics_stencilFunction()
66 for i,s in ipairs(sonarbubbles) do
67 love.graphics.circle("fill",s.x-x,s.y-y,s.size/2)
68 end
69 end
71 --[[
72 draws a console
73 ]]--
74 function graphics_drawConsole()
75 end