Esempio n. 1
0
        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            base.OnUpdateFrame(e);

            if (OTKInput.MouseRelease(OpenTK.Input.MouseButton.Left))
            {
                NTRInput.TouchscreenRelease();
            }
            else if (OTKInput.MouseDown(OpenTK.Input.MouseButton.Left))
            {
                int width  = screenWidth;
                int height = (int)((float)width / targetAspectRatio + 0.5f);

                if (height > screenHeight)
                {
                    height = screenHeight;
                    width  = (int)((float)height * targetAspectRatio + 0.5f);
                }

                int vpX = (screenWidth / 2) - (width / 2);
                int vpY = (screenHeight / 2) - (height / 2);

                //--

                if (height >= screenHeight)
                {
                    if (OTKInput.MouseX >= vpX)
                    {
                        int X = OTKInput.MouseX - vpX;
                        int Y = OTKInput.MouseY;

                        if (X <= width)
                        {
                            X = (int)(((double)X / (double)width) * (double)virtualWidth);
                            Y = (int)(((double)Y / (double)height) * (double)virtualHeight);

                            NTRInput.TouchscreenClick(X, Y);

                            //Pillarbox, subtract left/right
                            //Console.WriteLine("BOTTOM P vp " + vpX + " " + vpY);
                            //Console.WriteLine("BOTTOM P Click " + X + " " + Y);
                        }
                    }
                }
                else
                {
                    if (OTKInput.MouseY >= vpY)
                    {
                        int X = OTKInput.MouseX;
                        int Y = OTKInput.MouseY - vpY;

                        if (Y <= height)
                        {
                            X = (int)(((double)X / (double)width) * (double)virtualWidth);
                            Y = (int)(((double)Y / (double)height) * (double)virtualHeight);

                            NTRInput.TouchscreenClick(X, Y);

                            //Letterbox, subtract top/bottom
                            //Console.WriteLine("BOTTOM L vp " + vpX + " " + vpY);
                            //Console.WriteLine("BOTTOM L Click " + X + " " + Y);
                        }
                    }
                }
            }

            OTKInput.Update();
        }
Esempio n. 2
0
        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            base.OnUpdateFrame(e);

            OTKInput.Update();
        }