anything like this, for objects, sprites, etc?
for example, i want to highlight an object with a shader i made (attach it to sprite) on mousehover, and mouse_exit, disable shader
the shader basically makes the sprite have an outline (looks like someone is selecting it)
i can prob convert mozilla's is_overlap 2d function, and then run that in love.update, right? then use width, height, x, and y and then set h = true, h = false, and create my own mouse events? however, what if the object is off screen? don't want it to loop and check it (unneeded)
mouse_enter signals like godot?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: mouse_enter signals like godot?
I think you've answered the question yourself.
Here's some pseudo-code that would implement your idea (which is the simplest way to achieve what you want):
Here's some pseudo-code that would implement your idea (which is the simplest way to achieve what you want):
Code: Select all
update {
for each object {
if object:is_on_screen() and object:is_overlap(mouse) {
object:mouse_entered()
}
}
}
Re: mouse_enter signals like godot?
thanks Ulydev.Ulydev wrote: ↑Sat Sep 08, 2018 12:32 pm I think you've answered the question yourself.
Here's some pseudo-code that would implement your idea (which is the simplest way to achieve what you want):
Code: Select all
update { for each object { if object:is_on_screen() and object:is_overlap(mouse) { object:mouse_entered() } } }
i am using hump camera right now and it's a lot easier to manage love2d objects, world coordinates, etc.
only problem is lack of UI stuff. i need a UI library similar to Godot's. rich text label, scroll container, vbox, hbox, etc, etc. the latest imgui doesn't work with love2d, and i need to implement a chatbox similar to poe's, which i already did in Godot, but in love2d, it's very hard.
i tried the richtext.lua on github (https://github.com/gvx/richtext/blob/ma ... chtext.lua)
however, my fps drops decrementally every second when i have this code running. i go from 144fps to 40 or something. and i'm just displaying some text with different colors... never had this issue with godot
see, look i started at 144fps, then starts to decrease every second.
https://i.gyazo.com/f304655bdb85e4be90b ... ff0404.gif
if i remove that richtext, fps stays same.
only reason why i am wanting to convert to love2d because godot has nasty bug with tilemap flickering, while love2d sti is PERFECT. except.. UI stuff is a PITA and gives insane performance degradation
unfortunately am not sure what to do at this point...
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: mouse_enter signals like godot?
Another thread had a gem of a quote, but let me just say it outright; if you can't tell what the issue is with your code in front of you, how do you suppose we help you without seeing it?
I'm assuming either that library's old and buggy, or you're doing something you shouldn't, like calling :new every frame or something; unfortunately i can only guess for now.
I'm assuming either that library's old and buggy, or you're doing something you shouldn't, like calling :new every frame or something; unfortunately i can only guess for now.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: mouse_enter signals like godot?
yes, good point. i'm relativeyly new to lua, just started. but i did get sti to work, player enter map and move around w/ collisionzorg wrote: ↑Sat Sep 08, 2018 9:57 pm Another thread had a gem of a quote, but let me just say it outright; if you can't tell what the issue is with your code in front of you, how do you suppose we help you without seeing it?
I'm assuming either that library's old and buggy, or you're doing something you shouldn't, like calling :new every frame or something; unfortunately i can only guess for now.
i drew my hp globe with setScissor and bottom ui elements too. i'm transcending slowly.
i will take a look at the code again
might be because of `love.graphics.newCanvas(fbWidth, fbHeight)` me thinks. hmmm that's initializing a new canvas every frame isn't it
i still need to put this text in a scroll container, etc if i even fix this lol fml
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: mouse_enter signals like godot?
Yep, that could be it.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: mouse_enter signals like godot?
https://github.com/slages/love-imgui/issues/27
and that's since may
i'm going back to godot. i gave it try but imo, a proper ui system like godot would be amazing for this love2d project. ty all for the help since i registered. see u around in the game dev communities maybe. ttyl
Re: mouse_enter signals like godot?
And builds for 11.1, 64x windows are available here: https://github.com/camchenry/love-imgui ... ter-latest
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest