summaryrefslogtreecommitdiff
path: root/print_good2.lua
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2025-11-02 20:12:27 +0000
committerubq323 <ubq323@ubq323.website>2025-11-02 20:12:27 +0000
commit47ffcf781e29fbc02b51365d2c4332fe97eba694 (patch)
treea64c410a91420e7d9cea10db04d886e7c0141501 /print_good2.lua
parentf238f1637d53389e4e804de72b7789c8fe312433 (diff)
change print_good greatly, to be fixed properly later
Diffstat (limited to 'print_good2.lua')
-rw-r--r--print_good2.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/print_good2.lua b/print_good2.lua
new file mode 100644
index 0000000..719120c
--- /dev/null
+++ b/print_good2.lua
@@ -0,0 +1,28 @@
+local G = love.graphics
+local font = G.getFont()
+local text = G.newText(font)
+
+local function print_good(str,x,y,tcol,bcol,nob)
+ text:setFont(G.getFont())
+ text:set(str)
+ local w,h = text:getDimensions()
+ local sx,sy = G.transformPoint(x,y)
+ sx,sy = math.floor(sx),math.floor(sy)
+ -- local W,H = G.getDimensions()
+ -- if x == "center" then x = (W/2)-(w/2) end
+ -- if y == "center" then y = (H/2)-(h/2) end
+ -- if x == "end" then x = W-w end
+ -- if y == "end" then y = H-h end
+ G.push()
+ G.origin()
+ if not nob then
+ G.setColor(bcol or {0,0,0,0.8})
+ G.rectangle("fill",sx,sy,w,h)
+ end
+ G.setColor(tcol or {1,1,1})
+ G.draw(text,sx,sy)
+ G.pop()
+end
+
+
+return print_good