public SampleItem(ISample sample, Font font) { var sampleName = sample.GetType().Name; Sample = sample; Texture = Engine.Graphics.CreateTexture2D("Data/Browser/" + sampleName + ".png"); if (Texture == null) { Texture = Engine.Graphics.CreateTexture2D("Data/Browser/Default.png"); } Scale = Size / Texture.Size.To2DF(); var text = sampleName; if (text.Length > TitleMaxLength) { text = "…" + text.Substring(text.Length - TitleMaxLength); } Title = new TextObject2D() { Text = text, Font = font, Position = new Vector2DF(0, 115), DrawingPriority = 1, }; AddChild(Title, ChildMode.Position); frame = new TextureObject2D() { Texture = Engine.Graphics.CreateTexture2D("Data/Browser/Frame.png"), Position = new Vector2DF(-3, -3), }; AddChild(frame, ChildMode.Position); }
public ResultLayer(Score score, Difficulty difficulty, Result result) { // コンポーネントを作成・追加 AddComponent(new UIComponent(), "UI"); switch (difficulty) { case Difficulty.Casual: DiffColor = new Color(166, 226, 46); break; case Difficulty.Stylish: DiffColor = new Color(253, 151, 31); break; case Difficulty.Freaky: DiffColor = new Color(249, 38, 114); break; case Difficulty.Psychic: DiffColor = new Color(174, 129, 255); break; } // 曲名・サブタイトル・ジャケット・難易度 //-------------------------------------------------- var center = new Vector2DF(0.5f, 0); Jacket = new TextureObject2D { Texture = Graphics.CreateTexture(score.JacketPath), Scale = new Vector2DF(0.5f, 0.5f), Position = new Vector2DF(50, 270) }; Title = new Makinas(48, 4, center) { Text = score.Title, Position = new Vector2DF(480, 130) }; Subtitle = new Makinas(32, 4, center) { Text = score.Subtitle, Position = new Vector2DF(480, 190) }; LevelValue = new GridGazer(72, DiffColor, 4, new Color(), center) { Text = "Lv." + score[difficulty].Level, Position = new Vector2DF(178, 550) }; LevelLabel = new GridGazer(48, DiffColor, 4, new Color(), center) { Text = difficulty.ToString().ToUpper(), Position = new Vector2DF(178, 620) }; //-------------------------------------------------- // 得点その他詳細 //-------------------------------------------------- ScoreLabel = new ScoreDozer(36, 4) { Text = "SCORE", Position = new Vector2DF(350, 260), IsDrawn = false }; ScoreValue = new ScoreDozer(100, 4) { Text = result.Score.ToString(), Position = new Vector2DF(350, 300), IsDrawn = false }; Just = new ScoreDozer(28, new Color(230, 219, 116), 1, new Color(255, 255, 0)) { Text = "JUST : " + string.Format("{0:D4}", result.Just), Position = new Vector2DF(350, 420), IsDrawn = false }; Cool = new ScoreDozer(28, new Color(249, 38, 114), 1, new Color(255, 0, 255)) { Text = "COOL : " + string.Format("{0:D4}", result.Cool), Position = new Vector2DF(350, 460), IsDrawn = false }; Good = new ScoreDozer(28, new Color(166, 226, 46), 1, new Color(0, 255, 0)) { Text = "GOOD : " + string.Format("{0:D4}", result.Good), Position = new Vector2DF(350, 500), IsDrawn = false }; Near = new ScoreDozer(28, new Color(49, 137, 211), 1, new Color(0, 255, 255)) { Text = "NEAR : " + string.Format("{0:D4}", result.Near), Position = new Vector2DF(350, 540), IsDrawn = false }; Miss = new ScoreDozer(28, new Color(0, 0, 0), 1, new Color(255, 0, 0)) { Text = "MISS : " + string.Format("{0:D4}", result.Miss), Position = new Vector2DF(350, 580), IsDrawn = false }; Combo = new ScoreDozer(28, new Color(255, 255, 255), 1, new Color(0, 0, 0)) { Text = "COMBO : " + string.Format("{0:D4}", result.BestCombo), Position = new Vector2DF(350, 630), IsDrawn = false }; RankObject = new TextureObject2D { Texture = Graphics.CreateTexture("Image/Rank_" + result.Rank + ".png"), CenterPosition = new Vector2DF(165, 105), Position = new Vector2DF(765, 540), IsDrawn = false }; RankImpact = new TextureObject2D { Texture = Graphics.CreateTexture("Image/Rank_" + result.Rank + ".png"), CenterPosition = new Vector2DF(165, 105), Position = new Vector2DF(765, 540), IsDrawn = false }; //-------------------------------------------------- }
protected override void OnStart() { var texture = Engine.Graphics.CreateTexture2D(CloudTexturePath); var parent = new TextureObject2D() { Texture = texture, Position = new Vector2DF(20, 20), Color = new Color(255, 128, 128, 255), DrawingPriority = 2, }; var child1 = new TextureObject2D() { Texture = texture, Position = new Vector2DF(0, 100), Color = new Color(128, 128, 255, 255), DrawingPriority = 1, }; var child2 = new TextureObject2D() { Texture = texture, Position = new Vector2DF(100, 0), Color = new Color(128, 128, 255, 255), DrawingPriority = 1, }; var child3 = new TextureObject2D() { Texture = texture, Position = new Vector2DF(30, 30), Color = new Color(255, 255, 128, 255), DrawingPriority = 3, }; var child4 = new TextureObject2D() { Texture = texture, Position = new Vector2DF(30, 30), Color = new Color(64, 255, 64, 255), DrawingPriority = 3, }; parent.AddDrawnChild(child1, ChildManagementMode.Nothing, ChildTransformingMode.All, ChildDrawingMode.Color | ChildDrawingMode.DrawingPriority); parent.AddDrawnChild(child2, ChildManagementMode.Nothing, ChildTransformingMode.All, ChildDrawingMode.Nothing); child1.AddDrawnChild(child3, ChildManagementMode.Nothing, ChildTransformingMode.Position, ChildDrawingMode.Nothing); child1.AddDrawnChild(child4, ChildManagementMode.Nothing, ChildTransformingMode.All, ChildDrawingMode.Nothing); Engine.AddObject2D(parent); Engine.AddObject2D(child1); Engine.AddObject2D(child2); Engine.AddObject2D(child3); Engine.AddObject2D(child4); Console.WriteLine(child3.GetGlobalPosition()); Console.WriteLine(child4.GetGlobalPosition()); }
public ProfileCardView(Model.Objects.BattleToken model, Font headerFont, Font planeFont) { void AddChild(Object2D obj) { base.AddChild(obj, ChildManagementMode.Disposal | ChildManagementMode.RegistrationToLayer, ChildTransformingMode.All); } this.Model = model; var illust = new TextureObject2D() { Texture = Engine.Graphics.CreateTexture2D(model.Property.ProfileImage), TextureFilterType = TextureFilterType.Linear, }; var overlay = new TextureObject2D() { Texture = Engine.Graphics.CreateTexture2D("Textures/ProfileOverlay.png"), DrawingPriority = 1, TextureFilterType = TextureFilterType.Linear, }; var name = new TextObject2D() { Font = headerFont, Position = new Vector2DF(overlay.Texture.Size.X / 2, 40), Text = model.Property.Name, Color = new Color(0, 0, 0), DrawingPriority = 2, }; name.SetCenterPosition(Altseed.Reactive.CenterPosition.CenterCenter); int skillIndex = 0; foreach (var skill in model.Skills) { var header = new TextObject2D() { Font = headerFont, Scale = new Vector2DF(1, 1) / 1.5f, Color = new Color(0, 0, 0), Position = new Vector2DF(25, 359 + skillIndex * 88), Text = skill.Property.Name, DrawingPriority = 2, }; var body = new TextObject2D() { Font = planeFont, Scale = new Vector2DF(1, 1) * 3 / 4, Color = new Color(0, 0, 0), Position = new Vector2DF(51, 389 + skillIndex * 88), Text = skill.Property.Description, DrawingPriority = 2, }; AddChild(header); AddChild(body); } AddChild(illust); AddChild(overlay); AddChild(name); size = overlay.Texture.Size; }
static void Main(string[] args) { Engine.Initialize("STG", 480, 640, new EngineOption()); TextureObject2D player = new TextureObject2D(); player.Texture = Engine.Graphics.CreateTexture2D("Resource/icon_business_man01.png"); Engine.AddObject2D(player); player.CenterPosition = new Vector2DF(player.Texture.Size.X / 2.0f, player.Texture.Size.Y / 2.0f); player.Position = new Vector2DF(240, 500); player.Scale = new Vector2DF(0.2f, 0.2f); List <TextureObject2D> bullets = new List <TextureObject2D>(); while (Engine.DoEvents()) { float speed = 3; if (Engine.Keyboard.GetKeyState(Keys.Up) == KeyState.Hold) { player.Position = player.Position + new Vector2DF(0, -speed); } if (Engine.Keyboard.GetKeyState(Keys.Down) == KeyState.Hold) { player.Position = player.Position + new Vector2DF(0, speed); } if (Engine.Keyboard.GetKeyState(Keys.Left) == KeyState.Hold) { player.Position = player.Position + new Vector2DF(-speed, 0); } if (Engine.Keyboard.GetKeyState(Keys.Right) == KeyState.Hold) { player.Position = player.Position + new Vector2DF(speed, 0); } Vector2DF position = player.Position; position.X = MathHelper.Clamp(position.X, Engine.WindowSize.X - player.Texture.Size.X / 2.0f * player.Scale.X, player.Texture.Size.X / 2.0f * player.Scale.X); position.Y = MathHelper.Clamp(position.Y, Engine.WindowSize.Y - player.Texture.Size.Y / 2.0f * player.Scale.Y, player.Texture.Size.Y / 2.0f * player.Scale.Y); player.Position = position; if (Engine.Keyboard.GetKeyState(Keys.Z) == KeyState.Push) { TextureObject2D bullet = new TextureObject2D(); bullet.Texture = Engine.Graphics.CreateTexture2D("Resource/business_taisyoku_todoke.png"); bullet.CenterPosition = new Vector2DF(bullet.Texture.Size.X / 2.0f, bullet.Texture.Size.Y / 2.0f); bullet.Position = player.Position; bullet.Scale = new Vector2DF(0.2f, 0.2f); Engine.AddObject2D(bullet); bullets.Add(bullet); } foreach (TextureObject2D bullet in bullets) { bullet.Position = bullet.Position + new Vector2DF(0, -5); } Engine.Update(); } Engine.Terminate(); }