Inheritance: GameWindow, IDisposable
Beispiel #1
0
        public OpenTKGamePlatform(Game game)
            : base(game)
        {
            _view       = new OpenTKGameWindow();
            _view.Game  = game;
            this.Window = _view;

            // Setup our OpenALSoundController to handle our SoundBuffer pools
            try
            {
                soundControllerInstance = OpenALSoundController.GetInstance;
            }
            catch (DllNotFoundException ex)
            {
                throw (new NoAudioHardwareException("Failed to init OpenALSoundController", ex));
            }

#if LINUX
            // also set up SdlMixer to play background music. If one of these functions fails, we will not get any background music (but that should rarely happen)
            Tao.Sdl.Sdl.SDL_InitSubSystem(Tao.Sdl.Sdl.SDL_INIT_AUDIO);
            Tao.Sdl.SdlMixer.Mix_OpenAudio(44100, (short)Tao.Sdl.Sdl.AUDIO_S16SYS, 2, 1024);

            //even though this method is called whenever IsMouseVisible is changed it needs to be called during startup
            //so that the cursor can be put in the correct inital state (hidden)
            OnIsMouseVisibleChanged();
#endif
        }
Beispiel #2
0
 public OpenTKGamePlatform(Game game)
   : base(game)
 {
   this._view = new OpenTKGameWindow();
   this._view.Game = game;
   this.Window = (GameWindow) this._view;
   this.IsMouseVisible = true;
   this.soundControllerInstance = OpenALSoundController.Instance;
 }
Beispiel #3
0
 public OpenTKGamePlatform(Game game)
   : base(game)
 {
   this._view = new OpenTKGameWindow();
   this._view.Game = game;
   this.Window = (GameWindow) this._view;
   this.soundControllerInstance = OpenALSoundController.Instance;
   WindowsHelperAccessibilityKeys.AllowAccessibilityShortcutKeys(false);
 }
Beispiel #4
0
 public OpenTKGamePlatform(Game game)
     : base(game)
 {
     this._view                   = new OpenTKGameWindow();
     this._view.Game              = game;
     this.Window                  = (GameWindow)this._view;
     this.IsMouseVisible          = true;
     this.soundControllerInstance = OpenALSoundController.Instance;
 }
Beispiel #5
0
 public OpenTKGamePlatform(Game game)
     : base(game)
 {
     this._view      = new OpenTKGameWindow();
     this._view.Game = game;
     this.Window     = (GameWindow)this._view;
     this.soundControllerInstance = OpenALSoundController.Instance;
     WindowsHelperAccessibilityKeys.AllowAccessibilityShortcutKeys(false);
 }
Beispiel #6
0
 protected override void Dispose(bool disposing)
 {
     if (!this.IsDisposed && this._view != null)
     {
         this._view.Dispose();
         this._view = (OpenTKGameWindow)null;
     }
     this.soundControllerInstance.Dispose();
     base.Dispose(disposing);
 }
        protected override void Dispose(bool disposing)
        {
            if (_view != null)
            {
                _view.Dispose();
                _view = null;
            }

            base.Dispose(disposing);
        }
Beispiel #8
0
 protected override void Dispose(bool disposing)
 {
     if (!this.IsDisposed && this._view != null)
     {
         this._view.Dispose();
         this._view = (OpenTKGameWindow)null;
     }
     if (this.soundControllerInstance != null)
     {
         this.soundControllerInstance.Dispose();
     }
     SdlGamePad.Cleanup();
     WindowsHelperAccessibilityKeys.AllowAccessibilityShortcutKeys(true);
     base.Dispose(disposing);
 }
