From 5af66b27886d8685735cb8e650e5f1ea3ce062bc Mon Sep 17 00:00:00 2001 From: RealFD Date: Sat, 6 Nov 2021 00:28:19 +0100 Subject: [PATCH] +rounded the meanhit number and abit chalwheel --- scripts/result.lua | 2 +- scripts/songselect/chalwheel.lua | 222 ++++++++----------------------- 2 files changed, 53 insertions(+), 171 deletions(-) diff --git a/scripts/result.lua b/scripts/result.lua index 32589b6..dd02f34 100644 --- a/scripts/result.lua +++ b/scripts/result.lua @@ -514,7 +514,7 @@ local drawBottomPanelContent = function(deltatime) gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE) gfx.Text(result.medianHitDelta.." ms", rightX, baseY); - gfx.Text(result.meanHitDelta.." ms", rightX, baseY + detailTextMargin); + gfx.Text(math.floor(result.meanHitDelta).." ms", rightX, baseY + detailTextMargin); end local drawJacketPanel = function() diff --git a/scripts/songselect/chalwheel.lua b/scripts/songselect/chalwheel.lua index 9159d14..3518fdf 100644 --- a/scripts/songselect/chalwheel.lua +++ b/scripts/songselect/chalwheel.lua @@ -1,3 +1,5 @@ +local DiffRectangle = require("components.diff_rectangle") + --Horizontal alignment TEXT_ALIGN_LEFT = 1 TEXT_ALIGN_CENTER = 2 @@ -56,7 +58,7 @@ local badges = { gfx.CreateSkinImage("song_select/medal/puc.png", 1), } -gfx.LoadSkinFont("NotoSans-Regular.ttf"); +gfx.LoadSkinFont("dfmarugoth.ttf"); game.LoadSkinSample("menu_click") game.LoadSkinSample("click-02") @@ -92,19 +94,6 @@ local fullY = 0 adjustScreen = function(x,y) local a = x/y; - if x >= y and a <= landscapeStandardRatio then - aspectRatio = "landscapeStandard" - aspectFloat = 1.1 - elseif x >= y and landscapeStandardRatio <= a and a <= landscapeWidescreenRatio then - aspectRatio = "landscapeWidescreen" - aspectFloat = 1.2 - elseif x <= y and portraitWidescreenRatio <= a and a < landscapeStandardRatio then - aspectRatio = "PortraitWidescreen" - aspectFloat = 0.5 - else - aspectRatio = "landscapeWidescreen" - aspectFloat = 1.0 - end fifthX = x/5 fourthX= x/4 thirdX = x/3 @@ -123,7 +112,7 @@ check_or_create_cache = function(song, full) if not songCache[song.id] then songCache[song.id] = {} end if not songCache[song.id]["title"] then - songCache[song.id]["title"] = gfx.CreateLabel(song.title, 40, 0) + songCache[song.id]["title"] = gfx.CreateLabel(song.title, 30, 0) end if not songCache[song.id]["chart_names"] then @@ -154,13 +143,13 @@ check_or_create_cache = function(song, full) if not songCache[song.id]["desc"] then local desc = "\n" for _, chart in ipairs(song.charts) do - desc = desc .. " " .. chart.title .. "\n" + desc = desc .. ""..chart.title.."\n\n" end if song.missing_chart then - desc = desc .. " *COULD NOT FIND ALL CHARTS!*\n" + desc = desc .. "*COULD NOT FIND ALL CHARTS!*\n\n" end - desc = desc .. "\n\n" .. song.requirement_text - songCache[song.id]["desc"] = gfx.CreateLabel(desc, 20, 0) + desc = desc .. "" + songCache[song.id]["desc"] = gfx.CreateLabel(desc, 20,0) end end end @@ -184,15 +173,6 @@ draw_scores = function(difficulty, x, y, w, h) if difficulty.scores[1] ~= nil then local highScore = difficulty.scores[1] scoreLabel = gfx.CreateLabel(string.format("%08d",highScore.score), 40, 0) - for i,v in ipairs(grades) do - if v.max > highScore.score then - gfx.BeginPath() - iw,ih = gfx.ImageSize(v.image) - iar = iw / ih; - gfx.ImageRect(x+xOffset,y+h/2 +5, iar * (h/2-10),h/2-10, v.image, 1, 0) - break - end - end if difficulty.topBadge ~= 0 then gfx.BeginPath() gfx.ImageRect(x+xOffset+w-h/2, y+h/2 +5, (h/2-10), h/2-10, badges[difficulty.topBadge], 1, 0) @@ -207,7 +187,7 @@ end draw_song = function(song, x, y, w, h, selected) check_or_create_cache(song) gfx.BeginPath() - gfx.RoundedRectVarying(x,y, w, h,0,0,0,40) +-- gfx.RoundedRectVarying(x,y, w, h,0,0,0,40) gfx.FillColor(30,30,30) gfx.StrokeColor(0,128,255) gfx.StrokeWidth(1) @@ -219,18 +199,18 @@ draw_song = function(song, x, y, w, h, selected) gfx.Stroke() gfx.FillColor(255,255,255) gfx.TextAlign(gfx.TEXT_ALIGN_TOP + gfx.TEXT_ALIGN_LEFT) - gfx.DrawLabel(songCache[song.id]["title"], x+10, y + 5, w-10) + -- gfx.DrawLabel(songCache[song.id]["title"], x+10, y + 5, w-10) if (song.missing_chart) then gfx.FillColor(255,20,20) end - gfx.DrawLabel(songCache[song.id]["chart_names"], x+20, y + 50, w-10) +-- gfx.DrawLabel(songCache[song.id]["chart_names"], x+20, y + 50, w-10) --gfx.DrawLabel(songCache[song.id]["artist"], x+20, y + 50, w-10) gfx.ForceRender() end -draw_diff_icon = function(diff, x, y, w, h, selected) +draw_diff_icon = function(diff, x, y, w, h, selected, deltaTime) local shrinkX = w/4 local shrinkY = h/4 if selected then @@ -250,19 +230,12 @@ draw_diff_icon = function(diff, x, y, w, h, selected) gfx.FillColor(255,255,255) gfx.TextAlign(gfx.TEXT_ALIGN_MIDDLE + gfx.TEXT_ALIGN_CENTER) gfx.FastText(tostring(diff.level), x+(w/2),y+(h/2)) +-- gfx.BeginPath() +-- DiffRectangle.render(deltaTime, 183, 2.5, 10, songCache[song.id][selectedDiff],tostring(diff.level)); end -draw_cursor = function(x,y,rotation,width) - gfx.Save() - gfx.BeginPath(); - gfx.Translate(x,y) - gfx.Rotate(rotation) - gfx.StrokeColor(255,128,0) - gfx.StrokeWidth(4) - gfx.Rect(-width/2, -width/2, width, width) - gfx.Stroke() - gfx.Restore() -end + + draw_diffs = function(diffs, x, y, w, h) local diffWidth = w/2.5 @@ -310,39 +283,23 @@ draw_selected = function(song, x, y, w, h) local height = (h-(yMargin*2)) local xpos = x+xMargin local ypos = y+yMargin - if aspectRatio == "PortraitWidescreen" then - xPadding = math.floor(w/64) - yPadding = math.floor(h/32) - xMargin = math.floor(w/64) - yMargin = math.floor(h/32) - width = (w-(xMargin*2)) - height = (h-(yMargin*2)) - xpos = x+xMargin - ypos = y+yMargin - end --Border - --local diff = song.difficulties[selectedDiff] - gfx.BeginPath() - gfx.RoundedRectVarying(xpos,ypos,width,height,yPadding,yPadding,yPadding,yPadding) - gfx.FillColor(30,30,30) - gfx.StrokeColor(0,128,255) - gfx.StrokeWidth(1) - gfx.Fill() - gfx.Stroke() +-- local diff = song.difficulties[selectedDiff] +-- gfx.BeginPath() +-- gfx.RoundedRectVarying(xpos,ypos,width,height,yPadding,yPadding,yPadding,yPadding) +-- gfx.FillColor(30,30,30,100) +-- gfx.StrokeColor(0,128,255) +-- gfx.StrokeWidth(1) +-- gfx.Fill() +-- gfx.Stroke() -- jacket should take up 1/3 of height, always be square, and be centered - local imageSize = math.floor(height/2) - local imageXPos = ((width/2) - (imageSize/2)) + x+xMargin - if aspectRatio == "PortraitWidescreen" then - --Unless its portrait widesreen.. - imageSize = math.floor((height/2)*2)-10 - imageXPos = x+xMargin+xPadding - end + local imageSize = math.floor((height/2)*2)-10 + local imageXPos = x+xMargin+xPadding local square_size = math.ceil(math.sqrt(#song.charts)) local origImageSize = imageSize imageSize = math.floor(imageSize / square_size) - local bottom_off = math.ceil((square_size*square_size - #song.charts) * imageSize/2) - + local bottom_off = math.ceil((square_size - #song.charts)) local img_row = 0; @@ -354,9 +311,9 @@ draw_selected = function(song, x, y, w, h) gfx.BeginPath() local xoff = img_col * imageSize if math.ceil(i / square_size) == square_size then - xoff = xoff + bottom_off + xoff = xoff end - gfx.ImageRect(xoff + imageXPos, img_row * imageSize + y+yMargin+yPadding, imageSize, imageSize, songCache[song.id]["jackets"][i], 1, 0) + gfx.ImageRect(62.52,888.6+ (img_row/200 * imageSize), imageSize*1.19, imageSize*1.19, songCache[song.id]["jackets"][i], 1, 0) img_col = img_col + 1 if img_col >= square_size then img_row = img_row + 1 @@ -369,22 +326,10 @@ draw_selected = function(song, x, y, w, h) num_img_rows = img_row end - --if songCache[song.id][selectedDiff] then - -- gfx.BeginPath() - -- gfx.ImageRect(imageXPos, y+yMargin+yPadding, imageSize, imageSize, songCache[song.id][selectedDiff], 1, 0) - --end - --gfx.ImageRect(imageXPos, y+yMargin+yPadding, imageSize, imageSize, jacketFallback, 1, 0) - - -- difficulty should take up 1/6 of height, full width, and be centered - --if aspectRatio == "PortraitWidescreen" then - --difficulty wheel should be right below the jacketImage, and the same width as - --the jacketImage - -- draw_diffs(song.difficulties,xpos+xPadding,(ypos+yPadding+imageSize),imageSize,math.floor((height/3)*1)-yPadding) - --else - -- difficulty should take up 1/6 of height, full width, and be centered - -- draw_diffs(song.difficulties,(w/2)-(imageSize/2),(ypos+yPadding+imageSize),imageSize,math.floor(height/6)) - --end - -- effector / bpm should take up 1/3 of height, full width + if songCache[song.id][selectedDiff] then + gfx.BeginPath() + --gfx.ImageRect(imageXPos, y+yMargin+yPadding, imageSize, imageSize, songCache[song.id][selectedDiff], 1, 0) + end local gradeImg = nil for i,v in ipairs(grades) do @@ -402,12 +347,11 @@ draw_selected = function(song, x, y, w, h) local boxh, boxw = 0 local starty, startx = 0 - if aspectRatio == "PortraitWidescreen" then gfx.FontSize(40) - gfx.TextAlign(gfx.TEXT_ALIGN_TOP + gfx.TEXT_ALIGN_LEFT) + gfx.TextAlign(gfx.TEXT_ALIGN_TOP + gfx.TEXT_ALIGN_MIDDLE) starty = y+yMargin+yPadding startx = xpos+xPadding+origImageSize+10 - gfx.DrawLabel(songCache[song.id]["title"], startx, starty, width-origImageSize-30) + gfx.DrawLabel(songCache[song.id]["title"], 295, 845, width-origImageSize-30) gfx.FontSize(30) -- Scroll box info @@ -422,63 +366,25 @@ draw_selected = function(song, x, y, w, h) --gfx.FastText(string.format("Effector: %s", diff.effector), xpos+xPadding+imageSize+3, y+yMargin+yPadding + 115) if song.topBadge ~= 0 then gfx.BeginPath() - gfx.ImageRect(width-40, height-50, 50, 50, badges[song.topBadge], 1, 0) + gfx.ImageRect(978, 1026.5, 50, 50, badges[song.topBadge], 1, 0) local iar = 0 if gradeImg ~= nil then gfx.BeginPath() local iw,ih = gfx.ImageSize(gradeImg) iar = iw/ih - gfx.ImageRect(width-40-iar*50, height-50, iar * 50, 50, gradeImg, 1, 0) + gfx.ImageRect(961-iar*50, 1026.5, iar * 50, 50, gradeImg, 1, 0) end gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE) - gfx.DrawLabel(songCache[song.id]["percent"], width, height-65, 190) + gfx.DrawLabel(songCache[song.id]["percent"], 595, 1045, 200) end - else - starty = (height/10)*6; - if num_img_rows < square_size then - starty = starty - imageSize*(square_size - num_img_rows) - end - gfx.FontSize(40) - gfx.TextAlign(gfx.TEXT_ALIGN_TOP + gfx.TEXT_ALIGN_LEFT) - gfx.DrawLabel(songCache[song.id]["title"], xpos+10, starty, width-20) - - -- Scroll box info - boxh = height - starty - 45 - 50 - boxw = width-20 - startx = xpos + 10 - starty = starty + 45 - - --gfx.DrawLabel(songCache[song.id]["artist"], xpos+10, (height/10)*6 + 45, width-20) - --gfx.FillColor(255,255,255) - --gfx.FontSize(20) - --gfx.DrawLabel(songCache[song.id]["bpm"], xpos+10, (height/10)*6 + 85) - if song.topBadge ~= 0 then - gfx.BeginPath() - gfx.ImageRect(width-25, height-40, 50, 50, badges[song.topBadge], 1, 0) - local iar = 0 - local iw, ih = 0; - if gradeImg ~= nil then - gfx.BeginPath() - iw,ih = gfx.ImageSize(gradeImg) - iar = iw/ih - gfx.ImageRect(xpos + 10, height-40, iar * 50, 50, gradeImg, 1, 0) - end - gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE ) - local ledge = iar * 50 + 20 - local redge = 50 - local maxLen = width - ledge - redge - local center = ledge + (maxLen/2) - gfx.DrawLabel(songCache[song.id]["percent"], center, height-16, maxLen) - end - end -- Render desc scrolling box do - gfx.BeginPath() - gfx.Rect(startx, starty, boxw, boxh) - gfx.FillColor(50,50,50) - gfx.Fill() +-- gfx.BeginPath() +-- gfx.Rect(startx, starty, boxw, boxh) +-- gfx.FillColor(50,50,50) +-- gfx.Fill() local overBottom = desch - 100*scrollmul - boxh if overBottom < 0 and scrollmul > 0 then @@ -500,13 +406,12 @@ draw_selected = function(song, x, y, w, h) gfx.Fill() end - gfx.Scissor(startx, starty, boxw, boxh) + gfx.BeginPath() - gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP ) - gfx.DrawLabel(songCache[song.id]["desc"], startx+5, starty - (100*scrollmul)//1, boxw) + gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE ) + gfx.DrawLabel(songCache[song.id]["desc"], 600, 942) - gfx.ResetScissor() end --if aspectRatio == "PortraitWidescreen" then -- draw_scores(diff, xpos+xPadding+imageSize+3, (height/3)*2, width-imageSize-20, (height/3)-yPadding) @@ -519,17 +424,6 @@ end draw_songwheel = function(x,y,w,h) local offsetX = fifthX/2 local width = math.floor((w/5)*4) - if aspectRatio == "landscapeWidescreen" then - wheelSize = 12 - offsetX = 80 - elseif aspectRatio == "landscapeStandard" then - wheelSize = 10 - offsetX = 40 - elseif aspectRatio == "PortraitWidescreen" then - wheelSize = 20 - offsetX = 20 - width = w - end local height = math.floor((h/wheelSize)*1.5) for i = math.max(selectedIndex - wheelSize/2, 1), math.max(selectedIndex - 1,0) do @@ -610,7 +504,7 @@ draw_search = function(x,y,w,h) gfx.Fill() gfx.Stroke() gfx.BeginPath(); - gfx.LoadSkinFont("NotoSans-Regular.ttf"); + gfx.LoadSkinFont("dfmarugoth.ttf"); gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE); gfx.DrawLabel(searchText, xpos+10,y+(h/2), w-20) @@ -618,7 +512,7 @@ end render = function(deltaTime) - + timer = (timer + deltaTime) timer = timer % 2 resx,resy = game.GetResolution(); @@ -626,38 +520,26 @@ render = function(deltaTime) gfx.ImageRect(0, 0, resx, resy, backgroundImage, 1, 0) adjustScreen(resx,resy); gfx.BeginPath(); - gfx.LoadSkinFont("NotoSans-Regular.ttf"); + gfx.LoadSkinFont("dfmarugoth.ttf"); gfx.FontSize(40); gfx.FillColor(255,255,255); if chalwheel.challenges == nil then elseif chalwheel.challenges[1] ~= nil then --draw chalwheel and get selected song - if aspectRatio == "PortraitWidescreen" then local song = draw_songwheel(0,0,fullX,fullY) --render selected song information draw_selected(song, 0,0,fullX,fifthY) - else - local song = draw_songwheel(fifthX*2,0,fifthX*3,fullY) - --render selected song information - draw_selected(song, 0,0,fifthX*2,(fifthY/2)*9) - end end --Draw Legend Information if showGuide then - if aspectRatio == "PortraitWidescreen" then draw_legend(0,(fifthY/3)*14, fullX, (fifthY/3)*1) - else - draw_legend(0,(fifthY/2)*9, fullX, (fifthY/2)) - end end --draw text search - if aspectRatio == "PortraitWidescreen" then - draw_search(fifthX*2,5,fifthX*3,fifthY/5) - else - draw_search(fifthX*2,5,fifthX*3,fifthY/3) - end + + draw_search(fifthX*2,5,fifthX*3,fifthY/5) + ioffset = ioffset * 0.9 doffset = doffset * 0.9 @@ -669,7 +551,7 @@ render = function(deltaTime) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) gfx.Text(chalwheel.searchStatus, 3, 3) end - gfx.LoadSkinFont("NotoSans-Regular.ttf"); + gfx.LoadSkinFont("dfmarugoth.ttf"); gfx.ResetTransform() gfx.ForceRender() end