Home | Documentation | Atomic Chat | Github

Some beginner's questions


#1

Hi,

Simple questions:

  1. I have created a simple view:
using AtomicEngine;

namespace Views
{
    public class SplashView : UIView
    {
        public UIWindow Form { get; } = new UIWindow();

        public SplashView()
        {
            Form = CreateForm();

            UpdateRects();
        }

        private UIWindow CreateForm()
        {
            var form = new UIWindow();
            form.Settings = UI_WINDOW_SETTINGS.UI_WINDOW_SETTINGS_NONE;
            form.SetSkinBg("Shared::Background");
            form.SetOpacity(0.0f);

            AddChild(form);
            return form;
        }

        public void UpdateRects()
        {
            UpdateFormRect();
        }

        private void UpdateFormRect()
        {
            Form.SetRect(GetRect());
        }
    }
}

To be more exactly it’s created in Start() of Component.
As you can see opacity is set to 0 and the problem is that the window on start is visible for ~1 second (blink).
It just look like the opacity is ignored on the first frames or something like that.
Is this a bug or correct behaviour? How should I deal with it?

  1. Why LoadScene() of Player is changing scene? This shouldn’t be default behaviour, especially that it returns scene object which can be never used because scene is changing. Is there method that only load scene object, so I can use SetCurrentScene()?

  2. Is there a way to use PCL instead of Shared project? I can see that PCL is created, but it’s not referenced by any platform project. It’s safe to delete Shared project and use PCL instead? Or .NET Standard lib which is even better option.
    The reason is micfunctioned Resharper.

  3. I want to do some async things by using Task (can be anything else that works), but atomic is complaining about non main-thread usage. How to deal with it?


#2
  1. I’m guessing that the default value for opacity is 100.0, but from what I’ve seen, the opacity can be inherited from the parent, so adding doing this may help…
        public SplashView()
        {
            SetOpacity(0.0f);   // you cant see me, maybe
            Form = CreateForm();

            UpdateRects();
        }

And you’d still be responsible for setting the opacity back up, you might only need to do it on the Window you created.
2. At the present time, no, there is not a way to get a Scene into the player’s list of scenes other than LoadScene(). I would think that having an AddScene() method would have merit, and would need to be submiited as an Issue.
4 .the current graphics subsystem (maybe others) have things that must be done in the main thread, I’m not sure if there is an elegant solution, other than not making graphics calls in Tasks.


#3

Thx @JimMarlowe for your response.

Actually it is inherited from parent. Working on opacity of view instead of window, does the trick and works well. However this shouldn’t be the solution to this.

I would rather want to see more common practice of view/scene/screen managing, which is: PushScene, PopScene, SetCurrentScene and LoadScene(only load scene). Those methods works on stack of scenes and provides any functionallity that you could want.

Oh, ok.