User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: Noob questions about wether some things are possible or

04 Sep 2013, 04:22

Glad to have been helpful :)
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Noob questions about wether some things are possible or

04 Sep 2013, 17:21

Hi,
About the UserControl, i am following this documentation :
Docs/Gui.Core.UserControlTutorial.html
In this documentation the XAML contains the keyword UserControl, if i must use another keyword, could you please tell me which one?
Thanks in advance.
Just as clarification. That tutorial is intended to be used with the native SDK. We have to adapt it for C#. Meanwhile there is information inside the UnityTutorial about UserControls.

Sorry for the inconvenience.
 
Shorinji
Topic Author
Posts: 24
Joined: 16 Aug 2013, 19:45
Location: Shanghai

Re: Noob questions about wether some things are possible or

05 Sep 2013, 17:26

HI,
I have another problem now.

The following code causes the screen to be black when it's the root of the GUI :
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	    mc:Ignorable="d"
        Background="Transparent"
    >
</Grid>  
In my GUI, i have several floating panels, and also some draggable items, and I need to be able to detect the mouse events in case a draggable item has been dragged on nothing, that is why i want to set the background of the root to transparent.

The problem appears only when the root is fullscreen. Did i do something wrong or is it a bug?

As a temporar workaround i set the root size to (Screen.width, Screen.height-1).

Edit:
Another question, i am trying to get the mouse coordinate inside a FrameworkElement. The method i found is the following :
Pointi mousePosition = frameworkElement.GetMouse().GetPosition();
Point point = frameworkElement.PointFromScreen(new Point(mousePosition));
It looks like it's not the best method, i would have expected a method in FrameworkElement which directly returns this value. Did i miss it?
Also I think that in WPF, the is a static method on the Mouse class to get the mouse position which takes a relative IInputElement as a parameter. Is there any reason why NoesisGUI differs from WPF on this point?
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: Noob questions about wether some things are possible or

06 Sep 2013, 12:18

Hi,

Setting the background on the root element is the way we let the user decide if surface must be cleared or not. This only occurs if root element fills the entire screen, that is why setting its size to (Screen.width, Screen.height - 1) disables the clear. An alternative to your solution of setting the size by code is using the margin property:
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Background="Transparent" Margin="0,0,0,1">

    <Grid x:Name="LayoutRoot" Background="Transparent" Margin="0,0,0,-1">
    </Grid>

</Grid>
The grid named "LayoutRoot" will fill the entire screen and receive mouse events.

About the second question, the code you provided is correct and probably if we implement the Mouse.GetPosition(UIElement) function it will have the same code. We don't have the entire WPF API implemented, but we can add the features that could be useful for the user. So, expect this function to be included in the next release ;)
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Noob questions about wether some things are possible or

06 Sep 2013, 13:17

I think this is confusing...

Having the property BackGround to Transparent means that control starts with a background set to (0,0,0,0). This is not the same as having the control background being transparent. So the behavior when the control fills the screen is correct although the result when it is partially covered is not.

May be I am totally wrong here but I think that to get the desired behavior you have to eliminate the Background property. That means that the control respect the current background.

Sergio, I think we have a bug here.
 
Shorinji
Topic Author
Posts: 24
Joined: 16 Aug 2013, 19:45
Location: Shanghai

Re: Noob questions about wether some things are possible or

06 Sep 2013, 16:18

