From 1f5b5c28b5ad27c43c9441cef0c16dcd062c0b13 Mon Sep 17 00:00:00 2001 From: FajsiEx Date: Sun, 21 Nov 2021 16:56:23 +0100 Subject: [PATCH] + cursor to critline wip --- scripts/gameplay.lua | 2 +- scripts/gameplay/crit_line.lua | 26 +++++++++++++++++- .../crit_line/cursor.png} | Bin 3 files changed, 26 insertions(+), 2 deletions(-) rename textures/{tsumav3.png => gameplay/crit_line/cursor.png} (100%) diff --git a/scripts/gameplay.lua b/scripts/gameplay.lua index 8921315..796ecbd 100644 --- a/scripts/gameplay.lua +++ b/scripts/gameplay.lua @@ -59,7 +59,7 @@ function render(deltaTime) end function render_crit_base(deltaTime) - CritLine.renderBase(deltaTime, gameplay.critLine.x, gameplay.critLine.y, -gameplay.critLine.rotation); + CritLine.renderBase(deltaTime, gameplay.critLine.x, gameplay.critLine.y, -gameplay.critLine.rotation, gameplay.critLine.cursors); Console.render(deltaTime, gameplay.critLine.x, gameplay.critLine.y, -gameplay.critLine.rotation); end diff --git a/scripts/gameplay/crit_line.lua b/scripts/gameplay/crit_line.lua index 0bbf9cc..f5f8875 100644 --- a/scripts/gameplay/crit_line.lua +++ b/scripts/gameplay/crit_line.lua @@ -1,6 +1,7 @@ local baseImage = gfx.CreateSkinImage("gameplay/crit_line/base.png", 0) local textImage = gfx.CreateSkinImage("gameplay/crit_line/text.png", 0) +local cursorImage = gfx.CreateSkinImage("gameplay/crit_line/cursor.png", 0) local CRITBAR_W = 1496 local CRITBAR_H = 348 @@ -16,7 +17,28 @@ local setUpTransforms = function (x,y,rotation) gfx.Scale(scale,scale) end -local renderBase = function (deltaTime, centerX, centerY, rotation) +local drawCursors = function (cursors) + local cursorW = 598*0.2; + local cursorH = 673*0.2; + for i = 0, 1, 1 do + gfx.Save(); + local cursor = cursors[i]; + gfx.BeginPath(); + gfx.SkewX(cursor.skew) + gfx.ImageRect( + cursor.pos - cursorW/2, + -cursorH/2, + cursorW, + cursorH, + cursorImage, + cursor.alpha, + 0 + ); + gfx.Restore(); + end +end + +local renderBase = function (deltaTime, centerX, centerY, rotation, cursors) setUpTransforms(centerX, centerY, rotation) gfx.BeginPath() @@ -35,6 +57,8 @@ local renderBase = function (deltaTime, centerX, centerY, rotation) 0 ); + drawCursors(cursors) + gfx.ResetTransform() end diff --git a/textures/tsumav3.png b/textures/gameplay/crit_line/cursor.png similarity index 100% rename from textures/tsumav3.png rename to textures/gameplay/crit_line/cursor.png