// =========================================================== // Getter & Setter // =========================================================== // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== public override void OnMeasure(RenderSurfaceView pRenderSurfaceView, int pWidthMeasureSpec, int pHeightMeasureSpec) { BaseResolutionPolicy.throwOnNotMeasureSpecEXACTLY(pWidthMeasureSpec, pHeightMeasureSpec); int specWidth = View.MeasureSpec.GetSize(pWidthMeasureSpec); int specHeight = View.MeasureSpec.GetSize(pHeightMeasureSpec); float desiredRatio = this.mRatio; float realRatio = (float)specWidth / specHeight; int measuredWidth; int measuredHeight; if (realRatio < desiredRatio) { measuredWidth = specWidth; measuredHeight = (int)Math.Round(measuredWidth / desiredRatio); } else { measuredHeight = specHeight; measuredWidth = (int)Math.Round(measuredHeight * desiredRatio); } pRenderSurfaceView.SetMeasuredDimensionProxy(measuredWidth, measuredHeight); }
protected void OnSetContentView() { this.mRenderSurfaceView = new RenderSurfaceView(this); this.mRenderSurfaceView.SetEGLConfigChooser(false); this.mRenderSurfaceView.SetRenderer(this.mEngine); this.SetContentView(this.mRenderSurfaceView, this.CreateSurfaceViewLayoutParams()); }
// =========================================================== // Getter & Setter // =========================================================== // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== public override void OnMeasure(RenderSurfaceView pRenderSurfaceView, int pWidthMeasureSpec, int pHeightMeasureSpec) { BaseResolutionPolicy.throwOnNotMeasureSpecEXACTLY(pWidthMeasureSpec, pHeightMeasureSpec); int specWidth = View.MeasureSpec.GetSize(pWidthMeasureSpec); int specHeight = View.MeasureSpec.GetSize(pHeightMeasureSpec); float desiredRatio = this.mRatio; float realRatio = (float)specWidth / specHeight; int measuredWidth; int measuredHeight; if(realRatio < desiredRatio) { measuredWidth = specWidth; measuredHeight = (int) Math.Round(measuredWidth / desiredRatio); } else { measuredHeight = specHeight; measuredWidth = (int) Math.Round(measuredHeight * desiredRatio); } pRenderSurfaceView.SetMeasuredDimensionProxy(measuredWidth, measuredHeight); }
public abstract void OnMeasure(RenderSurfaceView pRenderSurfaceView, int pWidthMeasureSpec, int pHeightMeasureSpec);