Compare commits
	
		
			No commits in common. "b8cecffec258b458d7ca3b3c46a7de906aed9b4e" and "45f3db4f4751b02fb470018edf7986f378d49555" have entirely different histories.
		
	
	
		
			b8cecffec2
			...
			45f3db4f47
		
	
		
					 12 changed files with 67 additions and 350 deletions
				
			
		
							
								
								
									
										9
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -1,6 +1,5 @@ | ||||||
| /.cache | dev | ||||||
| /dev/ | build/ | ||||||
| /build/ | games/* | ||||||
| /games/* | !games/.gitkeep | ||||||
| !/games/.gitkeep |  | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										61
									
								
								build.sh
									
										
									
									
									
								
							
							
						
						
									
										61
									
								
								build.sh
									
										
									
									
									
								
							|  | @ -1,61 +0,0 @@ | ||||||
| #!/bin/sh |  | ||||||
| 
 |  | ||||||
| echo General packaging |  | ||||||
| rm -r build |  | ||||||
| mkdir build |  | ||||||
| cd build |  | ||||||
| 
 |  | ||||||
| mv ../dev ../deva |  | ||||||
| lua ~/proj/luapack/main.lua ../luapack.lua |  | ||||||
| mv ../deva ../dev |  | ||||||
| 
 |  | ||||||
| #cp -r lib skins ll-min.lua build/ |  | ||||||
| 
 |  | ||||||
| zip -9 -r ../game.love . |  | ||||||
| rm * |  | ||||||
| mv ../game.love . |  | ||||||
| 
 |  | ||||||
| echo Windows packaging |  | ||||||
| VER=11.4 |  | ||||||
| BITS=64 |  | ||||||
| ARCH=x86_64 |  | ||||||
| if [ ! -d ../.cache/love-$VER-win$BITS ]; then |  | ||||||
|   mkdir -p ../.cache/love-$VER-win$BITS |  | ||||||
|   cd ../.cache |  | ||||||
|   wget https://github.com/love2d/love/releases/download/$VER/love-$VER-win$BITS.zip |  | ||||||
|   unzip love-$VER-win$BITS.zip |  | ||||||
|   cd - |  | ||||||
| fi |  | ||||||
| mkdir win && cd win |  | ||||||
| cp -r ../../.cache/love-$VER-win$BITS/* . |  | ||||||
| cat love.exe ../game.love > game.exe |  | ||||||
| rm love.exe lovec.exe *.ico *.txt |  | ||||||
| zip -r ../win.zip * |  | ||||||
| cd .. |  | ||||||
| rm -r win |  | ||||||
| 
 |  | ||||||
| echo Linux packaging |  | ||||||
| if [ ! -e ../.cache/love-$VER-$ARCH.AppImage ]; then |  | ||||||
|   cd ../.cache |  | ||||||
|   wget https://github.com/love2d/love/releases/download/$VER/love-$VER-$ARCH.AppImage |  | ||||||
|   chmod a+x love-$VER-$ARCH.AppImage |  | ||||||
|   cd - |  | ||||||
| fi |  | ||||||
| if [ ! -e ../.cache/appimagetool-$ARCH.AppImage ]; then |  | ||||||
|   cd ../.cache |  | ||||||
|   wget https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-$ARCH.AppImage |  | ||||||
|   chmod a+x appimagetool-$ARCH.AppImage |  | ||||||
|   cd - |  | ||||||
| fi |  | ||||||
| mkdir lin && cd lin |  | ||||||
| ../../.cache/love-$VER-$ARCH.AppImage --appimage-extract > /dev/null |  | ||||||
| cd squashfs-root |  | ||||||
| cat ../../game.love >> bin/love |  | ||||||
| chmod a+x bin/love |  | ||||||
| cd .. |  | ||||||
| ../../.cache/appimagetool-$ARCH.AppImage squashfs-root ../linux.AppImage > /dev/null |  | ||||||
| rm -r squashfs-root |  | ||||||
| chmod a+x ../linux.AppImage |  | ||||||
| cd .. |  | ||||||
| rm -r lin |  | ||||||
| 
 |  | ||||||
|  | @ -3,51 +3,33 @@ return function(ll) | ||||||
| ll.mdir = nil | ll.mdir = nil | ||||||
| ll.mgme = nil | ll.mgme = nil | ||||||
| 
 | 
 | ||||||
| if love.getVersion() >= 12 then | local ffi = require 'ffi' | ||||||
|   function ll._mntdir(dir) | ffi.cdef [[ | ||||||
|     return love.filesystem.mountFullPath(dir, '/') |  | ||||||
|   end |  | ||||||
|   function ll._umntdir(dir) |  | ||||||
|     love.filesystem.unmountFullPath(dir) |  | ||||||
|   end |  | ||||||
| else |  | ||||||
|   local ffi = require 'ffi' |  | ||||||
|   local liblove = ffi.os == 'Windows' |  | ||||||
|     and ffi.load 'love' |  | ||||||
|     or ffi.C -- thanks to slime73, Love2D developer :) |  | ||||||
| 
 |  | ||||||
|   ffi.cdef [[ |  | ||||||
|   int PHYSFS_mount(const char *, const char *, int); |   int PHYSFS_mount(const char *, const char *, int); | ||||||
|   int PHYSFS_unmount(const char *);]] |   int PHYSFS_unmount(const char *); | ||||||
| 
 | ]] | ||||||
|   -- FIXME: Bug may appear in Linux. Recompile Love2D or use official PPA. |  | ||||||
|   function ll._mntdir(dir) |  | ||||||
|     return liblove.PHYSFS_mount(dir, '/', 0) ~= 0 |  | ||||||
|   end |  | ||||||
|   function ll._umntdir(dir) |  | ||||||
|     liblove.PHYSFS_unmount(dir) |  | ||||||
|   end |  | ||||||
| end |  | ||||||
| 
 | 
 | ||||||
| local baseReq = '?.lua;?/init.lua;' | local baseReq = '?.lua;?/init.lua;' | ||||||
| function ll.mount(gme) | function ll.mount(gme) | ||||||
|   local mdir = gme.base .. gme.dir |   local mdir = gme.base .. gme.dir | ||||||
|  |   ll.mgme = gme | ||||||
| 
 | 
 | ||||||
|   love.filesystem.setRequirePath( |   love.filesystem.setRequirePath('' | ||||||
|        mdir .. '/?.lua;' |     .. mdir .. '/?.lua;' | ||||||
|     .. mdir .. '/?/init.lua;' |     .. mdir .. '/?/init.lua;' | ||||||
|     .. baseReq |     .. baseReq | ||||||
|   ) |   ) | ||||||
|   if ll._mntdir(mdir) |   -- FIXME: Bug may appear in Linux. Recompile Love2D or use official PPA. | ||||||
|   then ll.mdir, ll.mgme = mdir, gme |   if ffi.C.PHYSFS_mount(mdir, '/', 0) == 0 | ||||||
|   else error('Cannot mount '..mdir) |   then error('Cannot mount '..mdir) | ||||||
|     love.filesystem.setRequirePath(baseReq) |     love.filesystem.setRequirePath(baseReq) | ||||||
|  |   else ll.mdir = mdir | ||||||
|   end |   end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function ll.umount() | function ll.umount() | ||||||
|   if ll.mdir ~= nil then |   if ll.mdir ~= nil then | ||||||
|     ll._umntdir(ll.mdir) |     ffi.C.PHYSFS_unmount(ll.mdir) | ||||||
|     ll.mdir = nil |     ll.mdir = nil | ||||||
|   end |   end | ||||||
| end | end | ||||||
|  |  | ||||||
							
								
								
									
										41
									
								
								lib/keyb.lua
									
										
									
									
									
								
							
							
						
						
									
										41
									
								
								lib/keyb.lua
									
										
									
									
									
								
							|  | @ -1,14 +1,13 @@ | ||||||
| return function(ll) | return function(ll) | ||||||
| 
 | 
 | ||||||
| local mx, my, mb, mpb | local mx, my, mb, mpb | ||||||
| local dir, sc1, sc2, sclm1, sclm2 | local dir, sc1, sc2, sclm | ||||||
| 
 | 
 | ||||||
| -- d   - direction (h, v, x, y, *) | -- d   - direction (h, v, x, y, *) | ||||||
| -- c1  - coordinate before card (mouse) (be left or top) | -- c1  - coordinate before card (mouse) (be left or top) | ||||||
| -- c2  - coordinate after  card (mouse) (be right or bottom) | -- c2  - coordinate after  card (mouse) (be right or bottom) | ||||||
| -- clim1 - other coordinate limit before (mouse) (set -1 to disable) | -- clm - other coordinate limit (mouse) (set -1 to disable) | ||||||
| -- clim2 - other coordinate limit after  (mouse) (set -1 to disable) | function ll.kbInit(d, c1, c2, clim) | ||||||
| function ll.kbInit(d, c1, c2, clim1, clim2) |  | ||||||
|   if d == 'h' or d == 'v' or d == '*' |   if d == 'h' or d == 'v' or d == '*' | ||||||
|   then dir = d |   then dir = d | ||||||
|   elseif d == 'y' |   elseif d == 'y' | ||||||
|  | @ -18,37 +17,19 @@ function ll.kbInit(d, c1, c2, clim1, clim2) | ||||||
|   else error 'Direction must be *, h (x) or v (y)' |   else error 'Direction must be *, h (x) or v (y)' | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ll.kbSetCC(c1, c2) |  | ||||||
|   ll.kbSetOC(clim1, clim2) |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| -- set card coordinate |  | ||||||
| -- c1    - coordinate before card (mouse) (be left or top) |  | ||||||
| -- c2    - coordinate after  card (mouse) (be right or bottom) |  | ||||||
| function ll.kbSetCC(c1, c2) |  | ||||||
|   c1, c2 = |   c1, c2 = | ||||||
|     tonumber(c1) or 0, |     tonumber(c1) or 0, | ||||||
|     tonumber(c2) or 0 |     tonumber(c2) or 0 | ||||||
| 
 |   sc1, sc2, sclm = | ||||||
|   sc1, sc2 = |  | ||||||
|     math.min(c1, c2), |     math.min(c1, c2), | ||||||
|     math.max(c1, c2) |     math.max(c1, c2), | ||||||
| end |     tonumber(clim) or -1 | ||||||
| 
 |  | ||||||
| -- set other coordinate limit |  | ||||||
| -- clim1 - other coordinate limit before (mouse) (set -1 to disable) |  | ||||||
| -- clim2 - other coordinate limit after  (mouse) (set -1 to disable) |  | ||||||
| function ll.kbSetOC(clim1, clim2) |  | ||||||
|   sclm1, sclm2 = |  | ||||||
|     tonumber(clim1) or -1, |  | ||||||
|     tonumber(clim2) or -1 |  | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| -- returns: <, >, o, m, nil | -- returns: <, >, o, m, nil | ||||||
| -- ^ and v if dir is * | -- ^ and v if dir is * | ||||||
| function ll.kbGet() | function ll.kbGet() | ||||||
|   assert(dir, 'Call ll.kbInit() before') |   assert(dir, 'Call ll.kbInit(dir, coord1, coord2, coordlimit) before') | ||||||
|   assert(love, 'Use it with LÖVE engine') |  | ||||||
|   mx, my = love.mouse.getPosition() |   mx, my = love.mouse.getPosition() | ||||||
|   mpb = mb |   mpb = mb | ||||||
|   if love.mouse.isDown(1) then mb = 1 |   if love.mouse.isDown(1) then mb = 1 | ||||||
|  | @ -73,10 +54,9 @@ function ll.kbGet() | ||||||
|   elseif love.keyboard.isDown 'menu' |   elseif love.keyboard.isDown 'menu' | ||||||
|   then return 'm' |   then return 'm' | ||||||
| 
 | 
 | ||||||
|   elseif mb == 0 and mpb == 1 then -- mouse unpressed |   elseif mb == 0 and mpb == 1 then -- unpressed | ||||||
|     if dir == 'h' then |     if dir == 'h' then | ||||||
|     if  (sclm1 < 0 or my  > sclm1) |     if sclm < 0 or my <= sclm then | ||||||
|     and (sclm2 < 0 or my <= sclm2) then |  | ||||||
|       if mx <= sc1 |       if mx <= sc1 | ||||||
|       then return '<' |       then return '<' | ||||||
|       elseif mx >= sc2 |       elseif mx >= sc2 | ||||||
|  | @ -85,8 +65,7 @@ function ll.kbGet() | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|     else |     else | ||||||
|     if  (sclm1 < 0 or mx  > sclm1) |     if sclm < 0 or mx <= sclm then | ||||||
|     and (sclm2 < 0 or mx <= sclm2) then |  | ||||||
|       if my <= sc1 |       if my <= sc1 | ||||||
|       then return '<' |       then return '<' | ||||||
|       elseif my >= sc2 |       elseif my >= sc2 | ||||||
|  |  | ||||||
							
								
								
									
										15
									
								
								lib/main.lua
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								lib/main.lua
									
										
									
									
									
								
							|  | @ -6,31 +6,22 @@ ll.cfg = { | ||||||
| 
 | 
 | ||||||
| require 'lib.fs'     (ll) | require 'lib.fs'     (ll) | ||||||
| require 'lib.game'   (ll) | require 'lib.game'   (ll) | ||||||
| if love then | require 'lib.chroot' (ll) | ||||||
|   require 'lib.chroot' (ll) | require 'lib.load'   (ll) | ||||||
|   -- TODO: CLI interface? | require 'lib.keyb'   (ll) | ||||||
|   require 'lib.load'   (ll) |  | ||||||
| end |  | ||||||
| require 'lib.keyb'     (ll) -- except ll.kbGet() |  | ||||||
| 
 | 
 | ||||||
| function ll.home() | function ll.home() | ||||||
|   if not love then return end |  | ||||||
|   ll.umount() |   ll.umount() | ||||||
|   love.event.push('quit', 'restart') |   love.event.push('quit', 'restart') | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| ll.dt = false | ll.dt = false | ||||||
| function ll.devtools() | function ll.devtools() | ||||||
|   if not love then return end |  | ||||||
| 
 |  | ||||||
|   if not ll.dt then |   if not ll.dt then | ||||||
|     ll.dt = true |     ll.dt = true | ||||||
|     __LL = ll |     __LL = ll | ||||||
|     pcall(function() require 'dev.tools' end) |     pcall(function() require 'dev.tools' end) | ||||||
|     return true |  | ||||||
|   end |   end | ||||||
|   return false |  | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| return ll | return ll | ||||||
| 
 |  | ||||||
|  |  | ||||||
							
								
								
									
										29
									
								
								ll-min.lua
									
										
									
									
									
								
							
							
						
						
									
										29
									
								
								ll-min.lua
									
										
									
									
									
								
							|  | @ -1,35 +1,13 @@ | ||||||
| -- Minimal Love Loader API | -- Minimal Love Loader API | ||||||
| -- Version 3.0 | -- Version 2.1 | ||||||
| -- (c) Er2 2022 <er2@dismail.de> | -- (c) Er2 2022 <er2@dismail.de> | ||||||
| -- Zlib License | -- Zlib License | ||||||
| 
 | 
 | ||||||
| if not llUsed then | if not llUsed then | ||||||
| 
 | 
 | ||||||
| COLDIV = love.getVersion() == 0 and 1 or 255 | COLDIV = love.getVersion() == 0 and 1 or 255 | ||||||
| if love.system | MOBILE = love.system.getOS() == 'Android' | ||||||
| then MOBILE = love.system.getOS() == 'Android' |  | ||||||
|   or love.system.getOS() == 'iOS' |   or love.system.getOS() == 'iOS' | ||||||
| else MOBILE = false |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function llHome() |  | ||||||
|   love.event.push('quit', 'restart') |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| if love.getVersion() >= 12 then |  | ||||||
|   function love.graphics.stencil(fn) |  | ||||||
|     love.graphics.setColorMask(false) |  | ||||||
|     love.graphics.setStencilMode('replace', 'always', 1) |  | ||||||
|     fn() |  | ||||||
|     love.graphics.setColorMask(true) |  | ||||||
|   end |  | ||||||
|   function love.graphics.setStencilTest(cmp, val) |  | ||||||
|     if cmp |  | ||||||
|     then love.graphics.setStencilMode('keep', cmp, val) |  | ||||||
|     else love.graphics.setStencilMode() |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| end |  | ||||||
| 
 | 
 | ||||||
| if MOBILE | if MOBILE | ||||||
| then love.window.setFullscreen(true) | then love.window.setFullscreen(true) | ||||||
|  | @ -44,6 +22,9 @@ function love.resize(x, y) | ||||||
| end | end | ||||||
| love.resize(love.graphics.getDimensions()) | love.resize(love.graphics.getDimensions()) | ||||||
| 
 | 
 | ||||||
|  | function llHome() | ||||||
|  |   love.event.push('quit') | ||||||
|  | end | ||||||
| function love.event.quit() | function love.event.quit() | ||||||
|   llHome() |   llHome() | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,9 +1,6 @@ | ||||||
| return { | return { | ||||||
|   entry = { |   entry = 'main.lua', | ||||||
|     'main.lua', |   output = 'build/main.lua', | ||||||
|     'll-min.lua', |  | ||||||
|   }, |  | ||||||
|   output = 'build/$name.lua', |  | ||||||
|   plug = { |   plug = { | ||||||
|     require 'plug.minify' { |     require 'plug.minify' { | ||||||
|       extGlob = { |       extGlob = { | ||||||
|  |  | ||||||
							
								
								
									
										38
									
								
								main.lua
									
										
									
									
									
								
							
							
						
						
									
										38
									
								
								main.lua
									
										
									
									
									
								
							|  | @ -1,10 +1,7 @@ | ||||||
| local ll = require 'lib.main' | local ll = require 'lib.main' | ||||||
| error = love.errhand or love.errorhandler | error = love.errhand or love.errorhandler | ||||||
| 
 | 
 | ||||||
| ll.skin = require 'skins.nx' (ll) |  | ||||||
| 
 |  | ||||||
| function splash() | function splash() | ||||||
|   if not ll.mgme then return end |  | ||||||
|   love.graphics.setColor(255, 255, 255, 100 / COLDIV) |   love.graphics.setColor(255, 255, 255, 100 / COLDIV) | ||||||
|   if ll.mgme.screens and ll.mgme.screens[1] then |   if ll.mgme.screens and ll.mgme.screens[1] then | ||||||
|     local img = love.graphics.newImage(ll.mgme.screens[1]) |     local img = love.graphics.newImage(ll.mgme.screens[1]) | ||||||
|  | @ -14,26 +11,16 @@ function splash() | ||||||
|   love.graphics.print('Loading '..ll.mgme.name, W / 2, H / 2) |   love.graphics.print('Loading '..ll.mgme.name, W / 2, H / 2) | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | ll.skin = require 'skins.psp' (ll) | ||||||
|  | 
 | ||||||
| require 'll-min' | require 'll-min' | ||||||
| llUsed = true | llUsed = true | ||||||
| 
 | 
 | ||||||
| if love.getVersion() >= 12 then | if love.errorhandler | ||||||
|   function llHome() |  | ||||||
|     ll.umount() |  | ||||||
|     love.event.restart() |  | ||||||
|   end |  | ||||||
| else |  | ||||||
|   function llHome() |  | ||||||
|     ll.umount() |  | ||||||
|     love.event.push('quit', 'restart') |  | ||||||
|   end |  | ||||||
| end |  | ||||||
| if love.getVersion() >= 11 |  | ||||||
| then love.errorhandler = error | then love.errorhandler = error | ||||||
| else love.errhand = error | else love.errhand = error | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| local dt = love.timer and love.timer.step() or 0 |  | ||||||
| local brk = false | local brk = false | ||||||
| while not brk and not ll.mdir do | while not brk and not ll.mdir do | ||||||
|   -- event handling |   -- event handling | ||||||
|  | @ -44,29 +31,12 @@ while not brk and not ll.mdir do | ||||||
|     then ll.umount() |     then ll.umount() | ||||||
|       love.event.push('quit') |       love.event.push('quit') | ||||||
|       brk = true; break |       brk = true; break | ||||||
|     elseif n == 'filedropped' then |  | ||||||
|       love.graphics.clear() |  | ||||||
|       local x, y, g = 32, 32, 16 |  | ||||||
|       local w, h = 84, 96 |  | ||||||
|       love.graphics.rectangle('line', x, y, w, h, w / 8) |  | ||||||
|       love.graphics.line(x + w / 1.5, y, x + w, y + h / 3) |  | ||||||
|       if ll.skin.addGame then |  | ||||||
|         a:open 'r' |  | ||||||
|         ll.skin.addGame(a:getFilename(), a:read(), x + w + g, y) |  | ||||||
|       else love.graphics.print('This skin does not support file dropping', x + w + g, y) |  | ||||||
|       end |  | ||||||
|       love.graphics.present() |  | ||||||
|       love.timer.sleep(2) |  | ||||||
|     end |     end | ||||||
|     love.handlers[n](a,b,c) |     love.handlers[n](a,b,c) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   -- update and drawing |   -- update and drawing | ||||||
|   if love.timer then |   ll.skin.update() | ||||||
|     love.timer.step() |  | ||||||
|     dt = love.timer.getDelta() |  | ||||||
|   end |  | ||||||
|   ll.skin.update(dt) |  | ||||||
|   love.graphics.origin() |   love.graphics.origin() | ||||||
|   love.graphics.clear(0, 0, 0) |   love.graphics.clear(0, 0, 0) | ||||||
|   ll.skin.draw() |   ll.skin.draw() | ||||||
|  |  | ||||||
|  | @ -86,11 +86,6 @@ local function ccp() | ||||||
|          return '' |          return '' | ||||||
|     else return 'Not found' |     else return 'Not found' | ||||||
|     end |     end | ||||||
|   elseif cmd == 'devtools' then |  | ||||||
|     if ll.devtools() |  | ||||||
|     then return 'Enabled' |  | ||||||
|     else return 'Already enabled' |  | ||||||
|     end |  | ||||||
|   else return 'Unknown command "'.. cmd .. '"' |   else return 'Unknown command "'.. cmd .. '"' | ||||||
|   end |   end | ||||||
| end | end | ||||||
|  | @ -122,7 +117,6 @@ local function update() | ||||||
|   end |   end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| local oy = 0 |  | ||||||
| local utf8 = require 'utf8' | local utf8 = require 'utf8' | ||||||
| local function draw() | local function draw() | ||||||
|   love.graphics.setColor(255, 255, 255) |   love.graphics.setColor(255, 255, 255) | ||||||
|  | @ -138,18 +132,15 @@ local function draw() | ||||||
|     then x = x + 8 - (x % 8) |     then x = x + 8 - (x % 8) | ||||||
|     elseif chr == '\v' |     elseif chr == '\v' | ||||||
|     then y = y + 1 |     then y = y + 1 | ||||||
|     else love.graphics.print(chr, x * cw, y * ch - oy) |     else love.graphics.print(chr, x * cw, y * ch) | ||||||
|       if x >= ctw |       if x >= ctw | ||||||
|       then x, y = x - ctw, y + 1 |       then x, y = x - ctw, y + 1 | ||||||
|       else x = x + 1 |       else x = x + 1 | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   if y * ch - oy >= H |  | ||||||
|   then oy = oy + H / 4 |  | ||||||
|   end |  | ||||||
|   if os.time() % 2 == 0 |   if os.time() % 2 == 0 | ||||||
|   then love.graphics.rectangle('fill', x * cw, y * ch - oy, cw, ch) |   then love.graphics.rectangle('fill', x * cw, y * ch, cw, ch) | ||||||
|   end |   end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| return function(ll) | return function(ll) | ||||||
| 
 | 
 | ||||||
| ll.cfg.pcht = ll.cfg.pcht or 60 * 10 | ll.cfg.pcht = ll.cfg.pcht or 60 * 5 | ||||||
| 
 | 
 | ||||||
| local pikchv, pikcha = 0, 0 | local pikchv, pikcha = 0, 0 | ||||||
| local pikchao = math.floor(1 / ll.cfg.pcht * 2 * 255 + 0.5) | local pikchao = math.floor(1 / ll.cfg.pcht * 2 * 255 + 0.5) | ||||||
| local bg = 0 |  | ||||||
| 
 | 
 | ||||||
| local cx, cy, cw, ch | local cx, cy, cw, ch | ||||||
| local f, bf | local f, bf | ||||||
|  | @ -26,7 +25,7 @@ function resize() | ||||||
|   ll.kbInit('h', cx, cx + cw) |   ll.kbInit('h', cx, cx + cw) | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| local function update(dt) | local function update() | ||||||
|   local sdi = ll.kbGet() |   local sdi = ll.kbGet() | ||||||
| 
 | 
 | ||||||
|   if cdir ~= sdi then |   if cdir ~= sdi then | ||||||
|  | @ -47,8 +46,8 @@ local function update(dt) | ||||||
|     if sel > #ll.games then sel = 1 end |     if sel > #ll.games then sel = 1 end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   pikchv = pikchv + dt |   pikchv = pikchv + 1 | ||||||
|   if pikchv >= ll.cfg.pcht / 100 then |   if pikchv >= ll.cfg.pcht then | ||||||
|     pikchv = 0 |     pikchv = 0 | ||||||
|     pikcha = 0 |     pikcha = 0 | ||||||
|     for _, v in pairs(ll.games) do |     for _, v in pairs(ll.games) do | ||||||
|  | @ -60,12 +59,11 @@ local function update(dt) | ||||||
|         end |         end | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|   else pikcha = math.min(255, pikcha + pikchao * 100 * dt) |   else pikcha = math.min(255, pikcha + pikchao) | ||||||
|   end |   end | ||||||
| 
 |  | ||||||
|   bg = (bg + dt) % 6.28 |  | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | local tm = 0 | ||||||
| local function draw() | local function draw() | ||||||
|   love.graphics.setColor(0 / COLDIV, 50 / COLDIV, 75 / COLDIV) |   love.graphics.setColor(0 / COLDIV, 50 / COLDIV, 75 / COLDIV) | ||||||
|   love.graphics.rectangle('fill', 0, 0, W, H) |   love.graphics.rectangle('fill', 0, 0, W, H) | ||||||
|  | @ -76,7 +74,8 @@ local function draw() | ||||||
|   local tw, th = bf:getWidth(t), bf:getHeight(t) |   local tw, th = bf:getWidth(t), bf:getHeight(t) | ||||||
|   love.graphics.print(t, W - tw - 8, H - th) |   love.graphics.print(t, W - tw - 8, H - th) | ||||||
| 
 | 
 | ||||||
|   local c, pc, ps = bg, math.cos(bg), math.sin(bg) |   tm = (tm + 0.02) % 6.28 | ||||||
|  |   local c, pc, ps = tm, math.cos(tm), math.sin(tm) | ||||||
|   local oy = H / 2 |   local oy = H / 2 | ||||||
|   for x = 0, W + 8, 8 do |   for x = 0, W + 8, 8 do | ||||||
|     c = c + 0.1 |     c = c + 0.1 | ||||||
|  |  | ||||||
							
								
								
									
										71
									
								
								skins/nx.lua
									
										
									
									
									
								
							
							
						
						
									
										71
									
								
								skins/nx.lua
									
										
									
									
									
								
							|  | @ -1,71 +0,0 @@ | ||||||
| return function(ll) |  | ||||||
| 
 |  | ||||||
| -- Nintendo NX (AKA Switch) UI |  | ||||||
| 
 |  | ||||||
| local r |  | ||||||
| 
 |  | ||||||
| os.setlocale('', 'time') |  | ||||||
| 
 |  | ||||||
| function resize() |  | ||||||
|   r = math.min(W, H) / 30 |  | ||||||
| 
 |  | ||||||
|   f = love.graphics.setNewFont(math.min(W, H) / 30) |  | ||||||
|   bf = love.graphics.newFont(math.min(W, H) / 20) |  | ||||||
| 
 |  | ||||||
|   --ll.kbInit('h', H / 2 - ch, H / 2 + ch + cg, 0, cx + cw * 2) |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| local function update(dt) |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| local function roundRect(m, x, y, w, h, r) |  | ||||||
|   if w < 1 or h < 1 then return end |  | ||||||
| 
 |  | ||||||
|   love.graphics.rectangle(m, x, y, w, h, r) |  | ||||||
| 
 |  | ||||||
|   if m == 'fill' |  | ||||||
|   then roundRect('line', x, y, w, h, r) |  | ||||||
|   end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| local function draw() |  | ||||||
|   love.graphics.setColor(0 / COLDIV, 50 / COLDIV, 75 / COLDIV) |  | ||||||
|   love.graphics.rectangle('fill', 0, 0, W, H) |  | ||||||
|   love.graphics.setColor(255, 255, 255) |  | ||||||
|   -- Indicators |  | ||||||
|   love.graphics.push() |  | ||||||
|   love.graphics.translate(W - W / 16, H / 16) |  | ||||||
|   love.graphics.setLineWidth(r / 8) |  | ||||||
|   local pst, pper = love.system.getPowerInfo() |  | ||||||
|   if pst ~= 'nobattery' then |  | ||||||
|     pper = pper or 0 |  | ||||||
|     if pst == 'charging' |  | ||||||
|     then pper = os.time() % 5 / 4 * 100 |  | ||||||
|     end |  | ||||||
|     roundRect('line', -r * 2.2, 0, r * 2, r * 1.2, r / 4) |  | ||||||
|     roundRect('fill', -r / 6, r * 0.3, r / 4, r / 2, r / 16) |  | ||||||
|     roundRect('fill', -r * 1.95, r * 0.3, r * 1.5 * pper / 100, r * 0.6, r / 16) |  | ||||||
|     love.graphics.translate(-r * 2.8, 0) |  | ||||||
|   end |  | ||||||
|   local time = os.date('%X'):gsub('^(%d+.+%d+).+%d+', '%1') |  | ||||||
|   local w = f:getWidth(time) |  | ||||||
|   love.graphics.print(time, -w, -2) |  | ||||||
|   love.graphics.pop() |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| local function addGame(file, cont, x, y) |  | ||||||
|   local msg, id = ll.addGame(file, cont) |  | ||||||
|   love.graphics.print(msg, x, y) |  | ||||||
|   if id then |  | ||||||
|     sel = id |  | ||||||
|   end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| return { |  | ||||||
|   update = update, |  | ||||||
|   draw = draw, |  | ||||||
|   addGame = addGame, |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
|  | @ -10,7 +10,7 @@ local css, rcss = 2, 0 | ||||||
| 
 | 
 | ||||||
| local f, bf | local f, bf | ||||||
| 
 | 
 | ||||||
| ll.cfg.pcht = ll.cfg.pcht or 60 * 10 | ll.cfg.pcht = ll.cfg.pcht or 60 * 5 | ||||||
| 
 | 
 | ||||||
| local pikchv, pikcha = 0, 0 | local pikchv, pikcha = 0, 0 | ||||||
| local pikchao = math.floor(1 / ll.cfg.pcht * 2 * 255 + 0.5) | local pikchao = math.floor(1 / ll.cfg.pcht * 2 * 255 + 0.5) | ||||||
|  | @ -18,8 +18,6 @@ local pikchao = math.floor(1 / ll.cfg.pcht * 2 * 255 + 0.5) | ||||||
| local logger = '' | local logger = '' | ||||||
| local chc = '<>><m><' | local chc = '<>><m><' | ||||||
| 
 | 
 | ||||||
| os.setlocale('', 'time') |  | ||||||
| 
 |  | ||||||
| function resize() | function resize() | ||||||
|   r = math.min(W, H) / 30 |   r = math.min(W, H) / 30 | ||||||
| 
 | 
 | ||||||
|  | @ -32,14 +30,16 @@ function resize() | ||||||
|   f = love.graphics.setNewFont(math.min(W, H) / 30) |   f = love.graphics.setNewFont(math.min(W, H) / 30) | ||||||
|   bf = love.graphics.newFont(math.min(W, H) / 20) |   bf = love.graphics.newFont(math.min(W, H) / 20) | ||||||
| 
 | 
 | ||||||
|   ll.kbInit('v', H / 2 - ch, H / 2 + ch + cg, 0, cx + cw * 2) |   ll.kbInit('v', H / 2 - ch, H / 2 + ch + cg, cx + cw * 2) | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | love.window.setMode(800, 600, {resizable = true}) | ||||||
|  | 
 | ||||||
| local sdir | local sdir | ||||||
| local function update(dt) | local function update() | ||||||
|   local ty = H / 2 - (ch + cg) * sel |   local ty = H / 2 - (ch + cg) * sel | ||||||
|   cy   = cy  + (ty - cy) *  5 * dt |   cy   = cy  + (ty - cy) * 0.1 | ||||||
|   css  = css + (2 - css) * 15 * dt |   css  = css + (2 - css) * 0.2 | ||||||
|   rcss = 2 - css + 1 |   rcss = 2 - css + 1 | ||||||
| 
 | 
 | ||||||
|   local sdi = ll.kbGet() |   local sdi = ll.kbGet() | ||||||
|  | @ -68,9 +68,10 @@ local function update(dt) | ||||||
|     if sel > #ll.games then sel = 1 end |     if sel > #ll.games then sel = 1 end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   pikchv = pikchv + dt |   pikchv = pikchv + 1 | ||||||
|   if pikchv >= ll.cfg.pcht / 100 then |   if pikchv >= ll.cfg.pcht then | ||||||
|     pikchv, pikcha = 0, 0 |     pikchv = 0 | ||||||
|  |     pikcha = 0 | ||||||
|     for _, v in pairs(ll.games) do |     for _, v in pairs(ll.games) do | ||||||
|       if v.dat.scr then |       if v.dat.scr then | ||||||
|         v.scrprv = v.scrcur |         v.scrprv = v.scrcur | ||||||
|  | @ -80,7 +81,7 @@ local function update(dt) | ||||||
|         end |         end | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|   else pikcha = math.min(255, pikcha + pikchao * 100 * dt) |   else pikcha = math.min(255, pikcha + pikchao) | ||||||
|   end |   end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | @ -95,16 +96,6 @@ local function scrCard(gme, x, y, w, h, a) | ||||||
|   love.graphics.rectangle('fill', x, y, w, h) |   love.graphics.rectangle('fill', x, y, w, h) | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| local function roundRect(m, x, y, w, h, r) |  | ||||||
|   if w < 1 or h < 1 then return end |  | ||||||
| 
 |  | ||||||
|   love.graphics.rectangle(m, x, y, w, h, r) |  | ||||||
| 
 |  | ||||||
|   if m == 'fill' |  | ||||||
|   then roundRect('line', x, y, w, h, r) |  | ||||||
|   end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| local function draw() | local function draw() | ||||||
|   love.graphics.setColor(0 / COLDIV, 50 / COLDIV, 75 / COLDIV) |   love.graphics.setColor(0 / COLDIV, 50 / COLDIV, 75 / COLDIV) | ||||||
|   love.graphics.rectangle('fill', 0, 0, W, H) |   love.graphics.rectangle('fill', 0, 0, W, H) | ||||||
|  | @ -118,28 +109,6 @@ local function draw() | ||||||
|     sel = #ll.games |     sel = #ll.games | ||||||
|   end |   end | ||||||
|   love.graphics.setFont(f) |   love.graphics.setFont(f) | ||||||
| 
 |  | ||||||
|   -- battery indicators |  | ||||||
|   love.graphics.setColor(255, 255, 255) |  | ||||||
|   love.graphics.push() |  | ||||||
|   love.graphics.translate(W - r * 1.5, r) |  | ||||||
|   love.graphics.setLineWidth(r / 8) |  | ||||||
|   local pst, pper = love.system.getPowerInfo() |  | ||||||
|   if pst ~= 'nobattery' then |  | ||||||
|     pper = pper or 0 |  | ||||||
|     if pst == 'charging' |  | ||||||
|     then pper = os.time() % 5 / 4 * 100 |  | ||||||
|     end |  | ||||||
|     roundRect('line', -r * 2.2, 0, r * 2, r * 1.2, r / 4) |  | ||||||
|     roundRect('fill', -r / 6, r * 0.3, r / 4, r / 2, r / 16) |  | ||||||
|     roundRect('fill', -r * 1.95, r * 0.3, r * 1.5 * pper / 100, r * 0.6, r / 16) |  | ||||||
|     love.graphics.translate(-r * 2.8, 0) |  | ||||||
|   end |  | ||||||
|   local time = os.date('%X'):gsub('^(%d+.+%d+).+%d+', '%1') |  | ||||||
|   local w = f:getWidth(time) |  | ||||||
|   love.graphics.print(time, -w, -2) |  | ||||||
|   love.graphics.pop() |  | ||||||
| 
 |  | ||||||
|   local oy = 0 |   local oy = 0 | ||||||
|   for k, v in pairs(ll.games) do |   for k, v in pairs(ll.games) do | ||||||
|     local x, w, h, g = cx, cw, ch, cg |     local x, w, h, g = cx, cw, ch, cg | ||||||
|  | @ -182,18 +151,9 @@ local function draw() | ||||||
|   end |   end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| local function addGame(file, cont, x, y) |  | ||||||
|   local msg, id = ll.addGame(file, cont) |  | ||||||
|   love.graphics.print(msg, x, y) |  | ||||||
|   if id then |  | ||||||
|     sel = id |  | ||||||
|   end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| return { | return { | ||||||
|   update = update, |   update = update, | ||||||
|   draw = draw, |   draw = draw, | ||||||
|   addGame = addGame, |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| end | end | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue