-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua.bak
executable file
·222 lines (171 loc) · 5.43 KB
/
main.lua.bak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
--BIG PERFORMANCE PB
-- try to revert to love 11.1
-- pb only with custom built love 11.3
-- init of save directory : might not create if folder exists in prj folder
--zaz2nim
---- parameterize project canvas size ( 640 480 , 1920 1080 ) in config file of project
-- require of config works
-- insert perf logs
-- palette bug > only some colors can be picked
-- screen scalling incorrectonandroid
--simpletouchwithout dragdoesn'twork dotimpossible
-- DONE flickmode
-- TODO script to migrate zazanim project
--TODO time code screen
-- TODO copy range
-- TODO zoom mode
-- TODO queue fill mode
-- TODO shader fill mode
-- TODO bg layer
-- TODO virtual camera
-- minimum for mobile:
-- WIP settings screen with brush size
-- auto folder creation for project on android
-- toggle display of eraser button
-- scroll save TODO palette buttons
-- WORKS copy frame
-- test on android sd ( all devices )
-- NOTE 3 neo slow in hd
-- note 8 ok
-- note 4 untested
-- gtn 5110 untested
-- lenovo a310 untested
-- NOTE 8 NOK GTN5110 NOK
-- frames are destroyed when scrolling
-- cvs save works in unit test on android
-- try disabling display when downloading tex
-- try saving files when downloading
-- draw zazahead slowly then change feature = load splash
-- WIP pic button zith spritesheet
-- TODO do not use load filter for project load,
-- having drawable is not useful ( and must take up memory )
-- TODO do we need to release tex allocated all the time ?
-- brush
-- TO DECIDE ui cvs has same size and zoom as project canvas
-- BUG the brush is blit top left, not centered
-- DONE round brush
-- DONE line interpolation
-- BUG add frame only adds at end of project, insertion should be possible
-- WIP smooth ink shader
-- chosen ink color should be alphaed on neighboring pixels ( fireman ben style )
-- TODO the notion of canvas is not the same in zaz2nim
-- probably the canvas should be reblitted on a canvas of the same size, then scaled up?
-- otherwise the result will look different than target res?
-- try unit test in subfolder of project with main.lua
-- TODO interpolate unit test
-- TODO performance logs
-- DONE save modified buf even if no scroll
-- TODO save with smooth shader
-- TODO virtual scroll (scene larger than screen)
-- TODO file requester
-- TODO sound capture test
--https://love2d.org/forums/viewtopic.php?t=86173
--TODO drag and drop widget for cut and paste
-- based on mtdt titler boxes
--poc paint to canvs
-- poc save to file and scroll with ul and dl of image data
--TASKS
-- add pic button
-- note 3 neo test
-- note 8 tab test
-- perf logs on ul dl of tex
-- make resolution a variable
-- instead of blitting alpha brush (which modifies color because blends with bg even at alpha 0)
-- use canvas to store what is done on the canvas (keep brush color with some alpha)
--global resource for all screens
buttonsPic=love.graphics.newImage("buttons.png")
require('stringutil')
require('widgetutils')
require('msg')
require('picbutton')
-- require('hdconf')
require('sdconf')
require('shaders')
require('interpolateLine')
require('loadfilter')
require('touch')
require('loadsave')
require('playmode')
require('palette')
require('pickmode')
require('timecode')
require('settings')
require('flickmode')
require('paintmode')
require('screenandcvs')
require('brush')
-- function paint(x,y)
-- love.graphics.setCanvas(ui)
-- love.graphics.draw(mybrush,x,y)
-- love.graphics.setCanvas()
-- end
renderdecos=true
--project structure
frames={}
--end project globals
function love.load()
--incorrect because the files are not ordered
-- files=love.filesystem.getDirectoryItems(prjfld)
-- for i,f in ipairs(files)
-- do
-- suffix=f:sub(f:len()-3,f:len())
-- print(f..' '..suffix)
-- if suffix==".png" then
-- table.insert(frames,loadfilter(prjfld..f))
-- end
-- end
maxframe=0
--frames are 0 based for zazanim compatibility ( tcs, etc )
local i = 0
currentName=string.format("%03d",i)..".png"
print("attempting load "..currentName)
cur=love.filesystem.getInfo(conf.prjfld..currentName)
while cur do
frameTable =loadfilter(conf.prjfld..currentName)
--please note we will add other metadatas in frameTable, such as time code and optional sound
--we are here because cur is not nil
table.insert(frames,frameTable)
maxframe=i
i = i + 1
currentName=string.format("%03d",i)..".png"
print("attempting load "..currentName)
cur=love.filesystem.getInfo(conf.prjfld..currentName)
if i<4 and cur==nil then
--TODO load template and put in cur
end
end
local tcf=love.filesystem.getInfo(conf.prjfld.."timecodes.txt")
if tcf ~= nil then
for sTc in love.filesystem.lines(conf.prjfld.."timecodes.txt")
do
addMsg(sTc)
addMsg(string.byte(sTc,1,3))
addMsg(string.sub(sTc,1,3))
local frmNum=tonumber(string.sub(sTc,1,3))
addMsg(string.sub(sTc,5,7))
local frmTc=tonumber(string.sub(sTc,5,7))
--TODO be careful zazanim has different indexes
--funnily index crashes on win32?
frames[frmNum].tc=frmTc
end
end
loadTxtCodes()
initCanvases(currentIdx)
-- mybrush=love.graphics.newImage(createBrushID(16))
mybrush=love.graphics.newImage(roundBrushWithAlpha( brshradius,0.0,0.0,0.0))
mybrush:setFilter('nearest','nearest')
createInkShader()
createEraserShader()
end
--
-- default mode, could be changed
toPaintMode()
love.keypressed = function(key, code, isrepeat)
keyFunc(key, code, isrepeat)
end
function love.draw()
drawFunc()
end
function love.update()
updateFunc()
end