public void Init(FutileParams futileParams) { enabled = true; _futileParams = futileParams; Application.targetFrameRate = _futileParams.targetFrameRate; FShader.Init(); //set up the basic shaders FFacetType.Init(); //set up the types of facets (Quads, Triangles, etc) screen = new FScreen(_futileParams); // //Camera setup from https://github.com/prime31/UIToolkit/blob/master/Assets/Plugins/UIToolkit/UI.cs // if (existingCamera != null) { _cameraHolder = existingCamera.gameObject; _camera = existingCamera; } else { _cameraHolder = new GameObject(); _camera = _cameraHolder.AddComponent <Camera>(); } _cameraHolder.transform.parent = gameObject.transform; _camera.tag = "MainCamera"; _camera.clearFlags = CameraClearFlags.SolidColor; _camera.nearClipPlane = 0.0f; _camera.farClipPlane = 500.0f; _camera.depth = 100; _camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); _camera.backgroundColor = _futileParams.backgroundColor; //we multiply this stuff by scaleInverse to make sure everything is in points, not pixels _camera.orthographic = true; _camera.orthographicSize = screen.pixelHeight / 2 * displayScaleInverse; UpdateCameraPosition(); touchManager = new FTouchManager(); atlasManager = new FAtlasManager(); CreateDefaultAtlases(); _stages = new List <FStage>(); stage = new FStage("Futile.stage"); AddStage(stage); }
public void Init(FutileParams futileParams) { enabled = true; _futileParams = futileParams; //设置游戏帧率 Application.targetFrameRate = _futileParams.targetFrameRate; //设置basic shaders FShader.Init(); //设置facets' types (Quads, Triangles, etc) FFacetType.Init(); //初始化各引擎组件实例 screen = new FScreen(_futileParams); touchManager = new FTouchManager(); atlasManager = new FAtlasManager(); //设置主相机参数:Setup from https://github.com/prime31/UIToolkit/blob/master/Assets/Plugins/UIToolkit/UI.cs _cameraHolder = new GameObject(); _cameraHolder.transform.parent = gameObject.transform; _camera = _cameraHolder.AddComponent <Camera>(); _camera.tag = "MainCamera"; _camera.name = "Camera"; //_camera.clearFlags = CameraClearFlags.Depth; //TODO: check if this is faster or not? _camera.clearFlags = CameraClearFlags.SolidColor; _camera.nearClipPlane = 0.0f; _camera.farClipPlane = 500.0f; _camera.depth = 100; _camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); _camera.backgroundColor = _futileParams.backgroundColor; //we multiply this stuff by scaleInverse to make sure everything is in points, not pixels _camera.orthographic = true; _camera.orthographicSize = screen.pixelHeight / 2 * displayScaleInverse; UpdateCameraPosition(); //创建默认Atlas CreateDefaultAtlases(); //初始化Stage管理 _stages = new List <FStage>(); stage = new FStage("Futile.stage"); AddStage(stage); }