From ec08c8ece378f62f2d50b97f8c0b0335da7b484a Mon Sep 17 00:00:00 2001 From: FajsiEx Date: Thu, 28 Oct 2021 11:02:11 +0200 Subject: [PATCH] + finish diff rect component --- scripts/components/diff_rectangle.lua | 35 +++++++++++++++++++++++---- scripts/gameplay.lua | 2 +- scripts/gameplay/song_panel.lua | 7 +++++- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/scripts/components/diff_rectangle.lua b/scripts/components/diff_rectangle.lua index 3018527..b32c19d 100644 --- a/scripts/components/diff_rectangle.lua +++ b/scripts/components/diff_rectangle.lua @@ -10,18 +10,40 @@ local difficultyLabelImages = { gfx.CreateSkinImage("diff/8 vivid.png", 0) } -function render(deltatime, x, y, diff, level) +local difficultyLabelTexts = { + "NOV", + "ADV", + "EXH", + "MXM", + "GRV", + "HVN", + "VVD" +} + +function render(deltatime, x, y, scale, diff, level) + gfx.Save() + gfx.Translate(x,y); + gfx.Scale(scale,scale) + gfx.LoadSkinFont('Digital-Serial-Bold.ttf') gfx.BeginPath(); - gfx.ImageRect(x, y, 140 / 1.5, 31 / 1.5, - difficultyLabelImages[diff] or + gfx.ImageRect(0, 0, 140, 31 , + difficultyLabelImages[diff+1] or difficultyLabelImages[4], 1, 0); - gfx.FontSize(17) + + gfx.FontSize(24) gfx.LoadSkinFont('Digital-Serial-Bold.ttf') + gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE) - gfx.Text(level, x + 50, y+8); + gfx.Text(level, 120, 16); + + gfx.FontSize(22) + gfx.Scale(1.2,1); -- Make the diff text more W I D E + gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE) + gfx.Text(difficultyLabelTexts[diff+1], 18, 17); + -- -- Draw volforce badge @@ -31,6 +53,9 @@ function render(deltatime, x, y, diff, level) -- -- Draw volforce label -- gfx.FontSize(11) -- gfx.Text('VOLFORCE', x + 47, y + 14); + + gfx.ResetTransform() + gfx.Restore() end return { diff --git a/scripts/gameplay.lua b/scripts/gameplay.lua index ca63294..9b24993 100644 --- a/scripts/gameplay.lua +++ b/scripts/gameplay.lua @@ -33,7 +33,7 @@ function render(deltaTime) Banner.render(deltaTime); UserPanel.render(deltaTime); - SongPanel.render(deltaTime, gameplay.bpm, gameplay.hispeed, gameplay.jacketPath); + SongPanel.render(deltaTime, gameplay.bpm, gameplay.hispeed, gameplay.jacketPath, gameplay.difficulty, gameplay.level); ScorePanel.render(deltaTime, score, maxChain) Gauge.render( diff --git a/scripts/gameplay/song_panel.lua b/scripts/gameplay/song_panel.lua index c0f73cb..98ecedb 100644 --- a/scripts/gameplay/song_panel.lua +++ b/scripts/gameplay/song_panel.lua @@ -1,4 +1,6 @@ +local DiffRectangle = require('components.diff_rectangle'); + local desw = 1080; local desh = 1920; @@ -32,7 +34,7 @@ local tickTransitions = function (deltaTime) end -local render = function (deltaTime, bpm, laneSpeed, jacketPath) +local render = function (deltaTime, bpm, laneSpeed, jacketPath, diff, level) if (not loadedJacketImage and jacketPath) then loadJacketImage(jacketPath) end @@ -75,6 +77,9 @@ local render = function (deltaTime, bpm, laneSpeed, jacketPath) 1, 0 ); + + -- Draw diff rectangle + DiffRectangle.render(deltaTime, 31, 350, 0.84, diff, level); gfx.FontSize(30); gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)