/// <summary>
        /// フォーム生成時に呼ばれる
        /// </summary>
        public BaseForm()
        {
            // 自動生成コード
            InitializeComponent();

            // 画面遷移制御クラス
            ScreenTransition = new ScreenTransitionClass();

            // 各種イベント設定
            EventRegistration();

            // 最初の画面を表示する
            ScreenTransition.ChangeTopView();

            // タッチ入力画面の生成
            TouchInputForm = new TouchForm(this);
            // タッチ入力画面をBaseFormにオーナー登録
            this.AddOwnedForm(TouchInputForm);

            // タッチイベント設定
            TouchEventRegistration();
        }
Exemple #2
0
        public RenderFrame()
        {
            var bound = Screen.AllScreens[Config.DisplayScreen].Bounds;

            Config.Width  = bound.Width;
            Config.Height = bound.Height;

            Point windowSize = new Point(Config.Width, Config.Height);

            Instance   = this;
            RenderForm = new TouchForm("GameOfLife")
            {
                StartPosition   = FormStartPosition.Manual,
                FormBorderStyle = FormBorderStyle.None,
                ClientSize      = new Size(windowSize),
                Location        = new Point(bound.X, bound.Y),
            };

            CreateDeviceSwapChainContext();
            Initialize();
            SetContextStates();
            OverrideEvents();

            spriteBatch  = new SpriteBatch();
            inputHandler = new TextureInput(device);
            gol          = new GameOfLifeCalculator();
            QueryPerformanceFrequency(out freq);
            QueryPerformanceCounter(out tickPrev);
            UI = new Userinterface(inputHandler);

            RenderForm.MouseMove  += RenderForm_MouseMove;
            RenderForm.MouseWheel += RenderForm_MouseWheel;
            RenderForm.MouseDown  += OnMouseDown;
            RenderForm.MouseUp    += RenderForm_MouseUp;

            RenderForm.Touchdown += OnTouchDownHandler;
            RenderForm.Touchup   += OnTouchUpHandler;
            RenderForm.TouchMove += OnTouchMoveHandler;
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public Form CreateTouchForm(GameParameters parameters, Output output)
        {
            var form = new TouchForm()
            {
                Text          = parameters.Title,
                BackColor     = System.Drawing.Color.Black,
                ClientSize    = new System.Drawing.Size(parameters.Width, parameters.Height),
                Icon          = parameters.Icon ?? Fusion.Properties.Resources.fusionIcon,
                ControlBox    = false,
                StartPosition = output == null ? FormStartPosition.CenterScreen : FormStartPosition.Manual,
            };


            if (output != null)
            {
                var bounds = output.Description.DesktopBounds;
                var scrW   = bounds.Right - bounds.Left;
                var scrH   = bounds.Bottom - bounds.Top;

                form.Location = new System.Drawing.Point(bounds.Left + (scrW - form.Width) / 2, bounds.Top + (scrH - form.Height) / 2);
                form.Text    += " - [" + output.Description.DeviceName + "]";
            }

            form.KeyDown  += form_KeyDown;
            form.KeyUp    += form_KeyUp;
            form.KeyPress += form_KeyPress;
            form.Resize   += (s, e) => Game.InputDevice.RemoveAllPressedKey();
            form.Move     += (s, e) => Game.InputDevice.RemoveAllPressedKey();

            form.TouchTap          += (pos) => Game.InputDevice.NotifyTouchTap(pos);
            form.TouchDoubleTap    += (pos) => Game.InputDevice.NotifyTouchDoubleTap(pos);
            form.TouchSecondaryTap += (pos) => Game.InputDevice.NotifyTouchSecondaryTap(pos);
            form.TouchManipulation += (center, delta, scale) => Game.InputDevice.NotifyTouchManipulation(center, delta, scale);

            return(form);
        }
Exemple #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public Form CreateForm(GraphicsParameters parameters, Output output, bool supportTouch)
        {
            Form      form      = null;
            TouchForm touchForm = null;

            var text       = Game.GameTitle;
            var color      = System.Drawing.Color.Black;
            var clientSize = new System.Drawing.Size(parameters.Width, parameters.Height);
            var icon       = Game.Icon ?? Fusion.Properties.Resources.fusionIcon;
            var controlBox = false;
            var startPos   = output == null ? FormStartPosition.CenterScreen : FormStartPosition.Manual;

            //var windowState	=	parameters.FullScreen ? FormWindowState.Maximized : FormWindowState.Normal;
            //var border		=	parameters.FullScreen ? FormBorderStyle.None : FormBorderStyle.Sizable;

            var windowState = FormWindowState.Normal;
            var border      = FormBorderStyle.Sizable;


            if (supportTouch)
            {
                touchForm = new TouchForm()
                {
                    Text            = text,
                    BackColor       = color,
                    ClientSize      = clientSize,
                    Icon            = icon,
                    ControlBox      = controlBox,
                    StartPosition   = startPos,
                    WindowState     = windowState,
                    FormBorderStyle = border,
                };
                form = touchForm;
            }
            else
            {
                form = new Form()
                {
                    Text            = text,
                    BackColor       = color,
                    ClientSize      = clientSize,
                    Icon            = icon,
                    ControlBox      = controlBox,
                    StartPosition   = startPos,
                    WindowState     = windowState,
                    FormBorderStyle = border,
                };
            }


            if (output != null)
            {
                var bounds = output.Description.DesktopBounds;
                var scrW   = bounds.Right - bounds.Left;
                var scrH   = bounds.Bottom - bounds.Top;

                form.Location = new System.Drawing.Point(bounds.Left + (scrW - form.Width) / 2, bounds.Top + (scrH - form.Height) / 2);
                form.Text    += " - [" + output.Description.DeviceName + "]";
            }

                        #if false
            form.MouseDown += Form_MouseDown;
                        #endif

            form.KeyDown     += form_KeyDown;
            form.KeyUp       += form_KeyUp;
            form.KeyPress    += form_KeyPress;
            form.Resize      += (s, e) => Game.InputDevice.RemoveAllPressedKeys();
            form.Move        += (s, e) => Game.InputDevice.RemoveAllPressedKeys();
            form.FormClosing += form_FormClosing;

            if (supportTouch)
            {
                touchForm.PointerUp          += (s, e) => Game.Touch.CallPointerUpEvent(e.PointerID, e.Location);
                touchForm.PointerDown        += (s, e) => Game.Touch.CallPointerDownEvent(e.PointerID, e.Location);
                touchForm.PointerUpdate      += (s, e) => Game.Touch.CallPointerUpdateEvent(e.PointerID, e.Location);
                touchForm.PointerLostCapture += (s, e) => Game.Touch.CallPointerLostCapture();
            }

            ChangeFullscreen(form, parameters.FullScreen);

            return(form);
        }