Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Soda
- displayMode(OVERLAY)
- displayMode(FULLSCREEN)
- -- Use this as a template for your projects that have Soda as a dependency.
- function setup()
- saveProjectInfo("Description", "Soda v"..Soda.version)
- profiler.init()
- Soda.setup()
- parameter.watch("Soda.focus.title")
- --barracks{}
- listRax()
- --overview{}
- -- demo1() --do your setting up here
- local stats = Soda.Window{
- hidden = true,
- x = 0, y = -0.001, w = 200, h = 120,
- title = "Profiler\n\n\n", --will be overridden
- -- shapeArgs = {corners = 8},
- blurred = true, shadow = true,
- update = function(self) --update will be called every frame
- self.title = string.format("Profiler\n\nFPS: %.2f\nMem: %.2f", profiler.fps, profiler.mem)
- end
- }
- Soda.Switch{ --a switch to toggle the profiler stats panel
- parent = buttonPanel,
- x = 20, y = -80,
- title = "Show profiler",
- callback = function() stats:show(LEFT) end,
- callbackOff = function() stats:hide(LEFT) end
- }
- end
- function draw()
- --do your updating here
- pushMatrix()
- Soda.camera()
- drawing()
- popMatrix()
- profiler.draw()
- end
- function drawing(breakPoint)
- --in order for gaussian blur to work, do all your drawing here
- sprite("Cargo Bot:Game Area", WIDTH*0.5, HEIGHT*0.5, WIDTH, HEIGHT)
- --pushStyle()noStroke()fill(40, 80, 50, 50)rectMode(CORNER)rect(0,0,WIDTH,HEIGHT)popStyle()
- Soda.draw(breakPoint)
- end
- --user inputs:
- function touched(touch)
- if Soda.touched(touch) then return end
- --your touch code goes here
- end
- function keyboard(key)
- Soda.keyboard(key)
- end
- function orientationChanged(ori)
- Soda.orientationChanged(ori)
- end
- --measure performance:
- profiler={}
- function profiler.init(quiet)
- profiler.del=0
- profiler.c=0
- profiler.fps=0
- profiler.mem=0
- if not quiet then
- parameter.watch("profiler.fps")
- parameter.watch("profiler.mem")
- end
- end
- function profiler.draw()
- profiler.del = profiler.del + DeltaTime
- profiler.c = profiler.c + 1
- if profiler.c==10 then
- profiler.fps=profiler.c/profiler.del
- profiler.del=0
- profiler.c=0
- profiler.mem=collectgarbage("count", 2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement