add letter on scrollbar in SongWheel
This commit is contained in:
parent
841fb1fa35
commit
a3fa6350c1
|
@ -10,6 +10,7 @@ Project Starter: GSK Bladez
|
||||||
- Hoshikara
|
- Hoshikara
|
||||||
- GSK Bladez
|
- GSK Bladez
|
||||||
- Local
|
- Local
|
||||||
|
- Kuenaimaku
|
||||||
|
|
||||||
## Graphics
|
## Graphics
|
||||||
- GSK Bladez
|
- GSK Bladez
|
||||||
|
|
|
@ -17,6 +17,10 @@ local function splitString(inputstr, sep)
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function firstLetter(str)
|
||||||
|
return str:match("[%z\1-\127\194-\244][\128-\191]*")
|
||||||
|
end
|
||||||
|
|
||||||
local function filter(tableIn, predicate)
|
local function filter(tableIn, predicate)
|
||||||
local out = {}
|
local out = {}
|
||||||
for _, val in ipairs(tableIn) do
|
for _, val in ipairs(tableIn) do
|
||||||
|
@ -30,5 +34,6 @@ end
|
||||||
return {
|
return {
|
||||||
stopMusic = stopMusic,
|
stopMusic = stopMusic,
|
||||||
splitString = splitString,
|
splitString = splitString,
|
||||||
filter = filter
|
filter = filter,
|
||||||
|
firstLetter = firstLetter
|
||||||
}
|
}
|
|
@ -750,6 +750,7 @@ end
|
||||||
function drawScrollbar()
|
function drawScrollbar()
|
||||||
if isFilterWheelActive or transitionLeaveScale ~= 0 then return end
|
if isFilterWheelActive or transitionLeaveScale ~= 0 then return end
|
||||||
|
|
||||||
|
-- Scrollbar Background
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
local resize = 0.85;
|
local resize = 0.85;
|
||||||
local lw, lh = gfx.ImageSize(scrollBarBackgroundImage);
|
local lw, lh = gfx.ImageSize(scrollBarBackgroundImage);
|
||||||
|
@ -759,6 +760,7 @@ function drawScrollbar()
|
||||||
local backgroundYPos = desh/2 - lh/2
|
local backgroundYPos = desh/2 - lh/2
|
||||||
gfx.ImageRect(xPos, backgroundYPos, lw, lh, scrollBarBackgroundImage, 1, 0)
|
gfx.ImageRect(xPos, backgroundYPos, lw, lh, scrollBarBackgroundImage, 1, 0)
|
||||||
|
|
||||||
|
-- Scrollbar Fill
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
local sw, sh = gfx.ImageSize(scrollBarFillImage);
|
local sw, sh = gfx.ImageSize(scrollBarFillImage);
|
||||||
local sw = sw * resize;
|
local sw = sw * resize;
|
||||||
|
@ -770,8 +772,19 @@ function drawScrollbar()
|
||||||
local scrollStep = (maxScrollYPos - minScrollYPos) / (#songwheel.songs - 1);
|
local scrollStep = (maxScrollYPos - minScrollYPos) / (#songwheel.songs - 1);
|
||||||
local scrollbarYOffset = (selectedIndex - 1) * scrollStep;
|
local scrollbarYOffset = (selectedIndex - 1) * scrollStep;
|
||||||
local scrollbarYPos = minScrollYPos + scrollbarYOffset;
|
local scrollbarYPos = minScrollYPos + scrollbarYOffset;
|
||||||
|
gfx.ImageRect(fillXPos, scrollbarYPos, sw, sh, scrollBarFillImage, 1, 0);
|
||||||
|
|
||||||
gfx.ImageRect(fillXPos, scrollbarYPos, sw, sh, scrollBarFillImage, 1, 0)
|
-- 1st letter of song title on scroll
|
||||||
|
local letter = string.upper(common.firstLetter(songwheel.songs[selectedIndex].title));
|
||||||
|
gfx.BeginPath()
|
||||||
|
gfx.FontSize(16)
|
||||||
|
gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
|
||||||
|
gfx.Rect(fillXPos-18, scrollbarYPos - 5, 16, 16)
|
||||||
|
gfx.FillColor(0,0,0,170)
|
||||||
|
gfx.Fill()
|
||||||
|
gfx.FillColor(255,255,255)
|
||||||
|
gfx.TextAlign(gfx.TEXT_ALIGN_MIDDLE + gfx.TEXT_ALIGN_CENTER)
|
||||||
|
gfx.Text(letter, fillXPos-10, scrollbarYPos + 5);
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue