示例#1
0
        private bool UpdateFrame()
        {
            if (!_isActive)
            {
                return(true);
            }

            if (_isStopped)
            {
                return(false);
            }

            NpadManager.Update();

            // Touchscreen
            bool hasTouch = false;

            // Get screen touch position
            if (!_enableMouse)
            {
                hasTouch = TouchScreenManager.Update(true, (_inputManager.MouseDriver as SDL2MouseDriver).IsButtonPressed(MouseButton.Button1), _aspectRatio.ToFloat());
            }

            if (!hasTouch)
            {
                TouchScreenManager.Update(false);
            }

            Device.Hid.DebugPad.Update();

            return(true);
        }
示例#2
0
        public void Initialize(Switch device, List <InputConfig> inputConfigs, bool enableKeyboard, bool enableMouse)
        {
            Device   = device;
            Renderer = Device.Gpu.Renderer;

            NpadManager.Initialize(device, inputConfigs, enableKeyboard, enableMouse);
            TouchScreenManager.Initialize(device);
        }
示例#3
0
        public void Initialize(Switch device)
        {
            Device   = device;
            Renderer = Device.Gpu.Renderer;
            Renderer.Window?.SetSize(_windowWidth, _windowHeight);

            if (Renderer != null)
            {
                Renderer.ScreenCaptured += Renderer_ScreenCaptured;
            }

            NpadManager.Initialize(device, ConfigurationState.Instance.Hid.InputConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
            TouchScreenManager.Initialize(device);
        }
示例#4
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                _isActive = false;
                TouchScreenManager?.Dispose();
                NpadManager.Dispose();

                SDL2Driver.Instance.UnregisterWindow(_windowId);

                SDL_DestroyWindow(WindowHandle);

                SDL2Driver.Instance.Dispose();
            }
        }
示例#5
0
        public void Exit()
        {
            TouchScreenManager?.Dispose();
            NpadManager?.Dispose();

            if (_isStopped)
            {
                return;
            }

            _isStopped = true;
            _isActive  = false;

            _exitEvent.WaitOne();
            _exitEvent.Dispose();
        }
示例#6
0
        public void Initialize(Switch device, List <InputConfig> inputConfigs, bool enableKeyboard, bool enableMouse)
        {
            Device = device;

            IRenderer renderer = Device.Gpu.Renderer;

            if (renderer is ThreadedRenderer tr)
            {
                renderer = tr.BaseRenderer;
            }

            Renderer = renderer;

            NpadManager.Initialize(device, inputConfigs, enableKeyboard, enableMouse);
            TouchScreenManager.Initialize(device);
        }
示例#7
0
        public void Exit()
        {
            TouchScreenManager?.Dispose();
            NpadManager?.Dispose();

            if (_isStopped)
            {
                return;
            }

            _gpuCancellationTokenSource.Cancel();

            _isStopped = true;
            _isActive  = false;

            _exitEvent.WaitOne();
            _exitEvent.Dispose();
        }
示例#8
0
        public void Initialize(Switch device)
        {
            Device = device;

            IRenderer renderer = Device.Gpu.Renderer;

            if (renderer is ThreadedRenderer tr)
            {
                renderer = tr.BaseRenderer;
            }

            Renderer = renderer;
            Renderer?.Window?.SetSize(WindowWidth, WindowHeight);

            if (Renderer != null)
            {
                Renderer.ScreenCaptured += Renderer_ScreenCaptured;
            }

            NpadManager.Initialize(device, ConfigurationState.Instance.Hid.InputConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
            TouchScreenManager.Initialize(device);
        }
示例#9
0
 private void txtDisplayName_MouseClick(object sender, MouseEventArgs e)
 {
     TouchScreenManager.ShowOSK(this.txtDisplayName);
 }
示例#10
0
 private void txtDescription_MouseClick(object sender, MouseEventArgs e)
 {
     TouchScreenManager.ShowOSK(this.txtDescription);
 }
示例#11
0
 private void txtDuplicatesCount_MouseClick(object sender, MouseEventArgs e)
 {
     TouchScreenManager.ShowOSK(this.txtDuplicatesCount);
 }
示例#12
0
 private void txtSerialNumber_MouseClick(object sender, MouseEventArgs e)
 {
     TouchScreenManager.ShowOSK(this.txtSerialNumber);
 }
示例#13
0
 private void txtMaterialDisplayName1_MouseClick(object sender, MouseEventArgs e)
 {
     TouchScreenManager.ShowOSK(txtMaterialDisplayName1);
 }
示例#14
0
 private void txtMaterialDisplayName1_Enter(object sender, EventArgs e)
 {
     TouchScreenManager.ShowOSK(txtMaterialDisplayName1);
 }
示例#15
0
        private bool UpdateFrame()
        {
            if (!_isActive)
            {
                return(true);
            }

            if (_isStopped)
            {
                return(false);
            }

            if ((Toplevel as MainWindow).IsFocused)
            {
                Application.Invoke(delegate
                {
                    KeyboardStateSnapshot keyboard = _keyboardInterface.GetKeyboardStateSnapshot();

                    HandleScreenState(keyboard);

                    if (keyboard.IsPressed(Key.Delete))
                    {
                        if (!ParentWindow.State.HasFlag(WindowState.Fullscreen))
                        {
                            Ptc.Continue();
                        }
                    }
                });
            }

            NpadManager.Update(ConfigurationState.Instance.Graphics.AspectRatio.Value.ToFloat());

            if ((Toplevel as MainWindow).IsFocused)
            {
                KeyboardHotkeyState currentHotkeyState = GetHotkeyState();

                if (currentHotkeyState.HasFlag(KeyboardHotkeyState.ToggleVSync) &&
                    !_prevHotkeyState.HasFlag(KeyboardHotkeyState.ToggleVSync))
                {
                    Device.EnableDeviceVsync = !Device.EnableDeviceVsync;
                }

                if ((currentHotkeyState.HasFlag(KeyboardHotkeyState.Screenshot) &&
                     !_prevHotkeyState.HasFlag(KeyboardHotkeyState.Screenshot)) || ScreenshotRequested)
                {
                    ScreenshotRequested = false;

                    Renderer.Screenshot();
                }

                _prevHotkeyState = currentHotkeyState;
            }

            // Touchscreen
            bool hasTouch = false;

            // Get screen touch position
            if ((Toplevel as MainWindow).IsFocused && !ConfigurationState.Instance.Hid.EnableMouse)
            {
                hasTouch = TouchScreenManager.Update(true, (_inputManager.MouseDriver as GTK3MouseDriver).IsButtonPressed(MouseButton.Button1), ConfigurationState.Instance.Graphics.AspectRatio.Value.ToFloat());
            }

            if (!hasTouch)
            {
                TouchScreenManager.Update(false);
            }

            Device.Hid.DebugPad.Update();

            return(true);
        }
 private void txtInputValue_MouseClick(object sender, MouseEventArgs e)
 {
     TouchScreenManager.ShowOSK(this.txtInputValue);
 }
示例#17
0
 private void txtSlicerStartIndex_MouseClick(object sender, MouseEventArgs e)
 {
     TouchScreenManager.ShowOSK(this.txtSlicerStartIndex);
 }