Exemple #1
0
        private void InitializeMainWindow()
        {
            var frame = new RectF(
                0, 0,
                GraphicsDeviceManager.DefaultBackBufferWidth,
                GraphicsDeviceManager.DefaultBackBufferHeight);

            _mainWindow = new MacGameNSWindow(
                frame, NSWindowStyle.Titled | NSWindowStyle.Closable | NSWindowStyle.Miniaturizable,
                NSBackingStore.Buffered, true);

            _mainWindow.WindowController = new NSWindowController(_mainWindow);
            _mainWindow.Delegate         = new MainWindowDelegate(this);

            _mainWindow.IsOpaque = true;
            _mainWindow.EnableCursorRects();
            _mainWindow.AcceptsMouseMovedEvents = false;
            _mainWindow.Center();

            if (GameWindow.CreateWindowDelegate == null)
            {
                _gameWindow = new GameWindow(Game, frame);
            }
            else
            {
                _gameWindow = GameWindow.CreateWindowDelegate(Game, frame);
            }
            Window = _gameWindow;
            _mainWindow.ContentView.AddSubview(_gameWindow);
        }
Exemple #2
0
        public Game()
        {
            // Initialize collections
            _services = new GameServiceContainer();
            _gameComponentCollection = new GameComponentCollection();

            _gameComponentCollection.ComponentAdded += Handle_gameComponentCollectionComponentAdded;

            // The default for Windows is 480 x 800
            //RectangleF frame = NSScreen.MainScreen.Frame;
            RectangleF frame = new RectangleF(0, 0, Microsoft.Xna.Framework.Graphics.PresentationParameters._defaultBackBufferWidth,
                                              Microsoft.Xna.Framework.Graphics.PresentationParameters._defaultBackBufferHeight);

            //Create a window
            _mainWindow = new MacGameNSWindow(frame, NSWindowStyle.Titled | NSWindowStyle.Closable, NSBackingStore.Buffered, true);

            // Perform any other window configuration you desire
            _mainWindow.IsOpaque = true;
            _mainWindow.EnableCursorRects();
            _gameWindow      = new GameWindow(frame);
            _gameWindow.game = this;

            _mainWindow.ContentView.AddSubview(_gameWindow);
            _mainWindow.AcceptsMouseMovedEvents = false;
            _mainWindow.Center();
            // Initialize GameTime
            _updateGameTime = new GameTime();
            _drawGameTime   = new GameTime();

            //Set the current directory.
            // We set the current directory to the ResourcePath on Mac
            Directory.SetCurrentDirectory(NSBundle.MainBundle.ResourcePath);

            //Tao.Sdl.Sdl.SDL_Init(Tao.Sdl.Sdl.SDL_INIT_JOYSTICK);

            // Leave these here for when we implement the Activate and Deactivated
            _mainWindow.DidBecomeKey += delegate(object sender, EventArgs e) {
                //if (!IsMouseVisible)
                //	_gameWindow.HideCursor();
                //Console.WriteLine("BecomeKey");
            };

            _mainWindow.DidResignKey += delegate(object sender, EventArgs e) {
                //if (!IsMouseVisible)
                //	_gameWindow.UnHideCursor();
                //Console.WriteLine("ResignKey");
            };

            _mainWindow.DidBecomeMain += delegate(object sender, EventArgs e) {
                //if (!IsMouseVisible)
                //_gameWindow.HideCursor();
                ////Console.WriteLine("BecomeMain");
            };

            _mainWindow.DidResignMain += delegate(object sender, EventArgs e) {
                //if (!IsMouseVisible)
                //	_gameWindow.UnHideCursor();
                //Console.WriteLine("ResignMain");
            };
        }
Exemple #3
0
        private void InitializeMainWindow()
        {
            RectangleF frame = new RectangleF(
                0, 0,
                PresentationParameters._defaultBackBufferWidth,
                PresentationParameters._defaultBackBufferHeight);

            _mainWindow = new MacGameNSWindow(
                frame, NSWindowStyle.Titled | NSWindowStyle.Closable,
                NSBackingStore.Buffered, true);

            _mainWindow.WindowController = new NSWindowController(_mainWindow);
            _mainWindow.Delegate         = new MainWindowDelegate(this);

            _mainWindow.IsOpaque = true;
            _mainWindow.EnableCursorRects();
            _mainWindow.AcceptsMouseMovedEvents = false;
            _mainWindow.Center();

            _gameWindow = new GameWindow(Game, frame);
            Window      = _gameWindow;
            _mainWindow.ContentView.AddSubview(_gameWindow);
        }