Jesus (i think it's your name), I'm not sure i understand what you are saying here. Eliminating the Background does not result in the desired behavior. I need to get the MouseEvents on the full screen, on the root. A control doesn't send MouseEvent if there is no background nor "foreground" (by foreground i mean children controls). To achieve what i want to achieve, i then need to have the background set to transparent on the root.
If you believe that a control should never have a transparent background, could you please indicate me the correct way of doing what i want to do?

I also got another problem with a full screen gui. I narrowed it down to the following code :
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    >
    <Grid.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../NoesisGUI/Themes/NoesisStyle.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Grid.Resources>
    <Button>Button</Button>
</Grid>    
(my gui is located in the folder Assets/GUI, as a result, the template path is what is ../NoesisGUI/Themes/NoesisStyle.xaml)

When you interact with the button of this code when it's the root, the gui disappears and Unity enters a lock up state. It does the same with the WindowsStyle, but not with the SimpleSyle nor OrbStyle. As a temporar work around i disabled the Button style in the NoesisStyle.xaml line 293. I think the issue is related to the animation of the control when the control is touching the borders of the screen, however my level of WPF is not advanced enough to give you more information than that.

Edit :
I have another question. From what i understood, NoesisGUI is multithread, so i would like to know if it is guaranteed that the event from NoesisGui are raised on same thread than Unity. This is important because Unity engine methods are not re-entrant.
Thanks in advance.
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Noob questions about wether some things are possible or

09 Sep 2013, 14:49

Jesus (i think it's your name), I'm not sure i understand what you are saying here. Eliminating the Background does not result in the desired behavior. I need to get the MouseEvents on the full screen, on the root. A control doesn't send MouseEvent if there is no background nor "foreground" (by foreground i mean children controls). To achieve what i want to achieve, i then need to have the background set to transparent on the root.
If you believe that a control should never have a transparent background, could you please indicate me the correct way of doing what i want to do?
Yes yes. It is a problem on our side. Problem is that we are using the Background property to clear the surface and this is not always correct.
I also got another problem with a full screen gui. I narrowed it down to the following code :
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    >
    <Grid.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../NoesisGUI/Themes/NoesisStyle.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Grid.Resources>
    <Button>Button</Button>
</Grid>    
(my gui is located in the folder Assets/GUI, as a result, the template path is what is ../NoesisGUI/Themes/NoesisStyle.xaml)

When you interact with the button of this code when it's the root, the gui disappears and Unity enters a lock up state. It does the same with the WindowsStyle, but not with the SimpleSyle nor OrbStyle. As a temporar work around i disabled the Button style in the NoesisStyle.xaml line 293. I think the issue is related to the animation of the control when the control is touching the borders of the screen, however my level of WPF is not advanced enough to give you more information than that.
It is a bug. Added to the bugtracker.
Edit :
I have another question. From what i understood, NoesisGUI is multithread, so i would like to know if it is guaranteed that the event from NoesisGui are raised on same thread than Unity. This is important because Unity engine methods are not re-entrant.
Thanks in advance.
Yes, it is guaranteed. Although NoesisGUI uses threads internally the API offered to the client hides that. Callbacks are always invoked in the unity main thread.

By the way, it is better if instead if editing a post to ask new questions you create a new one. it seems that the notification system of the forum does not email us when a post is edited. Thanks!
 
Shorinji
Topic Author
Posts: 24
Joined: 16 Aug 2013, 19:45
Location: Shanghai

Re: Noob questions about wether some things are possible or

09 Sep 2013, 20:20

Hi,

Thanks for the answers. Actually i was editing the post on purpose in order not to spam you because otherwise you are going to start hating me :)
Anyway, i think i will have to create that account on the bug tracker because i guess it's adding load on you if i just post the bugs here.

I would have a question about your policy about the different styles provided with NoesisGUI. Can we reuse part or all of the styles you provided in our games or do we have to recreate or own styles from scratch? I must say i really like the NoesisStyle, it looks cool.

I created a blog about my game and i would like to post some screenshots of it, so i need to know if i have the authorization to do so knowing that my gui is using the NoesisStyle right now except for the button from which i removed the style.

Thanks in advance.
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Noob questions about wether some things are possible or

11 Sep 2013, 01:58


Thanks for the answers. Actually i was editing the post on purpose in order not to spam you because otherwise you are going to start hating me :)
hehe Getting feedback from users is not a reason to hate, in fact it is the opposite. Open as many threads as you want. I cannot guarantee you fast responses for everything but we try to answer all the posts.
I would have a question about your policy about the different styles provided with NoesisGUI. Can we reuse part or all of the styles you provided in our games or do we have to recreate or own styles from scratch? I must say i really like the NoesisStyle, it looks cool.

I created a blog about my game and i would like to post some screenshots of it, so i need to know if i have the authorization to do so knowing that my gui is using the NoesisStyle right now except for the button from which i removed the style.
Yes, absolutely. Our styles are provided as samples. You can reuse, modify them as you like. By the way, NoesisStyle is pending a revision because it can be optimized in several aspects. If you find bugs or improvements do not hesitate to post about it here.

Is the blog already online? I would love to see it.
 
Shorinji
Topic Author
Posts: 24
Joined: 16 Aug 2013, 19:45
Location: Shanghai

Re: Noob questions about wether some things are possible or

13 Sep 2013, 10:27

Hi,

As you asked for the blog link, here it is. It's only the beginning so there is not much on it yet. I mentioned NoesisGUI on it so I hope you agree with what said.

http://projectminingvessel.blogspot.com/

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 63 guests