Beispiel #9
0
        public OpenTKGamePlatform(Game game)
            : base(game)
        {
            _view       = new OpenTKGameWindow(game);
            this.Window = _view;

            // Setup our OpenALSoundController to handle our SoundBuffer pools
            try
            {
                soundControllerInstance = OpenALSoundController.GetInstance;
            }
            catch (DllNotFoundException ex)
            {
                throw (new NoAudioHardwareException("Failed to init OpenALSoundController", ex));
            }
        }
        public OpenTKGamePlatform(Game game)
            : base(game)
        {
            _view       = new OpenTKGameWindow();
            _view.Game  = game;
            this.Window = _view;

            this.IsMouseVisible = true;

            // Setup our OpenALSoundController to handle our SoundBuffer pools
            soundControllerInstance = OpenALSoundController.GetInstance;

#if LINUX
            // also set up SdlMixer to play background music. If one of these functions fails, we will not get any background music (but that should rarely happen)
            Tao.Sdl.Sdl.SDL_InitSubSystem(Tao.Sdl.Sdl.SDL_INIT_AUDIO);
            Tao.Sdl.SdlMixer.Mix_OpenAudio(44100, (short)Tao.Sdl.Sdl.AUDIO_S16SYS, 2, 1024);
#endif
        }
        protected override void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                if (toolkit != null)
                {
                    toolkit.Dispose();
                    toolkit = null;
                }

                if (_view != null)
                {
                    _view.Dispose();
                    _view = null;
                }
            }

            base.Dispose(disposing);
        }
Beispiel #12
0
        private void Initialize()
        {
            OpenTK.Graphics.GraphicsContext.ShareContexts = true;
            GraphicsMode mode = new GraphicsMode((ColorFormat)DisplayDevice.Default.BitsPerPixel, 24, 8);

            this.window                   = new OpenTK.GameWindow(640, 480, mode);
            this.window.RenderFrame      += new EventHandler <FrameEventArgs>(this.OnRenderFrame);
            this.window.UpdateFrame      += new EventHandler <FrameEventArgs>(this.OnUpdateFrame);
            this.window.Closing          += new EventHandler <CancelEventArgs>(this.OpenTkGameWindow_Closing);
            this.window.Resize           += new EventHandler <EventArgs>(this.OnResize);
            this.window.Keyboard.KeyDown += new EventHandler <KeyboardKeyEventArgs>(this.Keyboard_KeyDown);
            this.window.Keyboard.KeyUp   += new EventHandler <KeyboardKeyEventArgs>(this.Keyboard_KeyUp);
            this.window.Icon              = Icon.ExtractAssociatedIcon(Assembly.GetEntryAssembly().Location);
            this.updateClientBounds       = false;
            OpenTKGameWindow openTkGameWindow = this;

            System.Drawing.Rectangle clientRectangle = this.window.ClientRectangle;
            int x = clientRectangle.X;

            clientRectangle = this.window.ClientRectangle;
            int y = clientRectangle.Y;

            clientRectangle = this.window.ClientRectangle;
            int width = clientRectangle.Width;

            clientRectangle = this.window.ClientRectangle;
            int       height    = clientRectangle.Height;
            Rectangle rectangle = new Rectangle(x, y, width, height);

            openTkGameWindow.clientBounds = rectangle;
            this.windowState            = this.window.WindowState;
            this._windowHandle          = (IntPtr)this.window.WindowInfo.GetType().GetProperty("WindowHandle").GetValue((object)this.window.WindowInfo, (object[])null);
            Threading.BackgroundContext = (IGraphicsContext) new OpenTK.Graphics.GraphicsContext(mode, this.window.WindowInfo);
            Threading.WindowInfo        = this.window.WindowInfo;
            this.keys = new List <Keys>();
            if (!OpenTK.Graphics.GraphicsContext.CurrentContext.IsCurrent)
            {
                this.window.MakeCurrent();
            }
            Microsoft.Xna.Framework.Input.Mouse.setWindows(this.window);
            this.AllowUserResizing = false;
        }
        public OpenTKGamePlatform(Game game)
            : base(game)
        {
            if (PlatformParameters.PreferredBackend != Backend.Default)
            {
                Toolkit.Init(new ToolkitOptions {
                    Backend = PlatformBackend.PreferNative
                });
            }

            _view       = new OpenTKGameWindow(game);
            this.Window = _view;

            // Setup our OpenALSoundController to handle our SoundBuffer pools
            try
            {
                soundControllerInstance = OpenALSoundController.GetInstance;
            }
            catch (DllNotFoundException ex)
            {
                throw (new NoAudioHardwareException("Failed to init OpenALSoundController", ex));
            }
        }
        private int isExiting; // int, so we can use Interlocked.Increment
        
		public OpenTKGamePlatform(Game game)
            : base(game)
        {
            toolkit = Toolkit.Init();
            _view = new OpenTKGameWindow(game);
            this.Window = _view;

			// Setup our OpenALSoundController to handle our SoundBuffer pools
            try
            {
                soundControllerInstance = OpenALSoundController.GetInstance;
            }
            catch (DllNotFoundException ex)
            {
                throw (new NoAudioHardwareException("Failed to init OpenALSoundController", ex));
            }
        }
        protected override void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                if (toolkit != null)
                {
                    toolkit.Dispose();
                    toolkit = null;
                }

                if (_view != null)
                {
                    _view.Dispose();
                    _view = null;
                }
            }

			base.Dispose(disposing);
        }