Exemple #4
0
        private void InitializeMainWindow()
        {
            RectangleF frame = new RectangleF(
                0, 0,
                GraphicsDeviceManager.DefaultBackBufferWidth,
                GraphicsDeviceManager.DefaultBackBufferHeight);

            _mainWindow = new MacGameNSWindow(
				frame, NSWindowStyle.Titled | NSWindowStyle.Closable | NSWindowStyle.Miniaturizable,
                NSBackingStore.Buffered, true);

            _mainWindow.WindowController = new NSWindowController(_mainWindow);
            _mainWindow.Delegate = new MainWindowDelegate(this);

            _mainWindow.IsOpaque = true;
            _mainWindow.EnableCursorRects();
            _mainWindow.AcceptsMouseMovedEvents = false;
            _mainWindow.Center();

			if (GameWindow.CreateWindowDelegate == null)
            	_gameWindow = new GameWindow(Game, frame);
			else
				_gameWindow = GameWindow.CreateWindowDelegate(Game, frame);
            Window = _gameWindow;
            _mainWindow.ContentView.AddSubview(_gameWindow);
        }
Exemple #5
0
        public Game()
        {
            // Initialize collections
            _services = new GameServiceContainer ();
            _gameComponentCollection = new GameComponentCollection ();

            _gameComponentCollection.ComponentAdded += Handle_gameComponentCollectionComponentAdded;

            // The default for Windows is 480 x 800
            //RectangleF frame = NSScreen.MainScreen.Frame;
            RectangleF frame = new RectangleF(0,0,Microsoft.Xna.Framework.Graphics.PresentationParameters._defaultBackBufferWidth,
                Microsoft.Xna.Framework.Graphics.PresentationParameters._defaultBackBufferHeight);

            //Create a window
            _mainWindow = new MacGameNSWindow (frame, NSWindowStyle.Titled | NSWindowStyle.Closable, NSBackingStore.Buffered, true);

            // Perform any other window configuration you desire
            _mainWindow.IsOpaque = true;
            _mainWindow.EnableCursorRects();
            _gameWindow = new GameWindow (frame);
            _gameWindow.game = this;

            _mainWindow.ContentView.AddSubview (_gameWindow);
            _mainWindow.AcceptsMouseMovedEvents = false;
            _mainWindow.Center();
            // Initialize GameTime
            _updateGameTime = new GameTime ();
            _drawGameTime = new GameTime ();

            //Set the current directory.
            // We set the current directory to the ResourcePath on Mac
            Directory.SetCurrentDirectory(NSBundle.MainBundle.ResourcePath);

            //Tao.Sdl.Sdl.SDL_Init(Tao.Sdl.Sdl.SDL_INIT_JOYSTICK);

            // Leave these here for when we implement the Activate and Deactivated
            _mainWindow.DidBecomeKey += delegate(object sender, EventArgs e) {
                //if (!IsMouseVisible)
                //	_gameWindow.HideCursor();
                //Console.WriteLine("BecomeKey");
            };

            _mainWindow.DidResignKey += delegate(object sender, EventArgs e) {
                //if (!IsMouseVisible)
                //	_gameWindow.UnHideCursor();
                //Console.WriteLine("ResignKey");
            };

            _mainWindow.DidBecomeMain += delegate(object sender, EventArgs e) {
                //if (!IsMouseVisible)
                    //_gameWindow.HideCursor();
                ////Console.WriteLine("BecomeMain");
            };

            _mainWindow.DidResignMain += delegate(object sender, EventArgs e) {
                //if (!IsMouseVisible)
                //	_gameWindow.UnHideCursor();
                //Console.WriteLine("ResignMain");
            };
        }
Exemple #6
0
        private void InitializeMainWindow()
        {
            RectangleF frame = new RectangleF(
                0, 0,
                PresentationParameters._defaultBackBufferWidth,
                PresentationParameters._defaultBackBufferHeight);

            _mainWindow = new MacGameNSWindow(
                frame, NSWindowStyle.Titled | NSWindowStyle.Closable,
                NSBackingStore.Buffered, true);

            _mainWindow.WindowController = new NSWindowController(_mainWindow);
            _mainWindow.Delegate = new MainWindowDelegate(this);

            _mainWindow.IsOpaque = true;
            _mainWindow.EnableCursorRects();
            _mainWindow.AcceptsMouseMovedEvents = false;
            _mainWindow.Center();

            _gameWindow = new GameWindow(Game, frame);
            Window = _gameWindow;
            _mainWindow.ContentView.AddSubview(_gameWindow);
        }