From f71f57ecec1222c832430fa7518476d08e152538 Mon Sep 17 00:00:00 2001 From: RealFD Date: Sat, 19 Feb 2022 02:38:37 +0100 Subject: [PATCH] arround 50% done of what i planned --- scripts/components/footer.lua | 2 +- scripts/components/textscrambler.lua | 40 +++++++++++++++++++++++ scripts/multiplayerscreen.lua | 23 ++++++++----- scripts/songselect/songwheel.lua | 49 +++++++++++++++++++++------- 4 files changed, 94 insertions(+), 20 deletions(-) create mode 100644 scripts/components/textscrambler.lua diff --git a/scripts/components/footer.lua b/scripts/components/footer.lua index 1a63ab1..3d9719d 100644 --- a/scripts/components/footer.lua +++ b/scripts/components/footer.lua @@ -54,7 +54,7 @@ local drawFooter = function () gfx.FontSize(20) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) gfx.FillColor(255, 255, 255, 255); - gfx.Text('EXPERIMENTALGEAR ' .. version.MAJOR .. '.' .. version.MINOR .. '.' .. version.PATCH .. ' - CLOSED BETA. DO. NOT. LEAK.', 8, 1895); + gfx.Text('EXPERIMENTALGEAR ' .. version.MAJOR .. '.' .. version.MINOR .. '.' .. version.PATCH .. " < Dev Build RealFD Branch >", 8, 1895); end local progressTransitions = function (deltaTime) diff --git a/scripts/components/textscrambler.lua b/scripts/components/textscrambler.lua new file mode 100644 index 0000000..ebb9d46 --- /dev/null +++ b/scripts/components/textscrambler.lua @@ -0,0 +1,40 @@ +local ScrollScale = 0 +local ScrollOffsetX = 0 + +function textmaker(text, fontsize, maxWidth, x, y, w, h, scissorX, scissorY, debugX, debugY,deltaTime) + gfx.FontSize(fontsize) + local x1,y1,x2,y2 = gfx.TextBounds(x,y, text) + gfx.FillColor(255,0,0) --* + -- gfx.Text((x2-x1).." Box",x+debugX,y+debugY/1.5) --* + + + gfx.Scissor(x,y + scissorY,w,h) + gfx.FillColor(255,255,255) + if (x2-x1) < maxWidth then + gfx.Text(text,x,y) + else + gfx.Text(text,x-ScrollScale,y) + gfx.FillColor(255,255,0) + gfx.Text(ScrollScale,x,y-25) + end + gfx.ResetScissor() + + end + + +function tickScroll(deltaTime) + if ScrollScale < 630 then + ScrollScale = ScrollScale + deltaTime *100 -- transition should last for that time in seconds + else + ScrollScale = -422 + end + ScrollOffsetX = 1000 * (1-ScrollScale); +end + + +return { + textmaker = textmaker, + tickScroll = tickScroll +} + +-- * = debug things \ No newline at end of file diff --git a/scripts/multiplayerscreen.lua b/scripts/multiplayerscreen.lua index a4353a3..959fb31 100644 --- a/scripts/multiplayerscreen.lua +++ b/scripts/multiplayerscreen.lua @@ -182,6 +182,7 @@ draw_checkbox = function(text, x, y, hoverindex, current, can_click) end end; +local Player = 0 local userHeight = 100 --look into user changing -- IMPORTANT !!! draw_user = function(user, x, y, buttonWidth, rank) @@ -189,6 +190,7 @@ draw_user = function(user, x, y, buttonWidth, rank) -- local y = 100 local rx = x - (buttonWidth / 2); local ty = y - (buttonHeight / 2); + gfx.BeginPath(); gfx.Rect(rx - buttonBorder, ty - buttonBorder, @@ -196,8 +198,7 @@ draw_user = function(user, x, y, buttonWidth, rank) buttonHeight + (buttonBorder * 2)); gfx.BeginPath(); if host == user.id then - local y = 100 - + gfx.FillColor(0,0,40); else gfx.FillColor(0,0,40); end @@ -218,11 +219,14 @@ draw_user = function(user, x, y, buttonWidth, rank) name = name..' (ready)' end if user.score ~= nil then - name = '#'..rank..' '..name + name = '#'..rank..' '..name.." " end first_y = y - 28 second_y = y + 28 gfx.Text(name, x - buttonWidth/2 + 5, first_y); + + gfx.Text(Player, split/2, buttonY, split*3/4) + if user.score ~= nil then gfx.FillColor(255,255,0) gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE); @@ -259,7 +263,8 @@ draw_user = function(user, x, y, buttonWidth, rank) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE); local level_text = user.level gfx.Text(level_text, x-buttonWidth/2 + 5, second_y-5) - local xmin,ymin,xmax,ymax = gfx.TextBounds(x-buttonWidth/2 + 5, second_y-5, level_text); +-- local xmin,ymin,xmax,ymax = gfx.TextBounds(x-buttonWidth/2 + 5, second_y-5, level_text); + if user.badge then gfx.BeginPath() @@ -488,10 +493,6 @@ function render_lobby(deltaTime) gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_LEFT); gfx.FillColor(255,255,255) - -- === song select === - --- gfx.FontSize(60) --- gfx.Text("Selected Song:", split/2 + song_x_off, 100) gfx.FontSize(32) if selected_song == nil then if host == user_id then @@ -960,6 +961,12 @@ Tcp.SetTopicHandler("room.update", function(data) end end +---THIS + local b = 1 + for b, user in pairs(lobby_users) do + Player = Player+1 + end + if user_id == host and #data.users > 1 and all_ready and not prev_all_ready then repeat_sound("click-02", 3, .1) end diff --git a/scripts/songselect/songwheel.lua b/scripts/songselect/songwheel.lua index a13f9e4..dc98813 100644 --- a/scripts/songselect/songwheel.lua +++ b/scripts/songselect/songwheel.lua @@ -4,6 +4,8 @@ local Background = require('components.background') local common = require('common.common') local Numbers = require('common.numbers') +local newtext = require("components.textscrambler") + local VolforceCalc = require('components.volforceCalc') local backgroundImage = gfx.CreateSkinImage("bg_pattern.png", gfx.IMAGE_REPEATX | gfx.IMAGE_REPEATY) @@ -319,9 +321,13 @@ function drawSong(song, y) Numbers.draw_number(songX+30, y+125, 1.0, selectedSongDifficulty.level, 2, difficultyNumbers, false, 0.65, 1) -- Draw song title - gfx.FontSize(24) +-- gfx.FontSize(24) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE) - gfx.Text(song.title, songX+90, y+155); + newtext.textmaker(song.title,35.35,421.5,songX+90,y+155,417,100,nil,-10, + 95, -- debug remove later + -60, + 1 + ) -- Draw score badge local badgeImage = badgeImages[1]; @@ -456,22 +462,34 @@ function drawData() -- Draws the song data on the left panel -- Draw BPM gfx.BeginPath(); - gfx.FontSize(24) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE) gfx.Save() gfx.LoadSkinFont('Digital-Serial-Bold.ttf') gfx.GlobalAlpha(transitionAfterscrollDataOverlayAlpha) -- TODO: split this out - gfx.Text(song.bpm, 85, 920); + newtext.textmaker(song.bpm,24,110,85,920,99,110,nil,-10, + 200, -- debug remove later + 0, + 1 +) gfx.Restore() -- Draw song title - gfx.FontSize(28) gfx.GlobalAlpha(transitionAfterscrollTextSongTitle); - gfx.Text(song.title, 30+(1-transitionAfterscrollTextSongTitle)*20, 955); + newtext.textmaker(song.title,28,495.5,30+(1-transitionAfterscrollTextSongTitle)*20,955,495,100,nil,-10, + 95, -- debug remove later + -60, + 1 + ) + -- Draw artist gfx.GlobalAlpha(transitionAfterscrollTextSongArtist); - gfx.Text(song.artist, 30+(1-transitionAfterscrollTextSongArtist)*30, 997); + newtext.textmaker(song.artist,28,495.5,30+(1-transitionAfterscrollTextSongArtist)*30,997,495,100,nil,-10, + 95, -- debug remove later + -60, + 1 + ) + gfx.GlobalAlpha(1); @@ -507,11 +525,19 @@ function drawData() -- Draws the song data on the left panel drawLocalLeaderboard(diff) drawIrLeaderboard() - gfx.FontSize(22) + gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE) gfx.GlobalAlpha(transitionAfterscrollDataOverlayAlpha); - gfx.Text(diff.effector, 270, 1180); -- effected by - gfx.Text(diff.illustrator, 270, 1210); -- illustrated by + newtext.textmaker(diff.effector,22,236.5,270+(1-transitionAfterscrollDataOverlayAlpha)*20,1180,236,100,nil,-10, + 95, -- debug remove later + -60, + 1 + ) + newtext.textmaker(diff.illustrator,22,236.5,270+(1-transitionAfterscrollDataOverlayAlpha)*30,1210,236,100,nil,-10, + 95, -- debug remove later + -60, + 1 +) gfx.GlobalAlpha(1); end @@ -953,7 +979,8 @@ end render = function (deltaTime) tickTransitions(deltaTime); - + tickScroll(deltaTime); + game.SetSkinSetting('_currentScreen', 'songwheel') common.stopMusic();