Ejemplo n.º 1
0
        public ImGuiManager(ImGuiOptions options = null)
        {
            _renderer = new ImGuiRenderer(Core.instance);

            if (options != null)
            {
                foreach (var font in options._fonts)
                {
                    ImGui.GetIO().Fonts.AddFontFromFileTTF(font.Item1, font.Item2);
                }
            }

            _renderer.rebuildFontAtlas(options?._includeDefaultFont ?? true);
            Core.emitter.addObserver(CoreEvents.SceneChanged, onSceneChanged);
            applyTheme();

            // find all Scenes
            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                foreach (var type in assembly.GetTypes())
                {
                    if (type.BaseType == typeof(Scene))
                    {
                        if (type.GetConstructor(Type.EmptyTypes) != null)
                        {
                            _sceneSubclasses.Add(type);
                        }
                    }
                }
            }

            // find all themes
            _themes = typeof(NezImGuiThemes).GetMethods(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
        }
Ejemplo n.º 2
0
        public ImGuiManager(ImGuiOptions options = null)
        {
            if (options == null)
            {
                options = new ImGuiOptions();
            }

            _gameWindowFirstPosition = options._gameWindowFirstPosition;
            _gameWindowTitle         = options._gameWindowTitle;
            _gameWindowFlags         = options._gameWindowFlags;

            LoadSettings();
            _renderer = new ImGuiRenderer(Core.Instance);

            _renderer.RebuildFontAtlas(options);
            Core.Emitter.AddObserver(CoreEvents.SceneChanged, OnSceneChanged);
            NezImGuiThemes.DarkTheme1();

            // find all Scenes
            _sceneSubclasses = ReflectionUtils.GetAllSubclasses(typeof(Scene), true);

            // tone down indent
            ImGui.GetStyle().IndentSpacing = 12;
            ImGui.GetIO().ConfigWindowsMoveFromTitleBarOnly = true;

            // find all themes
            _themes = typeof(NezImGuiThemes).GetMethods(System.Reflection.BindingFlags.Static |
                                                        System.Reflection.BindingFlags.Public);
        }
Ejemplo n.º 3
0
        public ImGuiManager(ImGuiOptions options = null)
        {
            loadSettings();
            _renderer = new ImGuiRenderer(Core.instance);

            _renderer.rebuildFontAtlas(options);
            Core.emitter.addObserver(CoreEvents.SceneChanged, onSceneChanged);
            NezImGuiThemes.darkTheme1();

            // find all Scenes
            _sceneSubclasses = ReflectionUtils.getAllSubclasses(typeof(Scene), true);

            // tone down indent
            ImGui.GetStyle().IndentSpacing = 12;

            // find all themes
            _themes = typeof(NezImGuiThemes).GetMethods(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
        }