Exemple #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            RequestWindowFeature(Window.FEATURE_NO_TITLE);
            GetWindow().SetFlags(IWindowManager_LayoutParams.FLAG_FULLSCREEN,
                                 IWindowManager_LayoutParams.FLAG_FULLSCREEN);

            bool   isPortrait        = GetResources().GetConfiguration().Orientation == Configuration.ORIENTATION_PORTRAIT;
            int    frameBufferWidth  = isPortrait ? 480 : 800;
            int    frameBufferHeight = isPortrait ? 800 : 480;
            Bitmap frameBuffer       = Bitmap.CreateBitmap(frameBufferWidth,
                                                           frameBufferHeight, Bitmap.Config.RGB_565);

            float scaleX = (float)frameBufferWidth
                           / GetWindowManager().GetDefaultDisplay().GetWidth();
            float scaleY = (float)frameBufferHeight
                           / GetWindowManager().GetDefaultDisplay().GetHeight();

            renderView = new AndroidFastRenderView(this, frameBuffer);
            graphics   = new AndroidGraphics(GetAssets(), GetAssetsPrefix(), frameBuffer);
            fileIO     = new AndroidFileIO(this);
            audio      = new AndroidAudio(this);
            input      = new AndroidInput(this, renderView, scaleX, scaleY);
            screen     = getInitScreen();
            SetContentView(renderView);

            PowerManager powerManager = (PowerManager)GetSystemService(Context.POWER_SERVICE);

            wakeLock = powerManager.NewWakeLock(PowerManager.FULL_WAKE_LOCK, "MyGame");
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            RequestWindowFeature(Window.FEATURE_NO_TITLE);
            GetWindow().SetFlags(IWindowManager_LayoutParams.FLAG_FULLSCREEN,
                                 IWindowManager_LayoutParams.FLAG_FULLSCREEN);

            bool isPortrait = GetResources().GetConfiguration().Orientation == Configuration.ORIENTATION_PORTRAIT;
            int frameBufferWidth = isPortrait ? 480 : 800;
            int frameBufferHeight = isPortrait ? 800 : 480;
            Bitmap frameBuffer = Bitmap.CreateBitmap(frameBufferWidth,
                                                     frameBufferHeight, Bitmap.Config.RGB_565);

            float scaleX = (float)frameBufferWidth
                           / GetWindowManager().GetDefaultDisplay().GetWidth();
            float scaleY = (float)frameBufferHeight
                           / GetWindowManager().GetDefaultDisplay().GetHeight();

            renderView = new AndroidFastRenderView(this, frameBuffer);
            graphics = new AndroidGraphics(GetAssets(), GetAssetsPrefix(), frameBuffer);
            fileIO = new AndroidFileIO(this);
            audio = new AndroidAudio(this);
            input = new AndroidInput(this, renderView, scaleX, scaleY);
            screen = getInitScreen();
            SetContentView(renderView);

            PowerManager powerManager = (PowerManager)GetSystemService(Context.POWER_SERVICE);
            wakeLock = powerManager.NewWakeLock(PowerManager.FULL_WAKE_LOCK, "MyGame");
        }