Beispiel #16
0
		public OpenTKGamePlatform(Game game)
            : base(game)
        {
            if (PlatformParameters.PreferredBackend != Backend.Default)
                Toolkit.Init(new ToolkitOptions { Backend = PlatformBackend.PreferNative });

            _view = new OpenTKGameWindow(game);
            this.Window = _view;

			// Setup our OpenALSoundController to handle our SoundBuffer pools
            try
            {
                soundControllerInstance = OpenALSoundController.GetInstance;
            }
            catch (DllNotFoundException ex)
            {
                throw (new NoAudioHardwareException("Failed to init OpenALSoundController", ex));
            }
        }
Beispiel #17
0
 protected override void Dispose(bool disposing)
 {
   if (!this.IsDisposed && this._view != null)
   {
     this._view.Dispose();
     this._view = (OpenTKGameWindow) null;
   }
   if (this.soundControllerInstance != null)
     this.soundControllerInstance.Dispose();
   SdlGamePad.Cleanup();
   WindowsHelperAccessibilityKeys.AllowAccessibilityShortcutKeys(true);
   base.Dispose(disposing);
 }
		public OpenTKGamePlatform(Game game)
            : base(game)
        {
            _view = new OpenTKGameWindow();
            _view.Game = game;
            this.Window = _view;

            this.IsMouseVisible = true;
			
			// Setup our OpenALSoundController to handle our SoundBuffer pools
			soundControllerInstance = OpenALSoundController.GetInstance;
            
#if LINUX
            // also set up SdlMixer to play background music. If one of these functions fails, we will not get any background music (but that should rarely happen)
            Tao.Sdl.Sdl.SDL_InitSubSystem(Tao.Sdl.Sdl.SDL_INIT_AUDIO);
            Tao.Sdl.SdlMixer.Mix_OpenAudio(44100, (short)Tao.Sdl.Sdl.AUDIO_S16SYS, 2, 1024);			
#endif
        }
Beispiel #19
0
 protected override void Dispose(bool disposing)
 {
   if (!this.IsDisposed && this._view != null)
   {
     this._view.Dispose();
     this._view = (OpenTKGameWindow) null;
   }
   this.soundControllerInstance.Dispose();
   base.Dispose(disposing);
 }
Beispiel #20
0
		public OpenTKGamePlatform(Game game)
            : base(game)
        {
            _view = new OpenTKGameWindow();
            _view.Game = game;
            this.Window = _view;
			
			// Setup our OpenALSoundController to handle our SoundBuffer pools
            try
            {
                soundControllerInstance = OpenALSoundController.GetInstance;
            }
            catch (DllNotFoundException ex)
            {
                throw (new NoAudioHardwareException("Failed to init OpenALSoundController", ex));
            }
            
#if LINUX
            // also set up SdlMixer to play background music. If one of these functions fails, we will not get any background music (but that should rarely happen)
            Tao.Sdl.Sdl.SDL_InitSubSystem(Tao.Sdl.Sdl.SDL_INIT_AUDIO);
            Tao.Sdl.SdlMixer.Mix_OpenAudio(44100, (short)Tao.Sdl.Sdl.AUDIO_S16SYS, 2, 1024);			

            //even though this method is called whenever IsMouseVisible is changed it needs to be called during startup
            //so that the cursor can be put in the correct inital state (hidden)
            OnIsMouseVisibleChanged();
#endif
        }