private void setContentView(LMode mode, AndroidGameViewGL view, int w, int h) { this.frameLayout = new FrameLayout(this); this.frameLayout.setBackgroundColor(LColor.black.getRGB()); if (mode == LMode.Defalut) { // 添加游戏View,显示为指定大小,并居中 this.addView(view, view.getWidth(), view.getHeight(), AndroidLocation.CENTER); } else if (mode == LMode.Ratio) { // 添加游戏View,显示为屏幕许可范围,并居中 this.addView(view, w, h, AndroidLocation.CENTER); } else if (mode == LMode.MaxRatio) { // 添加游戏View,显示为屏幕许可的最大范围(可能比单纯的Ratio失真),并居中 this.addView(view, w, h, AndroidLocation.CENTER); } else if (mode == LMode.Max) { // 添加游戏View,显示为最大范围值,并居中 this.addView(view, w, h, AndroidLocation.CENTER); } else if (mode == LMode.Fill) { // 添加游戏View,显示为全屏,并居中 this.addView( view, android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT, AndroidLocation.CENTER); } else if (mode == LMode.FitFill) { // 添加游戏View,显示为按比例缩放情况下的最大值,并居中 this.addView(view, w, h, AndroidLocation.CENTER); } getWindow().setContentView(frameLayout); }
@Override protected void onResume() { AndroidGame.debugLog("onResume"); if (setting != null && setting.listener != null) { setting.listener.onResume(); } if (game != null) { game.onResume(); } if (gameView != null) { gameView.onResume(); } super.onResume(); }