Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
Removed some redundant code and disabled antialiasing
  • Loading branch information
Lerg committed Dec 17, 2013
1 parent daa2088 commit 9665e55
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 212 deletions.
1 change: 0 additions & 1 deletion config.lua
Expand Up @@ -6,7 +6,6 @@ application =
height = 640,
scale = 'letterbox',
fps = 60,
antialias = true,
imageSuffix =
{
['@2x'] = 1.5,
Expand Down
5 changes: 4 additions & 1 deletion lib/api.lua
Expand Up @@ -2,6 +2,9 @@ local _M = {}

local app = require('lib.app')

-- Audio is converted to RAW with ffmpeg command
-- ffmpeg -i fire.mp3 -f u8 -acodec pcm_u8 -ar 16000 -ac 1 fire.raw

function _M:loadAudio()
local f = io.open(system.pathForFile('music/fire.raw', system.ResourceDirectory), 'rb')
local data = f:read('*a')
Expand All @@ -14,7 +17,7 @@ function _M:loadAudio()
local stream = audio.loadStream('music/fire.mp3')
local c = audio.play(stream, {loops = -1})
audio.setVolume(0, {channel = c})
audio.fade{channel = c, time = 3000, volume = 0.01}
audio.fade{channel = c, time = 3000, volume = 0.5}
self.audioStart = system.getTimer()
end

Expand Down
2 changes: 1 addition & 1 deletion lib/app.lua
Expand Up @@ -56,7 +56,7 @@ _H = display.contentHeight
_T = display.screenOriginY -- Top
_L = display.screenOriginX -- Left
_R = display.viewableContentWidth - _L -- Right
_B = display.viewableContentHeight - _T-- Bottom
_B = display.viewableContentHeight - _T-- Bottom4
_CX = math.floor(_W / 2)
_CY = math.floor(_H / 2)

Expand Down
2 changes: 0 additions & 2 deletions lib/utils.lua
Expand Up @@ -214,14 +214,12 @@ function HSVtoRGB(h, s, v)
local r,g,b
local i
local f,p,q,t

if s == 0 then
r = v
g = v
b = v
return r, g, b
end

h = h / 60;
i = math.floor(h);
f = h - i;
Expand Down
198 changes: 0 additions & 198 deletions music/fire8.raw

This file was deleted.

9 changes: 0 additions & 9 deletions scenes/intro.lua
Expand Up @@ -3,14 +3,6 @@ local app = require('lib.app')
local api = app.api
function scene:createScene (event)
local group = self.view
self.snapshot = {}
self.snapshot[1] = display.newSnapshot(_W, _H)
self.snapshot[1]:translate(_CX, _CY)
group:insert(self.snapshot[1])
self.snapshot[2] = display.newSnapshot(_W, _H)
self.snapshot[2]:translate(_CX, _CY)
group:insert(self.snapshot[2])

self.viewGroup = display.newGroup()
self.drawGroup = display.newGroup()
self.activeSnapshot = display.newSnapshot(_W, _H)
Expand Down Expand Up @@ -82,7 +74,6 @@ function scene:drawAudioWave()
self.drawGroup:insert(self.blackRect)
display.remove(self.waveLine)
local d = _W / (#data - 1)
self.snapshot[2].fill.effect = nil
self.waveLine = display.newLine(self.drawGroup, -_CX, data[1], d - _CX, data[2])
for i = 3, #data do
self.waveLine:append(d * (i - 1) - _CX, data[i])
Expand Down

0 comments on commit 9665e55

Please sign in to comment.