Our override of OpenTK.AndroidGameView. Provides Touch and Key Input handling.
Inheritance: AndroidGameView, View.IOnTouchListener, ISurfaceHolderCallback
示例#1
0
        private void Initialize(Context context, Point size)
        {
            _clientBounds = new Rectangle(0, 0, size.X, size.Y);

            GameView = new MonoGameAndroidGameView(context, this, _game);
            GameView.RenderOnUIThread = Game.Activity.RenderOnUIThread;
            GameView.RenderFrame     += OnRenderFrame;
            GameView.UpdateFrame     += OnUpdateFrame;

            GameView.RequestFocus();
            GameView.FocusableInTouchMode = true;
        }
示例#2
0
        private void Initialize(Context context)
        {
            _clientBounds = new Rectangle(0, 0, context.Resources.DisplayMetrics.WidthPixels, context.Resources.DisplayMetrics.HeightPixels);

            GameView = new MonoGameAndroidGameView(context, this, _game);
            GameView.RenderOnUIThread = Game.Activity.RenderOnUIThread;
            GameView.RenderFrame     += OnRenderFrame;
            GameView.UpdateFrame     += OnUpdateFrame;

            GameView.RequestFocus();
            GameView.FocusableInTouchMode = true;
        }
示例#3
0
        private void Initialize(Context context)
        {
            _clientBounds = new Rectangle(0, 0, context.Resources.DisplayMetrics.WidthPixels, context.Resources.DisplayMetrics.HeightPixels);

            GameView = new MonoGameAndroidGameView(context, this, _game);
            GameView.RenderFrame += OnRenderFrame;
            GameView.UpdateFrame += OnUpdateFrame;

            GameView.RequestFocus();
            GameView.FocusableInTouchMode = true;

#if OUYA
            GamePad.Initialize();
#endif
        }
 public BackgroundContext(MonoGameAndroidGameView view)
 {
     this.view = view;
     foreach (var v in MonoGame.OpenGL.GLESVersion.GetSupportedGLESVersions())
     {
         eglContext = view.egl.EglCreateContext(view.eglDisplay, view.eglConfig, EGL10.EglNoContext, v.GetAttributes());
         if (eglContext == null || eglContext == EGL10.EglNoContext)
         {
             continue;
         }
         break;
     }
     if (eglContext == null || eglContext == EGL10.EglNoContext)
     {
         eglContext = null;
         throw new Exception("Could not create EGL context" + view.GetErrorAsString());
     }
     int[] pbufferAttribList = new int[] { EGL10.EglWidth, 64, EGL10.EglHeight, 64, EGL10.EglNone };
     surface = view.CreatePBufferSurface(view.eglConfig, pbufferAttribList);
     if (surface == EGL10.EglNoSurface)
     {
         throw new Exception("Could not create Pbuffer Surface" + view.GetErrorAsString());
     }
 }