Example #1
0
        private void BtnRun_Click(object sender, EventArgs e)
        {
            if (chkLumaInputRedirection.Checked)
            {
                NetworkLuma.Start(txtIP.Text);
                Console.WriteLine("Luma UDP started.");
            }

            int priority = (chkOnly.Checked ? 0 : (int)numericPriority.Value);

            Network.Start(txtIP.Text, priority, (chkPriorityTop.Checked ? 1 : 0), (int)numQuality.Value, (int)numQoS.Value);
            if (Network.tcpClientStream != null)
            {
                NTRInput.Open(chkLumaInputRedirection.Checked);

                if (!chkOnly.Checked || (chkOnly.Checked && chkPriorityTop.Checked))
                {
                    threadOpenTK1 = new Thread(() => {
                        viewerTop = new ViewerTop(470, 280);
                        viewerTop.DisplayFPS(chkDisplayFPS.Checked);
                        viewerTop.Run();
                    });
                    threadOpenTK1.Start();
                }

                if (!chkOnly.Checked || (chkOnly.Checked && !chkPriorityTop.Checked))
                {
                    threadOpenTK2 = new Thread(() => {
                        viewerBottom = new ViewerBottom(470, 280);
                        viewerBottom.DisplayFPS(chkDisplayFPS.Checked);
                        viewerBottom.Run();
                    });
                    threadOpenTK2.Start();
                }

                while (viewerTop == null && (!chkOnly.Checked || (chkOnly.Checked && chkPriorityTop.Checked)))
                {
                    Thread.Yield();
                }

                while (viewerTop == null && (!chkOnly.Checked || (chkOnly.Checked && !chkPriorityTop.Checked)))
                {
                    Thread.Yield();
                }
            }
        }
Example #2
0
        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (threadOpenTK1 != null)
            {
                threadOpenTK1.Abort();
                threadOpenTK1.Join();
            }

            if (threadOpenTK2 != null)
            {
                threadOpenTK2.Abort();
                threadOpenTK2.Join();
            }

            NTRInput.Close();

            Environment.Exit(0);
        }
Example #3
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();
        }
Example #4
0
 private void btnSendHome_Click(object sender, EventArgs e)
 {
     NTRInput.SendHome();
 }