summaryrefslogtreecommitdiff
path: root/liquidSurface.lua
diff options
context:
space:
mode:
authorcursed22bc <admin@pixeldawn.org>2026-03-08 23:15:16 +0200
committercursed22bc <admin@pixeldawn.org>2026-03-08 23:15:16 +0200
commit97d0d1ecc0cfd5516cfad2d477faa4d35992e7ba (patch)
tree5ba61a59723d5c9ceb8059388d35bdcb069af743 /liquidSurface.lua
parentaeb596379bbf1bec84efb294ff5bbbee922364ba (diff)
liquid shader and basic text render
Diffstat (limited to 'liquidSurface.lua')
-rw-r--r--liquidSurface.lua22
1 files changed, 19 insertions, 3 deletions
diff --git a/liquidSurface.lua b/liquidSurface.lua
index 6d9b24e..da79d44 100644
--- a/liquidSurface.lua
+++ b/liquidSurface.lua
@@ -2,7 +2,7 @@ local LiquidSurface = {}
LiquidSurface.__index = LiquidSurface
local DEFAULT_COLORS = {
- water = { 0.35, 0.65, 1, 0.75 },
+ water = { 0.35, 0.65, 1, 0.5},
lava = { 1, 0.35, 0.1, 0.8 }
}
@@ -146,9 +146,8 @@ function LiquidSurface:update(dt)
end
end
-function LiquidSurface:draw()
+function LiquidSurface:drawFill()
love.graphics.setColor(self.color)
-
for i = 2, self.columnsLength do
local p1x = self.x + (i - 2)
local p1y = self.bottomY - self.columns[i - 1].height
@@ -162,8 +161,25 @@ function LiquidSurface:draw()
p3x, p3y, p4x, p4y, p2x, p2y
)
end
+end
+function LiquidSurface:drawLine()
+ local linePoints = {}
+ for i = 1, self.columnsLength do
+ linePoints[#linePoints + 1] = self.x + (i - 1)
+ linePoints[#linePoints + 1] = self.bottomY - self.columns[i].height
+ end
love.graphics.setColor(1, 1, 1, 1)
+ love.graphics.setLineWidth(1)
+ love.graphics.setLineStyle("rough")
+ love.graphics.line(linePoints)
+ love.graphics.setLineStyle("smooth")
+ love.graphics.setColor(1, 1, 1, 1)
+end
+
+function LiquidSurface:draw()
+ self:drawFill()
+ self:drawLine()
end
return LiquidSurface