Exemplo n.º 1
0
        public SoftwareKeyboardRenderer(IHostUiTheme uiTheme)
        {
            _renderer = new SoftwareKeyboardRendererBase(uiTheme);

            StartTextBoxBlinker(_textBoxBlinkTimedAction, _state, _stateLock);
            StartRenderer(_renderAction, _renderer, _state, _stateLock);
        }
Exemplo n.º 2
0
        public WindowBase(InputManager inputManager, GraphicsDebugLevel glLogLevel, AspectRatio aspectRatio, bool enableMouse)
        {
            MouseDriver   = new SDL2MouseDriver();
            _inputManager = inputManager;
            _inputManager.SetMouseDriver(MouseDriver);
            NpadManager        = _inputManager.CreateNpadManager();
            TouchScreenManager = _inputManager.CreateTouchScreenManager();
            _keyboardInterface = (IKeyboard)_inputManager.KeyboardDriver.GetGamepad("0");
            _glLogLevel        = glLogLevel;
            _chrono            = new Stopwatch();
            _ticksPerFrame     = Stopwatch.Frequency / TargetFps;
            _exitEvent         = new ManualResetEvent(false);
            _aspectRatio       = aspectRatio;
            _enableMouse       = enableMouse;
            HostUiTheme        = new HeadlessHostUiTheme();

            SDL2Driver.Instance.Initialize();
        }
Exemplo n.º 3
0
        public SoftwareKeyboardRendererBase(IHostUiTheme uiTheme)
        {
            int ryujinxLogoSize = 32;

            Stream logoStream = EmbeddedResources.GetStream("Ryujinx.Ui.Common/Resources/Logo_Ryujinx.png");

            _ryujinxLogo = LoadResource(logoStream, ryujinxLogoSize, ryujinxLogoSize);

            string padAcceptIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_BtnA.png";
            string padCancelIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_BtnB.png";
            string keyModeIconPath   = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_KeyF6.png";

            _padAcceptIcon = LoadResource(Assembly.GetExecutingAssembly(), padAcceptIconPath, 0, 0);
            _padCancelIcon = LoadResource(Assembly.GetExecutingAssembly(), padCancelIconPath, 0, 0);
            _keyModeIcon   = LoadResource(Assembly.GetExecutingAssembly(), keyModeIconPath, 0, 0);

            Color panelColor               = ToColor(uiTheme.DefaultBackgroundColor, 255);
            Color panelTransparentColor    = ToColor(uiTheme.DefaultBackgroundColor, 150);
            Color borderColor              = ToColor(uiTheme.DefaultBorderColor);
            Color selectionBackgroundColor = ToColor(uiTheme.SelectionBackgroundColor);

            _textNormalColor     = ToColor(uiTheme.DefaultForegroundColor);
            _textSelectedColor   = ToColor(uiTheme.SelectionForegroundColor);
            _textOverCursorColor = ToColor(uiTheme.DefaultForegroundColor, null, true);

            float cursorWidth = 2;

            _textBoxOutlineWidth = 2;
            _padPressedPenWidth  = 2;

            _panelBrush        = new SolidBrush(panelColor);
            _disabledBrush     = new SolidBrush(panelTransparentColor);
            _cursorBrush       = new SolidBrush(_textNormalColor);
            _selectionBoxBrush = new SolidBrush(selectionBackgroundColor);

            _textBoxOutlinePen = new Pen(borderColor, _textBoxOutlineWidth);
            _cursorPen         = new Pen(_textNormalColor, cursorWidth);
            _selectionBoxPen   = new Pen(selectionBackgroundColor, cursorWidth);
            _padPressedPen     = new Pen(borderColor, _padPressedPenWidth);

            _inputTextFontSize = 20;

            CreateFonts(uiTheme.FontFamily);
        }
