Example #1
0
 static void Main(string[] args)
 {
     using (Browser game = new Browser(args))
     {
         game.Run();
     }
 }
Example #2
0
        // 构造函数
        public Browser(string[] args)
        {
            // 图形和内容管理器实例化
            graphics_ = new GraphicsDeviceManager(this);
            
            // 抗锯齿有效
            graphics_.PreferMultiSampling = true;
            
            // 设置窗口大小
            ClientHeight = 768;
            ClientWidth = 1366;
            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);
            
            //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;
            systemState = new SystemState();

            if (args.Length > 0)
                profilePath = args[0];
            else profilePath = "profile.ini";
        }