forked from hkc/cc-stuff
Improved small screen support
also added jump to top/bottom/current also added cleanup code
This commit is contained in:
parent
bbede80038
commit
77c6d13689
|
@ -62,7 +62,7 @@ if not drive then
|
|||
printError("No drive found, starting in dummy mode")
|
||||
local fp = io.open("noita.dfpwm", "rb")
|
||||
if fp == nil then
|
||||
printError("No sample file found, are you running it on a real* computer without a tape drive?")
|
||||
printError("No sample file found, are you running it on a real computer without a tape drive?")
|
||||
return
|
||||
end
|
||||
local size = fp:seek("end", 0)
|
||||
|
@ -126,38 +126,38 @@ local help = {}
|
|||
|
||||
for line in ([[# Movement:
|
||||
--
|
||||
Up k : Move cursor up
|
||||
Down j : Move cursor down
|
||||
H : Move cursor to the top of screen
|
||||
L : Move cursor to the bottom of screen
|
||||
PageUp : Page up
|
||||
PageDown : Page down
|
||||
|
||||
Tab : Next screen
|
||||
Shift+Tab : Previous screen
|
||||
Up k : Move cursor up
|
||||
Dn j : Move cursor down
|
||||
H : Jump to top
|
||||
L : Jump down
|
||||
PgUp : Page up
|
||||
PgDn : Page down
|
||||
|
||||
1 F1 h : Help screen (this one)
|
||||
2 F2 : Songs list
|
||||
3 F3 : Options screen
|
||||
Tab : Next screen
|
||||
S+Tab : Prev. screen
|
||||
|
||||
1 F1 : Help screen
|
||||
2 F2 : Songs list
|
||||
3 F3 : Settings
|
||||
|
||||
# Global:
|
||||
--
|
||||
s : Stop and seek to the beginning
|
||||
p : Pause/resume
|
||||
< : Next track
|
||||
> : Previous track
|
||||
f : Seek forward
|
||||
b : Seek backward
|
||||
Left - : Decrease volume
|
||||
Right + : Increase volume
|
||||
s : Stop, jump to start
|
||||
p : Pause/resume
|
||||
< : Next track
|
||||
> : Previous track
|
||||
f : Seek forward
|
||||
b : Seek backward
|
||||
\x11 - : Lower volume
|
||||
\x10 + : Higher volume
|
||||
|
||||
# List screen:
|
||||
--
|
||||
Enter : Play
|
||||
Ctrl+l : Center
|
||||
l : Jump to current track
|
||||
Enter : Play
|
||||
Ctrl+l : Center
|
||||
l : Jump to current
|
||||
|
||||
]]):gmatch("[^\n]+") do
|
||||
]]):gsub("\\x11", "\x11"):gsub("\\x10", "\x10"):gmatch("[^\n]+") do
|
||||
table.insert(help, line)
|
||||
end
|
||||
|
||||
|
@ -240,6 +240,7 @@ local mplayer = {
|
|||
end
|
||||
end,
|
||||
handleKey = function(self, key, repeating)
|
||||
local shiftHeld = self.heldKeys[keys.leftShift] ~= nil or self.heldKeys[keys.rightShift] ~= nil
|
||||
if key == keys.down or key == keys.j then
|
||||
self.screens[2].handleScroll(self, 1)
|
||||
elseif key == keys.up or key == keys.k then
|
||||
|
@ -248,6 +249,13 @@ local mplayer = {
|
|||
self.screens[2].handleScroll(self, th - 3)
|
||||
elseif key == keys.pageUp then
|
||||
self.screens[2].handleScroll(self, -(th - 3))
|
||||
elseif key == keys.h and shiftHeld then
|
||||
self.screens[2].handleScroll(self, -#self.songs)
|
||||
elseif key == keys.l and shiftHeld then
|
||||
self.screens[2].handleScroll(self, #self.songs)
|
||||
elseif key == keys.l then
|
||||
self.screens[2].cursor = self.currentSong or 1
|
||||
self.screens[2].handleScroll(self, 0, 1, 1)
|
||||
elseif key == keys.enter then
|
||||
drive.seek(-drive.getSize())
|
||||
drive.seek(self.songs[self.screens[2].cursor].offset)
|
||||
|
@ -512,3 +520,16 @@ function()
|
|||
end
|
||||
)
|
||||
|
||||
-- cleanup
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
for i = 1, 16 do
|
||||
local c = math.pow(2, i - 1)
|
||||
term.setPaletteColor(c, term.nativePaletteColor(c))
|
||||
end
|
||||
term.setBackgroundColor(colors.black)
|
||||
term.setTextColor(colors.white)
|
||||
if term.current().setTextScale then
|
||||
term.current.setTextScale(1.0)
|
||||
end
|
||||
print("<tmpc> Goodbye!")
|
||||
|
|
Loading…
Reference in New Issue