Exemplo n.º 4
0
        public SoftwareKeyboardRenderer(IHostUiTheme uiTheme)
        {
            _surfaceInfo = new RenderingSurfaceInfo(0, 0, 0, 0, 0);

            string ryujinxLogoPath = "Ryujinx.Ui.Resources.Logo_Ryujinx.png";
            int    ryujinxLogoSize = 32;

            _ryujinxLogo = LoadResource(Assembly.GetEntryAssembly(), ryujinxLogoPath, ryujinxLogoSize, ryujinxLogoSize);

            string padAcceptIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_BtnA.png";
            string padCancelIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_BtnB.png";
            string keyModeIconPath   = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_KeyF6.png";

            _padAcceptIcon = LoadResource(Assembly.GetExecutingAssembly(), padAcceptIconPath, 0, 0);
            _padCancelIcon = LoadResource(Assembly.GetExecutingAssembly(), padCancelIconPath, 0, 0);
            _keyModeIcon   = LoadResource(Assembly.GetExecutingAssembly(), keyModeIconPath, 0, 0);

            Color panelColor               = ToColor(uiTheme.DefaultBackgroundColor, 255);
            Color panelTransparentColor    = ToColor(uiTheme.DefaultBackgroundColor, 150);
            Color normalTextColor          = ToColor(uiTheme.DefaultForegroundColor);
            Color invertedTextColor        = ToColor(uiTheme.DefaultForegroundColor, null, true);
            Color selectedTextColor        = ToColor(uiTheme.SelectionForegroundColor);
            Color borderColor              = ToColor(uiTheme.DefaultBorderColor);
            Color selectionBackgroundColor = ToColor(uiTheme.SelectionBackgroundColor);
            Color gridSeparatorColor       = Color.FromArgb(180, 255, 255, 255);

            float cursorWidth = 2;

            _textBoxOutlineWidth = 2;
            _padPressedPenWidth  = 2;

            _panelBrush          = new SolidBrush(panelColor);
            _disabledBrush       = new SolidBrush(panelTransparentColor);
            _textNormalBrush     = new SolidBrush(normalTextColor);
            _textSelectedBrush   = new SolidBrush(selectedTextColor);
            _textOverCursorBrush = new SolidBrush(invertedTextColor);
            _cursorBrush         = new SolidBrush(normalTextColor);
            _selectionBoxBrush   = new SolidBrush(selectionBackgroundColor);
            _keyCapBrush         = Brushes.White;
            _keyProgressBrush    = new SolidBrush(borderColor);

            _gridSeparatorPen  = new Pen(gridSeparatorColor, 2);
            _textBoxOutlinePen = new Pen(borderColor, _textBoxOutlineWidth);
            _cursorPen         = new Pen(normalTextColor, cursorWidth);
            _selectionBoxPen   = new Pen(selectionBackgroundColor, cursorWidth);
            _padPressedPen     = new Pen(borderColor, _padPressedPenWidth);

            _inputTextFontSize = 20;
            _padButtonFontSize = 24;

            string font = uiTheme.FontFamily;

            _messageFont    = new Font(font, 26, FontStyle.Regular, GraphicsUnit.Pixel);
            _inputTextFont  = new Font(font, _inputTextFontSize, FontStyle.Regular, GraphicsUnit.Pixel);
            _labelsTextFont = new Font(font, 24, FontStyle.Regular, GraphicsUnit.Pixel);
            _padSymbolFont  = new Font(font, _padButtonFontSize, FontStyle.Regular, GraphicsUnit.Pixel);
            _keyCapFont     = new Font(font, 15, FontStyle.Regular, GraphicsUnit.Pixel);

            // System.Drawing has serious problems measuring strings, so it requires a per-pixel calibration
            // to ensure we are rendering text inside the proper region
            _inputTextCalibrationHeight = CalibrateTextHeight(_inputTextFont);

            StartTextBoxBlinker(_textBoxBlinkTimedAction, _textBoxBlinkCounter);
        }
Exemplo n.º 5
0
        public GtkHostUiHandler(Window parent)
        {
            _parent = parent;

            HostUiTheme = new GtkHostUiTheme(parent);
        }
Exemplo n.º 6
0
        public AvaHostUiHandler(MainWindow parent)
        {
            _parent = parent;

            HostUiTheme = new AvaloniaHostUiTheme(parent);
        }