Beispiel #1
0
        static void Main(string[] args)
        {
            LogManager.Configuration = new LoggingConfiguration();

            var target = new ConsoleTarget("PinMameSilk");

            LogManager.Configuration.AddTarget(target);
            LogManager.Configuration.AddRule(LogLevel.Info, LogLevel.Fatal, target);

            LogManager.ReconfigExistingLoggers();

            var options = WindowOptions.Default;

            options.Size  = new Vector2D <int>(128 * 6, 32 * 6);
            options.Title = "PinMAME Silk";

            var window = Window.Create(options);

            DmdController       dmdController       = null;
            UIOverlayController uiOverlayController = null;
            PinMameController   pinMameController   = null;

            GL gl = null;

            window.Load += () =>
            {
                gl = GL.GetApi(window);

                var input = window.CreateInput();

                dmdController       = DmdController.Instance(window);
                uiOverlayController = UIOverlayController.Instance(window, input, gl);
                pinMameController   = PinMameController.Instance();

                // (ImGui needs resize message first)

                window.Resize += (size) =>
                {
                    size.Y = size.X * 32 / 128;

                    window.Size = size;
                };
            };

            window.FramebufferResize += (size) =>
            {
                gl.Viewport(size);
            };

            window.Render += (delta) =>
            {
                gl.Clear((uint)ClearBufferMask.ColorBufferBit);
                gl.ClearColor(1.0f, 1.0f, 0.0f, 1.0f);

                dmdController.Render();
                uiOverlayController.Render(delta);
            };

            window.Run();
        }
Beispiel #2
0
        private UIOverlayController(IView window, IInputContext input, GL gl)
        {
            _window = window;
            _input  = input;

            _imGuiController = new ImGuiController(
                gl,
                window,
                _input);

            _imGuiFadeInOut = new ImGuiFadeInOut();

            _pinMameController = PinMameController.Instance(_input);
            _dmdController     = DmdController.Instance();
        }
 public static PinMameController Instance(IInputContext input = null) =>
 _instance ?? (_instance = new PinMameController(input));