After that you can customise the toast's appearance by changing the values in lovelyToasts.style, or changing the toast's behaviour by changing lovelyToasts.options. Full documentation on this can be found on the GitHub page
This is extremely timely as I've been delaying building something like this myself.
If you don't tap to dismiss then what is the other option? Timed?
Current project: https://togfox.itch.io/hwarang
A card game that brings sword fighting to life. Simple to learn, hard to master. Learn when to advance, dodge, strike and counter. Learn how to strike without being struck. https://discord.gg/HeHgwE5nsZ
Integrated and worked well enough. Unfortunately the X value (drawing from the left) is not quite right. It's always on the first third of the screen. I see you are doing a screenwidth/2 - textwidth/2, and this makes sense but it is not centred on my screen. I d/l a font (non-standard) so maybe something odd with that?
I guess this is the right time to ask for an X override as well as a Y override. I'd like the toast to appear above the avatar's head.
Current project: https://togfox.itch.io/hwarang
A card game that brings sword fighting to life. Simple to learn, hard to master. Learn when to advance, dodge, strike and counter. Learn how to strike without being struck. https://discord.gg/HeHgwE5nsZ
togFox wrote: ↑Thu May 20, 2021 9:24 am
Integrated and worked well enough. Unfortunately the X value (drawing from the left) is not quite right. It's always on the first third of the screen. I see you are doing a screenwidth/2 - textwidth/2, and this makes sense but it is not centred on my screen. I d/l a font (non-standard) so maybe something odd with that?
I guess this is the right time to ask for an X override as well as a Y override. I'd like the toast to appear above the avatar's head.
Hi! There is already a Y override the third argument in lovelyToasts.new is for the location, you can use the pre-defined positions "top", "middle", and "bottom", or you can provide your own Y value here.
As for the X value not being centered properly, would you mind showing me the code you use?
garrGameMessageLog is my array that stores all the messages (toast) I want to display. If a message is queued then I send it to lovelyToasts (which has it's own queue) then removes it from the message queue.
if #garrGameMessageLog > 0 then
lovelyToasts.show(garrGameMessageLog[1].text,3)
RemoveGameMessage(1)
end
Perhaps it thinks my screensize is smaller than it is. I shall check ...
Edit: Yup - it thinks screensize is 800 and not 1920 hence 'centering' it off to the left. I'll see what I can do.
Edit: Fixed.
Current project: https://togfox.itch.io/hwarang
A card game that brings sword fighting to life. Simple to learn, hard to master. Learn when to advance, dodge, strike and counter. Learn how to strike without being struck. https://discord.gg/HeHgwE5nsZ
togFox wrote: ↑Thu May 20, 2021 10:32 am
garrGameMessageLog is my array that stores all the messages (toast) I want to display. If a message is queued then I send it to lovelyToasts (which has it's own queue) then removes it from the message queue.
The REQUIRE is at the top of the file (of course) so the width is 800 by default. Later on, in LOVE.LOAD() I do a setmode to 1920 but it's too late. LovelyToasts has already captured 800 and continues to use 800.
My hack (for now) is to move those two declarations above lovelyToasts, which is a bit ugly, because all my other declarations are grouped elsewhere:
-- ** needs to be placed above the lovelyToasts require
local gintScreenWidth = 1920
local gintScreenHeight = 1080
_ = love.window.setMode(gintScreenWidth, gintScreenHeight,{fullscreen=true,display=1,resizable=false}) -- display = monitor number (1 or 2)
lovelyToasts = require("lovelyToasts")
I guess LT should recheck screen width (and height) on each update but that seems very inefficient. Maybe a lovelyToasts.Initialise() on love.load to do that?
Current project: https://togfox.itch.io/hwarang
A card game that brings sword fighting to life. Simple to learn, hard to master. Learn when to advance, dodge, strike and counter. Learn how to strike without being struck. https://discord.gg/HeHgwE5nsZ
togFox wrote: ↑Thu May 20, 2021 11:11 am
The REQUIRE is at the top of the file (of course) so the width is 800 by default. Later on, in LOVE.LOAD() I do a setmode to 1920 but it's too late. LovelyToasts has already captured 800 and continues to use 800.
My hack (for now) is to move those two declarations above lovelyToasts, which is a bit ugly, because all my other declarations are grouped elsewhere:
-- ** needs to be placed above the lovelyToasts require
local gintScreenWidth = 1920
local gintScreenHeight = 1080
_ = love.window.setMode(gintScreenWidth, gintScreenHeight,{fullscreen=true,display=1,resizable=false}) -- display = monitor number (1 or 2)
lovelyToasts = require("lovelyToasts")
I guess LT should recheck screen width (and height) on each update but that seems very inefficient. Maybe a lovelyToasts.Initialise() on love.load to do that?
Hi! Thanks for reporting this, I fixed the issue in the library and uploaded it to GitHub as well as updated the script attached to the post
That fixed it. Thanks. I've incorporated it into my project.
Some time in the distant future I'll include an optional X value so I can do speech bubbles.
Current project: https://togfox.itch.io/hwarang
A card game that brings sword fighting to life. Simple to learn, hard to master. Learn when to advance, dodge, strike and counter. Learn how to strike without being struck. https://discord.gg/HeHgwE5nsZ