-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINDEX.LUA
executable file
·678 lines (577 loc) · 19.9 KB
/
INDEX.LUA
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
--[[
Smoove V0.93
Pixel, Tile and Sprite Editor for PSPLua
Copyright (c) 2006 - 2016 020200 aka Nodepond
http://digitaltools.node3000.com/downloads/smoove/
feb06mar06apr06sep06may16
changes to V0.93:
- Analog stick drift calibration feature:
older psp's can have issues with calibration of the analog stick. Added a features to re-calibrate the analog stick.
changes to V0.92:
- usb connect
- changes at settiles
- added info urls
changes to V0.91:
- scroll mode at zoom
- minor bugfixes (canvas errors at zoom mode, pixel shift at first row)
changes to V0.9:
- quick load was replaced by quick save (keys L+R)
- battery loading state at animation menu
- enhanced datastructure (folder structure)
- changed icon.png
- minor bugfixes
ToDo:
- confirm before quitting
- settiles bugfixes + animtable
- quick save color sel
- advanced colorpicker
V 1.0 wishlist
- settiles advanced
- mirror tiles
- fill
- transparent color
]]--
require "includes/pad.lc"
require "includes/menu.lc"
Smoove = {
Black = Color.new(0, 0, 0)
, None = Color.new(200, 200, 200, 0)
, White = Color.new(255, 255, 255)
, Gray = Color.new(150, 150, 150)
, Settilecolor = Color.new(175,20,255)
, mapname = nil
, path = "data/"
, mx = 240
, my = 136
, pmx = 240
, pmy = 136
, tilesizex = 32 -- min: 1, max: 58
, tilesizey = 32 -- min: 1, max: 32
, deadzone = 32
, calibratex = 0 -- negative to positive value
, calibratey = 0 -- negative to positive value
, Playtiles = {ffx = 1, tfx = 5, ffy = 1, tfy = 1}
, framex = 1
, framey = 1
, frate = 2
, showsize = true
, showzoom = false
}
-- helper fuctions
function Smoove:Align(t, d)
return math.floor(t/d)*d
end
function Smoove:drawRect(r, x, y, w, h, c)
r:drawLine(x, y, x+w, y, c)
r:drawLine(x+w, y, x+w, y+h, c)
r:drawLine(x+w, y+h, x, y+h, c)
r:drawLine(x, y+h, x, y, c)
end
function Smoove:GetDir()
local x, y = Pad.Ax/90, Pad.Ay/90
local d = math.sqrt(x*x+y*y)
if d>1 then
return x/d, y/d
else
return x, y
end
end
function Smoove:GetVel(x, y, q, s)
local ax, ay = Smoove:GetDir()
local v = 3.5
if q then v = 1 end
if not s then s = 1 end
x = x + (Pad:nGetRepeat(Pad.cLr) - Pad:nGetRepeat(Pad.cLl))*s
y = y + (Pad:nGetRepeat(Pad.cLd) - Pad:nGetRepeat(Pad.cLu))*s
return
math.min(math.max(x + ax * v, 0), 479),
math.min(math.max(y + ay * v, 0), 271)
end
-- color stuff
function Smoove:HSVtoRGB(h, s, v)
local i = math.floor(h / 60)
local f = h / 60 - i
local p1 = v*(1-s)
local p2 = v*(1-s*f)
local p3 = v+p1-p2
if i==0 then return v*255, p3*255, p1*255 end
if i==1 then return p2*255, v*255, p1*255 end
if i==2 then return p1*255, v*255, p3*255 end
if i==3 then return p1*255, p2*255, v*255 end
if i==4 then return p3*255, p1*255, v*255 end
if i==5 then return v*255, p1*255, p2*255 end
end
function Smoove:DrawPalette(dst, h)
local s, v, r, g, b
for x=0, 20 do s = x / 20
for y=0, 20 do v = y / 20
r, g, b = self:HSVtoRGB(h, s, v)
dst:fillRect(x*3 + 33, 93 - y*3, 3, 3, Color.new(r, g, b))
end
end
end
function Smoove:CreatePalette()
local z, h, rad, x, y, ox, oy, r, g, b
local palette = Image.createEmpty(128, 128)
x, y = 64, 15
for z=49.5, 62, 0.5 do
for h=0, 359 do
rad = math.rad(h)
ox = x ; x = 64-math.sin(rad)*z
oy = y ; y = 64-math.cos(rad)*z
if z>50 and z<62 then
r, g, b = self:HSVtoRGB(h, 1.0, 1.0)
palette:drawLine(ox, oy, x, y, Color.new(r, g, b))
else
palette:drawLine(ox, oy, x, y, self.Black)
end
end
end
palette:fillRect(32, 32, 65, 65, self.Black)
return palette
end
function Smoove:DrawCursor(x, y, c)
screen:drawLine(x-7, y, x+7, y, self.Black)
screen:drawLine(x, y-7, x, y+7, self.Black)
screen:pixel(x, y, self.White)
screen:fillRect(x+3, y+3, 8, 8, self.Black)
screen:fillRect(x+4, y+4, 6, 6, c)
end
function Smoove:SelectColor()
self.pmx, self.pmy = self:GetVel(self.pmx, self.pmy, Pad.Rr)
local dx, dy = 240-self.pmx, 136-self.pmy
local d = math.sqrt(dx*dx+dy*dy)
if d>=50 and d<63 then
local r = math.deg(math.atan2(dx, dy))
if r<0 then r = r + 360 end
self:DrawPalette(self.palette, math.floor(r))
end
screen:blit(240-64, 136-64, self.palette)
self.CurrentColor = screen:pixel(self.pmx, self.pmy)
self:DrawCursor(self.pmx, self.pmy, self.CurrentColor)
end
function Smoove:drawBack(cx, cy, tx, ty)
for x=0, tx-1 do
for y=0, ty-1 do
if cx+x < 480 then self.canvas:pixel(cx+x, cy+y, self.dscr:pixel(x*8+9, y*8+9)) end
end
end
end
function Smoove:zoomContent(canvx,canvy,w,h, drawx, drawy, zoomfactor, drawgrid, gridcolor)
if not zoomfactor then zoomfactor = 8 end
if not gridcolor then gridcolor = self.Gray end
if drawgrid == nil then drawgrid = true end
-- first lines
if drawgrid then
self.zscr:drawLine(drawx, drawy, drawx, h*zoomfactor+drawy, gridcolor)
self.zscr:drawLine(drawx, drawy, w*zoomfactor+drawx, drawy, gridcolor)
end
for x=0, w-1 do
for y=0, h-1 do
local tx=(x+1)*zoomfactor+drawx
local ty=(y+1)*zoomfactor+drawy
if drawgrid then
self.zscr:drawLine(tx, drawy, tx, h*zoomfactor+drawy, gridcolor) -- vertical lines
self.zscr:drawLine(drawx, ty, w*zoomfactor+drawx, ty, gridcolor) -- horizontal lines
end
self.dscr:fillRect(tx-zoomfactor, ty-zoomfactor, zoomfactor, zoomfactor, self.canvas:pixel(canvx+x, canvy+y))
end
end
end
-- Zoom Edit --------------------------------------------
function Smoove:ZoomEdit(cx, cy)
-- check if right border is valid
local tilesx = self.tilesizex
if cx + tilesx >= 480 then
tilesx = 479 - cx
self.zscr:clear(self.None)
self.dscr:clear(self.None)
end
-- check if bottom border is valid
local tilesy = self.tilesizey
if cy + tilesy >= 272 then
tilesy = 272 - cy
self.zscr:clear(self.None)
self.dscr:clear(self.None)
end
Smoove:zoomContent(cx, cy, tilesx, tilesy, 8, 8)
while not Pad.tRl do
Pad:Update()
screen:blit(0, 0, self.whiteimg)
screen:blit(0, 0, self.dscr)
screen:blit(0, 0, self.zscr)
if Pad.Ru then
self:SelectColor()
else
self.mx, self.my = self:GetVel(self.mx, self.my, Pad.Rr or Pad.Rd, 8)
-- zoom scroll
if self.mx == 0 then
Smoove:drawBack(cx, cy, tilesx, self.tilesizey)
cx = cx - 1
if cx < 0 then cx = 0 end
Smoove:zoomContent(cx, cy, tilesx, self.tilesizey, 8, 8)
self.mx = 4
end
if self.mx >= tilesx*8+15 then
Smoove:drawBack(cx, cy, tilesx, self.tilesizey)
cx = cx + 1
if cx + tilesx >= 480 then cx = 479 - tilesx end
Smoove:zoomContent(cx, cy, tilesx, self.tilesizey, 8, 8)
self.mx = tilesx*8+12
end
if self.my == 0 then
Smoove:drawBack(cx, cy, tilesx, self.tilesizey)
cy = cy - 1
if cy < 0 then cy = 0 end
Smoove:zoomContent(cx, cy, tilesx, self.tilesizey, 8, 8)
self.my = 4
end
if self.my >= self.tilesizey*8+15 then
Smoove:drawBack(cx, cy, tilesx, self.tilesizey)
cy = cy + 1
if cy + self.tilesizey >= 272 then cy = 272 - self.tilesizey end
Smoove:zoomContent(cx, cy, tilesx, self.tilesizey, 8, 8)
self.my = self.tilesizey*8+12
end
if Pad.R1 then self.CurrentColor = screen:pixel(self.mx, self.my) end
if Pad.Rr and (self.mx<(tilesx+2)*8) and (self.my<(self.tilesizey+2)*8) then -- only draw inside grid + markers
self.dscr:fillRect(self:Align(self.mx,8)+1,
self:Align(self.my,8)+1, 7, 7, self.CurrentColor)
end
if Pad.Rd and (self.mx<(tilesx+2)*8) and (self.my<(self.tilesizey+2)*8) then
self.dscr:fillRect(self:Align(self.mx,8)+1,
self:Align(self.my,8)+1, 7, 7)
end
if Pad.L1 then
for x=0, tilesx-1 do
for y=0, self.tilesizey-1 do
self.dscr:fillRect(x*8+9, y*8+9, 7, 7, self.copyBuffer:pixel(x, y))
end
end
end
self:DrawCursor(self.mx, self.my, self.CurrentColor)
end
screen.waitVblankStart()
screen.flip()
end
while not Pad.rRl do
Pad:Update()
screen.waitVblankStart()
end
Smoove:drawBack(cx, cy, tilesx, self.tilesizey)
-- copy buffer
for x=0, tilesx-1 do
for y=0, self.tilesizey-1 do
self.copyBuffer:pixel(x, y, self.dscr:pixel(x*8+9, y*8+9))
end
end
end
function Smoove:iterateFrames(reset)
if reset then
self.framex = self.Playtiles.ffx
self.framey = self.Playtiles.ffy
else self.framex = self.framex + 1
end
if self.framex*self.tilesizex >= 480 then
self.framex = 1
self.framey = self.framey + 1
end
if self.framex >= self.Playtiles.tfx and self.framey >= self.Playtiles.tfy then
self.framex = self.Playtiles.ffx
self.framey = self.Playtiles.ffy
end
end
function Smoove:animate()
screen:blit(0, 0, self.whiteimg)
Smoove:drawRect(screen, 299, 8, self.tilesizex+1, self.tilesizey+1, self.Black)
screen:blit(300,9, self.canvas, self.tilesizex*(self.framex-1)+1, self.tilesizey*(self.framey-1)+1, self.tilesizex, self.tilesizey)
if self.showzoom then
Smoove:zoomContent(self.tilesizex*(self.framex-1), self.tilesizey*(self.framey-1), self.tilesizex, self.tilesizey, 8, 8, 3, false)
screen:blit(8, 168, self.dscr, 8, 8, self.tilesizex*3, self.tilesizey*3)
end
Menu:drawMenu()
frametimer = frametimer + 1
if (frametimer >= self.frate) then
frametimer = 0
Smoove:iterateFrames()
end
end
-- Menu functions ---------------------------------------
function Smoove:frameSize()
Menu:Cue()
Pad:Update()
while not Pad.tRr do
Pad:Update()
if Pad.tLr then self.tilesizex = self.tilesizex + 1 end
if Pad.tLl then self.tilesizex = self.tilesizex - 1 end
if Pad.tLu then self.tilesizey = self.tilesizey - 1 end
if Pad.tLd then self.tilesizey = self.tilesizey + 1 end
if self.tilesizex > 58 then self.tilesizex = 58 end
if self.tilesizey > 32 then self.tilesizey = 32 end
if self.tilesizex < 1 then self.tilesizex = 1 end
if self.tilesizey < 1 then self.tilesizey = 1 end
Menu:changeEntry(Menu:getSelectedNum(), "frame size: " .. self.tilesizex .. "x" .. self.tilesizey)
self:animate()
screen.waitVblankStart()
screen.flip()
end
self.dscr:clear(self.None)
Menu:Uncue()
end
function Smoove:open()
local tmp = Menu:browseFiles(".PNG", self.path)
local img
if tmp then
self.mapname = tmp
img = Image.load(self.path..self.mapname)
self.canvas:clear(self.None)
self.canvas:blit(0,0,img)
end
end
function Smoove:save()
self.canvas:save(self.path..self.mapname)
end
function Smoove:saveAs()
if not self.mapname then self.mapname = "NEW.PNG" end
local tmp = Menu:enterName(self.mapname)
if tmp then
self.mapname = tmp
self.canvas:save(self.path..self.mapname)
end
end
function Smoove:clearScreen()
self.canvas:clear()
end
function Smoove:setTiles()
Pad:Update()
self.mx = self.Playtiles.ffx*self.tilesizex-(self.tilesizex/2)
self.my = self.Playtiles.ffy*self.tilesizey-(self.tilesizey/2)
while true do
Pad:Update()
screen:blit(0, 0, self.whiteimg)
screen:blit(0, 0, self.canvas)
if Pad.Rd then break end
if Pad.tRr then break end
Smoove:drawRect(screen, 0, 0, 480, 272, self.Settilecolor)
if Pad.tRl then
self.Playtiles.ffx = (self:Align(self.mx, self.tilesizex)/self.tilesizex)+1
self.Playtiles.ffy = (self:Align(self.my, self.tilesizey)/self.tilesizey)+1
if self.Playtiles.ffx > self.Playtiles.tfx then self.Playtiles.tfx = self.Playtiles.ffx end
if self.Playtiles.ffy > self.Playtiles.tfy then self.Playtiles.tfy = self.Playtiles.ffy end
self.framex = self.Playtiles.ffx
self.framey = self.Playtiles.ffy
end
if Pad.Rl then self.Playtiles.tfx = (self:Align(self.mx, self.tilesizex)/self.tilesizex)+2 end
if self.Playtiles.tfx*self.tilesizex >= 480 then self.Playtiles.tfx = (self:Align(479, self.tilesizex)/self.tilesizex)+2 end
if Pad.Rl then self.Playtiles.tfy = (self:Align(self.my, self.tilesizey)/self.tilesizey)+1 end
if self.Playtiles.tfx <= self.Playtiles.ffx and self.Playtiles.tfy <= self.Playtiles.ffy then self.Playtiles.tfx = self.Playtiles.ffx+1 end
if self.Playtiles.tfy < self.Playtiles.ffy then self.Playtiles.tfy = self.Playtiles.ffy end
Smoove:iterateFrames(1)
for i = 1, 100 do
Smoove:drawRect(screen, (self.framex-1)*self.tilesizex, (self.framey-1)*self.tilesizey, self.tilesizex, self.tilesizey, self.Settilecolor)
Smoove:iterateFrames()
end
self.my = math.min(self.my, 254)
self.mx, self.my = self:GetVel(self.mx, self.my, Pad.Rr or Pad.Rd)
Smoove:DrawCursor(self.mx, self.my, self.CurrentColor)
screen.waitVblankStart()
screen.flip()
end
Smoove:iterateFrames(1)
end
function Smoove:framerate()
Menu:Cue()
Pad:Update()
while not Pad.tRr do
Pad:Update()
if Pad.tLr then self.frate = self.frate + 1 end
if Pad.tLl then self.frate = self.frate - 1 end
if self.frate < 1 then self.frate = 1 end
Menu:changeEntry(Menu:getSelectedNum(), "framerate: " .. 60/self.frate)
screen:blit(0, 0, self.whiteimg)
self:animate()
screen.waitVblankStart()
screen.flip()
end
Menu:Uncue()
end
function Smoove:showTilesize()
local show
if self.showsize then
self.showsize = false
show = "no"
else
self.showsize = true
show = "yes"
end
Menu:changeEntry(Menu:getSelectedNum(), "show tilesize: " .. show)
end
function Smoove:showZoom()
local show
if self.showzoom then
self.showzoom = false
show = "no"
else
self.showzoom= true
show = "yes"
end
Menu:changeEntry(Menu:getSelectedNum(), "show zoom: " .. show)
end
function Smoove:calibrateStick()
Menu:Cue()
Pad:Update()
while not Pad.tRr do
Pad:Update()
if Pad.tLr then self.calibratex = self.calibratex + 1 end
if Pad.tLl then self.calibratex = self.calibratex - 1 end
if Pad.tLu then self.calibratey = self.calibratey - 1 end
if Pad.tLd then self.calibratey = self.calibratey + 1 end
Pad:analogCalibration(self.deadzone, self.calibratex, self.calibratey)
Menu:changeEntry(Menu:getSelectedNum(), "calibrate analog stick x: " .. self.calibratex .. " y: " .. self.calibratey)
self:animate()
screen.waitVblankStart()
screen.flip()
end
self.dscr:clear(self.None)
Menu:Uncue()
end
function Smoove:usbConnect()
Pad:Update()
System.usbDiskModeActivate()
Menu:Cue()
Menu:changeEntry(Menu:getSelectedNum(), "connected...")
while not Pad.tRr do
Pad:Update()
Menu:drawMenu()
screen.waitVblankStart()
screen.flip()
end
Menu:Uncue()
Menu:changeEntry(Menu:getSelectedNum(), "connect to usb")
System.usbDiskModeDeactivate()
end
function Smoove:info()
Menu:Cue()
Pad:Update()
while not Pad.tRr do
Pad:Update()
Menu:changeEntry(Menu:getSelectedNum(), "http://digitaltools.node3000.com/downloads/smoove/")
screen:blit(0, 0, self.whiteimg)
self:animate()
screen.waitVblankStart()
screen.flip()
end
Menu:Uncue()
Menu:changeEntry(Menu:getSelectedNum(), "info")
end
------ Menu and Animate ---------------------------------
function Smoove:AnimateMenu()
frametimer = 0
Pad:Update()
while not Pad.tSl do
Pad:Update()
local framemax = (480/self.tilesizex) * (272/self.tilesizey)
-- select menu
-- todo: enhancement of menucursor triggering
self.mx, self.my = self:GetVel(self.mx, self.my)
if Pad.tLu then Menu:moveUp() end
if Pad.tLd then Menu:moveDown() end
-- menue selection action
local num = "none"
if Pad.tRr then num = Menu:getSelectedId() end
if num == "framesize" then Smoove:frameSize()
elseif num == "open" then Smoove:open()
elseif num == "save" then Smoove:save()
elseif num == "saveas" then Smoove:saveAs()
elseif num == "clearscreen" then Smoove:clearScreen()
elseif num == "settiles" then Smoove:setTiles()
elseif num == "framerate" then Smoove:framerate()
elseif num == "showtilesize" then Smoove:showTilesize()
elseif num == "calibrate" then Smoove:calibrateStick()
elseif num == "showzoom" then Smoove:showZoom()
elseif num == "usbconnect" then Smoove:usbConnect()
elseif num == "info" then Smoove:info()
end
self:animate()
screen:print(440, 8, System.powerGetBatteryLifePercent().."%", self.Black)
screen.waitVblankStart()
screen:flip()
end
self.zscr:clear(self.None)
end
-- Init -------------------------------------------------
function Smoove:Init()
Menu:clearAll()
Menu:setSize(0, 0, 285, 130)
Menu:setStyle(Color.new(175,20,255), Color.new(0,0,0), Color.new(255,255,0), Color.new(255,255,150), Color.new(255,255,255,255))
Menu:addEntry("framesize", "frame size: " .. self.tilesizex .. "x" .. self.tilesizey)
Menu:addEntry("open", "open")
Menu:addEntry("save", "save")
Menu:addEntry("saveas", "save as...")
Menu:addEntry("clearscreen", "clear screen")
Menu:addEntry("settiles", "set tiles")
Menu:addEntry("framerate", "framerate: " .. 60/self.frate)
Menu:addEntry("showtilesize", "show tilesize: yes" )
Menu:addEntry("showzoom", "show zoom: no" )
Menu:addEntry("calibrate", "calibrate analog stick x: " .. self.calibratex .. " y: " .. self.calibratey )
Menu:addEntry("usbconnect", "connect to usb" )
Menu:addEntry("info", "info" )
end
-- Main -------------------------------------------------
function Smoove:Main()
local ox, oy
Smoove:Init()
if self.zscr == nil then
self.dscr = Image.createEmpty(480, 272)
self.zscr = Image.createEmpty(480, 272)
self.copyBuffer = Image.createEmpty(480, 272)
self.whiteimg = Image.createEmpty(480, 272)
self.dscr:clear(self.None)
self.zscr:clear(self.None)
self.whiteimg:clear(self.White)
end
self.palette = self:CreatePalette()
self.canvas = Image.createEmpty(480, 272)
self.canvas:clear()
self.CurrentColor = self.Black
self:DrawPalette(self.palette, math.floor(0))
while not Pad.tSt do
Pad:Update()
if Pad.R1 and Pad.L1 then
if self.mapname == nil then Smoove:saveAs() else Smoove:save() end
end
screen:blit(0, 0, self.whiteimg)
self.canvas:fillRect(0, 261, 40, 12, self.White) -- showframesize
if self.showsize then self.canvas:print(1, 263, self.tilesizex.."x"..self.tilesizey) end
screen:blit(0, 0, self.canvas)
if Pad.Ru then
self:SelectColor()
else
if Pad.tSl then self:AnimateMenu() end
self.mx, self.my = self:GetVel(self.mx, self.my, Pad.Rr or Pad.Rd)
if Pad.R1 then self.CurrentColor = screen:pixel(self.mx, self.my) end
if Pad.Rl then
self.my = math.min(self.my, 255)
self:drawRect(screen, self:Align(self.mx,self.tilesizex), self:Align(self.my,self.tilesizey), self.tilesizex, self.tilesizey, self.Black)
elseif Pad.rRl then
ox, oy = self.mx, self.my
self.mx = (math.floor(ox) - self:Align(ox,self.tilesizex))*8+12
self.my = (math.floor(oy) - self:Align(oy,self.tilesizey))*8+12
self:ZoomEdit(self:Align(ox,self.tilesizex), self:Align(oy,self.tilesizey))
self.mx, self.my = ox, oy
elseif Pad.Rr then
self.canvas:pixel(self.mx, self.my, self.CurrentColor)
elseif Pad.Rd then
self.canvas:pixel(self.mx, self.my, self.None)
end
self:DrawCursor(self.mx, self.my, self.CurrentColor)
end
screen.waitVblankStart()
screen.flip()
end
if not Pad.Lu then
if self.mapname == nil then Smoove:saveAs() else Smoove:save() end
end
Pad:Update()
end
do Smoove:Main() end