diff --git a/conf.lua b/conf.lua index a2718b9..a262028 100644 --- a/conf.lua +++ b/conf.lua @@ -1,6 +1,7 @@ function love.conf( t ) t.version = "11.4" t.identity = "Your Own Drum" + t.console = true t.modules.joystick = false t.modules.physics = false diff --git a/recorder.lua b/recorder.lua index 25c952c..6c5dcde 100644 --- a/recorder.lua +++ b/recorder.lua @@ -2,6 +2,7 @@ local love = love local recorder = {} recorder.isLoaded = false +local ddxs, ddys local i = 0 function recorder.Reset() @@ -9,15 +10,12 @@ function recorder.Reset() for k, _ in ipairs( recorder ) do recorder[k] = nil end end -function recorder.UpdateCts( ddx, ddy ) - local xByte = 0 - local yByte = 0 - - --i = i + 1 - recorder[i] = love.data.pack( "data", "dd", ddx, ddy ) +function recorder.Update( ddx, ddy ) + i = i + 1 + recorder[i] = love.data.pack( "string", "!16 0.5 then byte = byte + 1 end if ddy > 0.5 then byte = byte + 2 end @@ -26,15 +24,16 @@ function recorder.Update( ddx, ddy ) i = i + 1 recorder[i] = string.char( byte + 48 ) -end +end]] function recorder.Load( filename ) + ddxs, ddys = {}, {} local s = love.filesystem.read( filename ) - print( filename ) if not s then return end - local j = 1 - for c in s:gmatch( "." ) do - recorder[j] = string.byte( c ) - 48 + local k, j = 1, 1 + local n = s:len() + while k < n do + ddxs[j], ddys[j], k = love.data.unpack( "!16