Exemplo n.º 1
0
        // 丢弃
        protected override void Dispose(bool disposing)
        {
            // 丢弃,释放资源
            if (disposing)
            {
                rawInput.Dispose();
                rawInput = null;
#if NoEyeTrack
#else
                eyeTrackingForm_.Dispose();
                eyeTrackingForm_ = null;
#endif
            }
            base.Dispose(disposing);
        }
Exemplo n.º 2
0
        // 构造函数
        public Browser()
        {
            // 图形和内容管理器实例化
            graphics_ = new GraphicsDeviceManager(this);
            // 抗锯齿有效
            graphics_.PreferMultiSampling = true;
            
            // 设置窗口大小
            ClientHeight = 768 - 32;
            ClientWidth = 1366 - 6;
            graphics_.PreferredBackBufferWidth = ClientWidth;
            graphics_.PreferredBackBufferHeight = ClientHeight;
            // 设置窗口名称
            this.Window.Title = Title;
            // 可以调整窗口大小
            this.Window.AllowUserResizing = true;
            // 窗口不显示鼠标
            this.IsMouseVisible = false;
            // 是否固定60 FPS(詳細はXNAの仕様を参照 http://blogs.msdn.com/ito/archive/2007/03/08/2-update.aspx)
#if CALC_FPS
            this.IsFixedTimeStep = false;
#else
            this.IsFixedTimeStep = true;
            this.TargetElapsedTime = TimeSpan.FromSeconds(1d / 60d);
#endif
            graphics_.ApplyChanges();
            // 读取设定文件(图像日志)
            //controlPanel_.ReadPhotoLogs(photoLog_);
            //controlPanel_.ReadPeopleLogs(peopleTags);
            IntPtr hWnd = this.Window.Handle;
            control = System.Windows.Forms.Control.FromHandle(hWnd);
            this.Window.ClientSizeChanged += new EventHandler<EventArgs>(Window_ClientSizeChanged);
            this.control.Move += new EventHandler(control_Move);
            //batch_ = new SpriteBatch(this.GraphicsDevice);
            //provide global access to game instance, so other classes can access graphicsdevice
            Instance = this;
            
            clientBounds = new BoundingBox2D(new Vector2(Window.ClientBounds.Left, Window.ClientBounds.Top), new Vector2(Window.ClientBounds.Right, Window.ClientBounds.Bottom), 0f);
            rawInput = new RawInputForm();
            pdCollection = rawInput.pdCollection;
            //one more pointing device, store touch data
            //pdCollection.add(new PointingDevice(0, new Vector2(6000, 6000)));
            systemState = new SystemState();
            wall = new Wall();

            graphicsAdapter = graphics_.GraphicsDevice.Adapter;
        }