protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); //Hides the titlebar and sets the window to fullscreen RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); //Create a frameBuffer for the background var rotation = WindowManager.DefaultDisplay.Rotation; bool isPortrait = rotation == SurfaceOrientation.Rotation0 || rotation == SurfaceOrientation.Rotation180; int frameBufferWidth = isPortrait ? 480 : 800; int frameBufferHeight = isPortrait ? 800 : 480; Bitmap frameBuffer = Bitmap.CreateBitmap(frameBufferWidth, frameBufferHeight, Bitmap.Config.Rgb565); //Find screen size to calculate relative size var screenSize = new Point(); WindowManager.DefaultDisplay.GetSize(screenSize); float scaleX = (float)frameBufferWidth / screenSize.X; float scaleY = (float)frameBufferHeight / screenSize.Y; //Generate classes and start-up the first screen renderView = new AndroidFastRenderView(this, frameBuffer); graphics = new AndroidGraphics(Assets, frameBuffer); fileIO = new AndroidFileIO(this); audio = new AndroidAudio(this); input = new AndroidInput(this, renderView, scaleX, scaleY); SetContentView(renderView); CurrentScreen = this.InitScreen; //Add a WakeLock to avoid the screen from going out PowerManager powerManager = (PowerManager)GetSystemService(Context.PowerService); wakeLock = powerManager.NewWakeLock(WakeLockFlags.Full, "BeerRun"); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); //Hides the titlebar and sets the window to fullscreen RequestWindowFeature (WindowFeatures.NoTitle); Window.SetFlags (WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); //Create a frameBuffer for the background var rotation = WindowManager.DefaultDisplay.Rotation; bool isPortrait = rotation == SurfaceOrientation.Rotation0 || rotation == SurfaceOrientation.Rotation180; int frameBufferWidth = isPortrait ? 480 : 800; int frameBufferHeight = isPortrait ? 800 : 480; Bitmap frameBuffer = Bitmap.CreateBitmap (frameBufferWidth, frameBufferHeight, Bitmap.Config.Rgb565); //Find screen size to calculate relative size var screenSize = new Point(); WindowManager.DefaultDisplay.GetSize(screenSize); float scaleX = (float)frameBufferWidth / screenSize.X; float scaleY = (float) frameBufferHeight / screenSize.Y; //Generate classes and start-up the first screen renderView = new AndroidFastRenderView (this, frameBuffer); graphics = new AndroidGraphics (Assets, frameBuffer); fileIO = new AndroidFileIO (this); audio = new AndroidAudio (this); input = new AndroidInput (this, renderView, scaleX, scaleY); SetContentView (renderView); CurrentScreen = this.InitScreen; //Add a WakeLock to avoid the screen from going out PowerManager powerManager = (PowerManager)GetSystemService (Context.PowerService); wakeLock = powerManager.NewWakeLock (WakeLockFlags.Full, "BeerRun"); }