瀏覽代碼

glassesWindow now starts fullscreen on second monitor

Alexander Hendrich 10 年之前
父節點
當前提交
6fc12ab7cd

+ 12 - 7
bbiwarg/BBWIWARG.cs

@@ -25,11 +25,13 @@ namespace bbiwarg
         private Int16 tuioPort;
         private TuioCommunicator tuioCommunicator;
 
+        private bool debugWindowEnabled;
         private DebugWindow debugWindow;
-        private GlassesWindow glassesWindow;
-
         private Thread debugWindowThread;
+
+        private bool glassesWindowEnabled;
         private Thread glassesWindowThread;
+        private GlassesWindow glassesWindow;
 
         static void Main(string[] args)
         {
@@ -43,6 +45,9 @@ namespace bbiwarg
         {
             handleArgs(args);
 
+            debugWindowEnabled = Parameters.DebugWindowEnabled;
+            glassesWindowEnabled = Parameters.GlassesWindowEnabled && Screen.AllScreens.Count() >= 2;
+
             // inputProvider
             createInputProvider();
             inputProvider.initialize();
@@ -59,11 +64,11 @@ namespace bbiwarg
             }
 
             // debug output
-            if (Parameters.DebugWindowEnabled)
+            if (debugWindowEnabled)
                 debugWindowThread = new Thread(new ThreadStart(debugWindowThreadStart));
 
             // glasses output
-            if (Parameters.GlassesWindowEnabled)
+            if (glassesWindowEnabled)
                 glassesWindowThread = new Thread(new ThreadStart(glassesWindowThreadStart));
 
         }
@@ -89,16 +94,16 @@ namespace bbiwarg
 
         private void glassesWindowThreadStart()
         {
-            glassesWindow = new GlassesWindow(inputProvider, inputHandler, Parameters.GlassesWindowTitle, Parameters.GlassesWindowOutputSize, Parameters.GlassesWindowUpdateInterval);
+            glassesWindow = new GlassesWindow(inputProvider, inputHandler, Parameters.GlassesWindowTitle, Screen.AllScreens[1], Parameters.GlassesWindowUpdateInterval);
             Application.Run(glassesWindow);
         }
 
         private void handleDeviceStartedEvent(object sender, EventArgs e)
         {
-            if (Parameters.DebugWindowEnabled)
+            if (debugWindowEnabled)
                 debugWindowThread.Start();
 
-            if (Parameters.GlassesWindowEnabled)
+            if (glassesWindowEnabled)
                 glassesWindowThread.Start();
         }
 

+ 2 - 0
bbiwarg/Output/GlassesOutput/GlassesWindow.Designer.cs

@@ -52,7 +52,9 @@
             this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
             this.ClientSize = new System.Drawing.Size(1284, 702);
             this.Controls.Add(this.imageBox);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
             this.Name = "GlassesWindow";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
             this.Text = "GlassesWindow";
             this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GlassesWindow_OnKeyDown);
             ((System.ComponentModel.ISupportInitialize)(this.imageBox)).EndInit();

+ 7 - 2
bbiwarg/Output/GlassesOutput/GlassesWindow.cs

@@ -31,14 +31,14 @@ namespace bbiwarg.Output.GlassesOutput
         private bool calibrationImageUpToDate;
         private Random rand;
 
-        public GlassesWindow(InputProvider inputProvider, InputHandler inputHandler, String name, ImageSize outputSize, int updateInterval)
+        public GlassesWindow(InputProvider inputProvider, InputHandler inputHandler, String name, Screen screen, int updateInterval)
         {
             InitializeComponent();
 
             this.inputProvider = inputProvider;
             this.inputHandler = inputHandler;
             this.inputSize = inputHandler.ImageSize;
-            this.outputSize = outputSize;
+            this.outputSize = new ImageSize(screen.Bounds.Width, screen.Bounds.Height);
             guiUpToDate = false;
             calibrationImageUpToDate = false;
 
@@ -55,6 +55,11 @@ namespace bbiwarg.Output.GlassesOutput
             timer.Start();
 
             KeyPreview = true;
+
+            //fullscreen
+            FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            Location = new Point(screen.WorkingArea.X, screen.WorkingArea.Y);
+            Size = new Size(outputSize.Width, outputSize.Height);
         }
 
         protected override void OnClosing(CancelEventArgs e)

+ 0 - 2
bbiwarg/Parameters.cs

@@ -37,9 +37,7 @@ namespace bbiwarg
 
         // glasses window
         public static readonly bool GlassesWindowEnabled = true;
-        public static readonly int GlassesWindowUpdateRate = 30;
         public static readonly int GlassesWindowUpdateInterval = 1000 / 30; // 30fps
-        public static readonly ImageSize GlassesWindowOutputSize = new ImageSize(1280, 720);
         public static readonly String GlassesWindowTitle = "BBIWARG - GlassesOutput";
         public static readonly int GlassesWindowNumCalibrationPoints = 20;