Comments (6)
Thank you for your help ! Yes you're right, I implemented a root entity for each scene and the TargetEntity was always true because it was pointing to that root entity. Your solutions solved my issue ! Thanks for everything ! :)
from geonbit.ui.
Hi @Catvert, glad you like the lib!
If you have the most up-to-date version you should have a UserInterface.TargetEntity
getter, which either points on the current entity the mouse points on, or null. Checking if its not null is equivalent to checking if mouse is hover (any) entity.
Here's the related line: https://github.com/RonenNess/GeonBit.UI/blob/master/GeonBit.UI/GeonBit.UI/UserInterface.cs#L143
I'm closing this ticket, but if you need further assistant with this subject or I misunderstood you feel free to reopen it :)
Thanks!
from geonbit.ui.
Thank you for your reply, I have tried to use UserInterface.TargetEntity
, with this code in the update method : Debug.WriteLine(UserInterface.TargetEntity != null && UserInterface.TargetEntity.IsMouseOver);
but it return always true even if my mouse is not hover an entity, just hover the window. Thank you for your help and sorry for my english, Arno.
from geonbit.ui.
You don't need the && UserInterface.TargetEntity.IsMouseOver
part, if its the target entity mouse hover should be true.
Anyway I suspect you have an invisible panel or something covering the entire screen. Could you please check what type of entity you're getting under 'TargetEntity' and whats its size?
Thanks :)
from geonbit.ui.
Yes, it was an invisible entity, but now i'm stuck, i don't know how can i remove all entities when the game switch the scene. By the way, I can't access to UserInterface.Root
, the getter is private. Thank you for your help ! :)
from geonbit.ui.
Cool glad to see this was indeed the problem :)
From what I understand, you implemented different scene UIs by creating a root panel per scene (a skinless panel), that you add/remove when scene loads/unload, and the problem was that its always the TargetEntity
when mouse is not on any other entity. Am I right? If so, that's the way to go, there's no need to change that.
Assuming I understood correctly and that's how you do it, there are several ways to solve your problem:
- You can set
ClickThrough = true
in your scene root panel. This will make the panel itself ignore events, but its children will still work. - Instead of testing if
UserInterface.TargetEntity == null
you can check ifUserInterface.TargetEntity == scenePanel
(where 'scenePanel' is your scene root panel). - Or, similar to above if you have lots of scenes and want to cover them all in one if, you can use the
Identifier
orAttachedData
to mark them as scene roots, and do something like:UserInterface.TargetEntity != null && UserInterface.TargetEntity.Identifier == "scene_root"
.
With that said, the reason UserInterface.Root
is private is because the built-in root panel behave slightly different than regular panels, and by hiding it I wanted to signal the user that he should not mess with it because it will behave unexpectedly. However, I do agree there's a need for a Clear()
function and I'll add it shortly to dev branch.
Let me know if the suggestions above worked for you and the issue is resolved. If not, we'll think of something else :)
from geonbit.ui.
Related Issues (20)
- Missing custom fonts? HOT 3
- Zoom
- Support for MonoGame 3.7.x HOT 1
- Crash in example app, attempts to draw a panel of height 443809248 HOT 1
- netcore? HOT 7
- MonoGame 3.8 HOT 1
- Support for non-monospace fonts HOT 3
- Change docs in relation to moving Content HOT 1
- Extra steps for Linux necessary for Windows too HOT 3
- State dependent UI-rendering HOT 1
- Analog of divs in HTML HOT 1
- Preventing in-game click fall through GenoBit.UI entities HOT 4
- Removing non-root entities (inside parent) HOT 5
- Implementing inventory HOT 14
- monogame 3.8? HOT 1
- Question about install HOT 1
- Problem with custom font and rich texts. HOT 11
- Could not resolve data type. HOT 3
- Exception during Initialize HOT 1
- NuGet Installation Documenation Is Misleading HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geonbit.ui.