internal CurveEvalSetup(float u, bool _4_points_setup, bool loop, float num_pointsf) { if (_4_points_setup && !loop) { float num = 1f / (num_pointsf - 1f); u = num + u * (1f - 2f * num); } this.pf = u * (num_pointsf - (loop ? 0f : 1f)); this.pi = (int)FMath.Floor(this.pf); this.frac = this.pf - (float)this.pi; }
public void render() { this.Camera.SetAspectFromViewport(); if (!this.NoClear) { Director.Instance.GL.Context.Clear(); } this.Camera.Push(); if ((Director.Instance.DebugFlags & DebugFlags.DrawGrid) != 0u) { float num = this.DrawGridStep; Bounds2 bounds = this.Camera.CalcBounds(); float num2 = (bounds.Size.X > bounds.Size.Y) ? bounds.Size.X : bounds.Size.Y; if (float.IsNaN(num2)) //FIXME added { num = 0f; } else if (num2 == 0f) { num = 0f; } else if (num == -1f) { int num3 = (int)FMath.Floor(FMath.Log(num2 / this.DrawGridAutoStepMaxCells) / FMath.Log(2f)) + 1; num3 = ((num3 < 1) ? 0 : num3); num = (float)(1 << num3); if (num3 > 15) { num = 0f; } } if (num != 0f) { this.Camera.DebugDraw(num); } } this.DrawHierarchy(); if ((Director.Instance.DebugFlags & DebugFlags.DrawContentWorldBounds) != 0u) { this.draw_content_world_bounds(); } this.Camera.Pop(); }
public static void Initialize() { //Set up director and UISystem. Director.Initialize(); UISystem.Initialize(Director.Instance.GL.Context); //Set game scene gameScene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene(); gameScene.Camera.SetViewFromViewport(); //Set the ui scene. uiScene = new Sce.PlayStation.HighLevel.UI.Scene(); Panel panel = new Panel(); panel.Width = Director.Instance.GL.Context.GetViewport().Width; panel.Height = Director.Instance.GL.Context.GetViewport().Height; uiScene.RootWidget.AddChildLast(panel); //Set the highscores scene. highscoresManager = new HighScoreManager(gameScene); highscoresScene = new Sce.PlayStation.HighLevel.UI.Scene(); Panel highscoresPanel = new Panel(); highscoresPanel.Width = Director.Instance.GL.Context.GetViewport().Width; highscoresPanel.Height = Director.Instance.GL.Context.GetViewport().Height; highscoresScene.RootWidget.AddChildLast(highscoresPanel); // Setup highscores label highscoresLabel = new Sce.PlayStation.HighLevel.UI.Label(); highscoresLabel.Height = 200.0f; highscoresLabel.Text = "Retrieving Data"; highscoresPanel.AddChildLast(highscoresLabel); highscoresScene.RootWidget.AddChildLast(highscoresPanel); // Setup ui scene labels scoreLabel = new Sce.PlayStation.HighLevel.UI.Label(); scoreLabel.SetPosition(10, 8); int roundedScore = (int)FMath.Floor(score / 100) * 100; scoreLabel.Text = "Score: " + roundedScore.ToString("N0"); panel.AddChildLast(scoreLabel); gameSpeedLabel = new Sce.PlayStation.HighLevel.UI.Label(); gameSpeedLabel.SetPosition(770, 8); float speed = FMath.Round(moveSpeed * 10) / 10; // round to 1dp gameSpeedLabel.Text = "Game Speed: " + moveSpeed.ToString("N1"); panel.AddChildLast(gameSpeedLabel); soundManager = new SoundManager(); //Create Sprite rTextureInfo = new TextureInfo("/Application/textures/reset.png"); rSprite = new SpriteUV(); rSprite = new SpriteUV(rTextureInfo); rSprite.Quad.S = rTextureInfo.TextureSizef; rSprite.Scale = new Vector2(1.0f, 1.0f); rSprite.Position = new Vector2(0.0f, 0.0f); rSprite.CenterSprite(); //Run the scene. Director.Instance.RunWithScene(gameScene, true); screenManager = new ScreenManager(gameScene); }