Beispiel #1
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;

            // find all themes
            _themes = typeof(NezImGuiThemes).GetMethods(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
        }
Beispiel #2
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);
        }