public void InitializeAll() { stp = new Stopwatch(); stp.Start(); Audio.InitAudio(); SrkFontDisplayer.InitFonts(); InitializeGraphics(); DefaultCamera(); ResourceLoader.InitEmptyData(); new System.Threading.Thread(() => { while (ticks < 1) { } while (true) { if (stp.Elapsed.TotalSeconds >= seconds + 0.25) { FPS_ = (FPS_ + ticks) / 2f; //if (FPS_ * 4f>10) FPS = FPS_ * 4f; Window.Title = title + " - " + FPS + " FPS - " + Window.ClientBounds.Width + "x" + Window.ClientBounds.Height; //CharToScreen.WriteText((FPS_ * 4f) + " FPS\x0\x0\x0\x0\x0\x0", 5, 1, Color.White, Color.Black); //Debug.WriteLine(FPS); //Console.WriteLine(FPS); ticks = 0; seconds = stp.Elapsed.TotalSeconds; } System.Threading.Thread.Sleep(10); } }).Start(); CharToScreen.Init(16, 16); LoadingScreen.Init(); }
public void Update() { if (this.Type == Bulle.BulleType.Speech) { this.Width = SpeechWidth; this.Height = SpeechHeight; } if (this.Type == Bulle.BulleType.Information) { this.Width = InformationWidth; this.Height = InformationHeight; } SrkFontDisplayer.Write(SrkFontDisplayer.Speech, this.Text, 0.5f, (Scale.X * (this.Width / 3.5f)), SrkFontDisplayer.Speech.Color); float new_ = (((SrkFontDisplayer.MaxBounds.X - SrkFontDisplayer.MinBounds.X) / Scale.X) / 1.1f) * 3.5f; if (new_ < this.Width) { this.Width = new_; } Vector2 off = new Vector2(-bulle.Location.X + (SrkFontDisplayer.MaxBounds.X - SrkFontDisplayer.MinBounds.X) / 2f, -bulle.Location.Z + (SrkFontDisplayer.MaxBounds.Y - SrkFontDisplayer.MinBounds.Y) / 2f + 3.5f); SrkFontDisplayer.ApplyOffsets(off); this.Height -= SrkFontDisplayer.yOffset * 4f; float branchOffset = (Scale.X * this.Width * 0.28f) * (this.BranchPosition - 0.5f); bulle.Location = new Vector3(Position.X * (960f * Scale.X) - (branchOffset), 0f, -Position.Y * (540 * Scale.Z) + (Scale.Z * this.Height * 0.190839f) + (Scale.Z * 50f)); switch (this.displayType) { case DisplayType.Appear: PlayingPath *= 1.15f; if (PlayingPath >= 100f) { PlayingPath = 100f; this.displayType = DisplayType.WaitPrompt; } if (PlayingPath > 25f) { bulle.Opacity = (this.PlayingPath - 25f) / 75f; } bulle.Skeleton.Bones[2].GlobalMatrix = ScaleMatrix * Matrix.CreateTranslation(Scale * new Vector3((this.PlayingPath / 100f) * this.Width * 0.190839f, 0, -(this.PlayingPath / 100f) * this.Height * 0.190839f)); bulle.Skeleton.Bones[4].GlobalMatrix = ScaleMatrix * Matrix.CreateTranslation(Scale * new Vector3((this.PlayingPath / 100f) * this.Width * 0.190839f, 0, (this.PlayingPath / 100f) * this.Height * 0.190839f)); bulle.Skeleton.Bones[1].GlobalMatrix = ScaleMatrix * Matrix.CreateTranslation(Scale * new Vector3((this.PlayingPath / 100f) * -this.Width * 0.190839f, 0, (this.PlayingPath / 100f) * -this.Height * 0.190839f)); bulle.Skeleton.Bones[3].GlobalMatrix = ScaleMatrix * Matrix.CreateTranslation(Scale * new Vector3((this.PlayingPath / 100f) * -this.Width * 0.190839f, 0, (this.PlayingPath / 100f) * this.Height * 0.190839f)); xScale = 0f; break; case DisplayType.WaitPrompt: if (xScale < 1f) { xScale += 0.2f; } bulle.Skeleton.Bones[2].GlobalMatrix = ScaleMatrix * Matrix.CreateTranslation(Scale * new Vector3(this.Width * 0.190839f, 0, -this.Height * 0.190839f)); bulle.Skeleton.Bones[4].GlobalMatrix = ScaleMatrix * Matrix.CreateTranslation(Scale * new Vector3(this.Width * 0.190839f, 0, this.Height * 0.190839f)); bulle.Skeleton.Bones[1].GlobalMatrix = ScaleMatrix * Matrix.CreateTranslation(Scale * new Vector3(-this.Width * 0.190839f, 0, -this.Height * 0.190839f)); bulle.Skeleton.Bones[3].GlobalMatrix = ScaleMatrix * Matrix.CreateTranslation(Scale * new Vector3(-this.Width * 0.190839f, 0, this.Height * 0.190839f)); bulle.Skeleton.Bones[5].GlobalMatrix = ScaleMatrix * Matrix.CreateScale(xScale, 1, 1) * Matrix.CreateTranslation(Scale * new Vector3(0, 0, -this.Height * 0.190839f)); bulle.Skeleton.Bones[6].GlobalMatrix = ScaleMatrix * Matrix.CreateScale(xScale, 1, 1) * Matrix.CreateTranslation(Scale * new Vector3(this.Width * 0.190839f - 20f, 0, 4f * (float)Math.Sin((DateTime.Now.Millisecond / 500f) * MainGame.PI) + this.Height * 0.190839f)); break; case DisplayType.Disapear: if (xScale > 1f) { xScale *= 0.95f; } PlayingPath /= 1.13f; if (PlayingPath > 25f) { bulle.Opacity = (this.PlayingPath - 25f) / 75f; } else { bulle.Opacity = 0; } bulle.Skeleton.Bones[2].GlobalMatrix = ScaleMatrix * Matrix.CreateTranslation(Scale * new Vector3((this.PlayingPath / 100f) * this.Width * 0.190839f, 0, -(this.PlayingPath / 100f) * this.Height * 0.190839f)); bulle.Skeleton.Bones[4].GlobalMatrix = ScaleMatrix * Matrix.CreateTranslation(Scale * new Vector3((this.PlayingPath / 100f) * this.Width * 0.190839f, 0, (this.PlayingPath / 100f) * this.Height * 0.190839f)); bulle.Skeleton.Bones[1].GlobalMatrix = ScaleMatrix * Matrix.CreateTranslation(Scale * new Vector3((this.PlayingPath / 100f) * -this.Width * 0.190839f, 0, (this.PlayingPath / 100f) * -this.Height * 0.190839f)); bulle.Skeleton.Bones[3].GlobalMatrix = ScaleMatrix * Matrix.CreateTranslation(Scale * new Vector3((this.PlayingPath / 100f) * -this.Width * 0.190839f, 0, (this.PlayingPath / 100f) * this.Height * 0.190839f)); bulle.Skeleton.Bones[6].GlobalMatrix = ScaleMatrix * Matrix.CreateScale(xScale, 1, 1) * Matrix.CreateTranslation(Scale * new Vector3(this.Width * 0.190839f - 20f, 0, 4f * (float)Math.Sin((DateTime.Now.Millisecond / 500f) * MainGame.PI) + this.Height * 0.190839f)); if (PlayingPath <= 1f) { this.displayType = DisplayType.None; } break; } /*if (PlayingPath >= 100f) * return;*/ RecreateVertexBuffer(); }