Search found 612 matches

by grump
Tue Jun 30, 2020 10:22 pm
Forum: Support and Development
Topic: Getting save directory items
Replies: 4
Views: 189

Re: Getting save directory items

Best solution is to create a dedicated save directory when your game starts.
In cases where that's not sufficient, you can use love.filesystem.getRealDirectory to check the real location of each file.
by grump
Wed Jun 10, 2020 4:59 pm
Forum: Support and Development
Topic: Weird pixel glitch
Replies: 4
Views: 1879

Re: Weird pixel glitch

Add .5 to coordinates of lines and points. Some primitives have to be aligned at the center of pixels to render correctly, while others have to be aligned at integer coordinates. I have no explanation for the weirdness, it just is.
by grump
Wed Jun 10, 2020 1:22 pm
Forum: Support and Development
Topic: Getting a UTF-8 error while trying to reverse and print Hebrew text
Replies: 2
Views: 1868

Re: Getting a UTF-8 error while trying to reverse and print Hebrew text

It's because you're not reversing the text, you're reversing the codes that make up each character in the text. You have to take into account that UTF-8 uses multiple bytes to encode non-ASCII chars. local utf8 = require('utf8') local function reverse(str) local len, result = utf8.len(str), {} for _...
by grump
Thu Jun 04, 2020 6:51 pm
Forum: Support and Development
Topic: Attempting to implement a wait function in love.update
Replies: 5
Views: 6217

Re: Attempting to implement a wait function in love.update

"Pausing a function" is not a thing. You can either sleep, which will prevent execution of the rest of the game while sleeping.

Code: Select all

love.timer.sleep(1)
Or you can implement custom logic to make sure the parts you want to pause are not being updated while paused, as shown in the previous comments.
by grump
Tue Jun 02, 2020 4:29 pm
Forum: Support and Development
Topic: Overlay
Replies: 9
Views: 7855

Re: Overlay

Another solution using a shader: local lg = love.graphics local red, blue, mask = lg.newCanvas(), lg.newCanvas(), lg.newCanvas() red:renderTo(function() lg.clear(1, .2, .2) end) blue:renderTo(function() lg.clear(.2, .2, 1) end) mask:renderTo(function() lg.circle('fill', 200, 200, 100) end) local mas...
by grump
Sun May 24, 2020 2:55 pm
Forum: Libraries and Tools
Topic: easier copy/paste between hex RGB(A) and LÖVE
Replies: 5
Views: 4045

Re: easier copy/paste between hex RGB(A) and LÖVE

Useful, but that's a lot of code for a simple function. local function colorFromValue(val) local bit = require('bit') local r = bit.rshift(bit.band(val, 0xff0000), 16) / 255 local g = bit.rshift(bit.band(val, 0xff00), 8) / 255 local b = bit.band(val, 0xff) / 255 return r, g, b end love.graphics.setC...
by grump
Fri May 22, 2020 10:32 pm
Forum: Support and Development
Topic: Drawing text filled with a texture instead of a solid color
Replies: 3
Views: 643

Re: Drawing text filled with a texture instead of a solid color

Here's a simpler solution with a shader. The texturing depends on the screen position of the text with this code though, which can be easily fixed if required.
by grump
Wed May 20, 2020 9:27 pm
Forum: Libraries and Tools
Topic: a working setColor compatibilty multiplier
Replies: 17
Views: 12256

Re: a working setColor compatibilty multiplier

2grump: You r such a party safer! At least migrated our Zabuyaki beat 'em up to Love 11.3 the final thing was cindy. Thank you very much for the feedback! The change to the "new" color range makes a lot of sense for newer projects, but I'm happy that this little hack helped you port your game to LÖ...
by grump
Sun May 03, 2020 5:59 am
Forum: Support and Development
Topic: Unexpected behaviour in events and objects
Replies: 4
Views: 812

Re: Unexpected behaviour in events and objects

What you receive in the event handler is a copy of the table that has the original metatable stripped from it. function love.handlers.foo(t) print("received", t, getmetatable(t)) end local t = setmetatable({}, {}) print("sending", t, getmetatable(t)) love.event.push("foo", t) Output: sending table: ...
by grump
Wed Apr 01, 2020 7:40 pm
Forum: Support and Development
Topic: Cannot create Canvas: Texture format cannot be rendered to on this system.
Replies: 2
Views: 1131

Re: Cannot create Canvas: Texture format cannot be rendered to on this system.

sherlockholmes221b wrote:
Wed Apr 01, 2020 6:41 pm
Every Canvas is 12800x12800 pixels. When I try to create the world, the game crashes on generating sixth canvas.
6 RGBA8 Canvases of 12800x12800 pixels require ~4 GB of VRAM. Not a surprising result.