private void InitializeAnimations() { // Idle animation animIdle = new AnimatedConsole("default", 1, 1, Font); animIdle.CreateFrame().SetGlyph(0, 0, Font.Master.GetGlyphDefinition("Idle").Glyph); Animations.Add("Idle", animIdle); // Walk right animation animWalkRight = new AnimatedConsole("WalkRight", 1, 1, Font) { AnimationDuration = 0.5f, Repeat = true, }; foreach (GlyphDefinition glyphDef in Font.Master.ListGlyphDefinitions("WalkRight")) { Cell singleCell = animWalkRight.CreateFrame().Cells[0]; singleCell.Glyph = glyphDef.Glyph; singleCell.Mirror = glyphDef.Mirror; } Animations.Add("WalkRight", animWalkRight); animWalkLeft = new AnimatedConsole("WalkLeft", 1, 1, Font) { AnimationDuration = 0.5f, Repeat = true }; foreach (GlyphDefinition glyphDef in Font.Master.ListGlyphDefinitions("WalkRight", SpriteEffects.FlipHorizontally)) { Cell singleCell = animWalkLeft.CreateFrame().Cells[0]; singleCell.Glyph = glyphDef.Glyph; singleCell.Mirror = glyphDef.Mirror; } Animations.Add("WalkLeft", animWalkLeft); }
private void ButtonSave_Click(object sender, EventArgs e) { loadedView.Children.Clear(); if (optionButtonSurface.IsSelected) { basicSurface.Save("basicsurface.surface"); loadedView.Children.Add(SadConsole.Console.Load("basicsurface.surface")); } else if (optionButtonView.IsSelected) { viewSurface.Save("viewsurface.view"); var loaded = Console.Load("viewsurface.view"); loaded.SetSurface(basicSurface, new Rectangle(5, 2, 34 - 10, 15 - 4)); basicSurface.IsDirty = true; viewSurface.IsDirty = true; loadedView.Children.Add(loaded); loaded.Fill(new Rectangle(1, 1, loaded.Width - 2, 3), Color.White, Color.DarkBlue, 0, SpriteEffects.None); loaded.Print(2, 2, "Loaded view"); //loadedView.Children.Add(SadConsole.Surfaces.Basic.Load("viewsurface.view", basicSurface); } else if (optionButtonLayered.IsSelected) { layeredSurface.Save("layeredObject.layered"); var layers = LayeredConsole.Load("layeredObject.layered"); loadedView.Children.Add(layers); } else if (optionButtonAnimated.IsSelected) { animatedSurface.Save("animatedsurface.animation"); var animation = AnimatedConsole.Load("animatedsurface.animation"); animation.Start(); loadedView.Children.Add(animation); } }
public MagnifyingGlass(Coord position) : base(3, 3) { Position = position; //this section straight out of Animation = new AnimatedConsole("Looking Glass", 3, 3, Global.FontDefault); Animation.SetSurface(PrintingCells()); animation.CreateFrame(); Animations = new Dictionary <string, AnimatedConsole>(); Animations.Add("looking glass", animation); MouseMove += Mouse_Move; }
public EntityConsole() : base(80, 23) { var animation = new AnimatedConsole("default", 1, 1); var frame = animation.CreateFrame(); frame.Cells[0].Glyph = 1; player = new Entity(animation); player.Position = new Point(Width / 2, Height / 2); player.Components.Add(new SadConsole.Components.EntityViewSyncComponent()); playerPreviousPosition = player.Position; Children.Add(player); // Setup this console to accept keyboard input. UseKeyboard = true; IsVisible = false; }
public EntityConsole() : base(80, 23) { var animation = new AnimatedConsole("default", 1, 1); CellSurface frame = animation.CreateFrame(); frame.Cells[0].Glyph = 1; frame.SetDecorator(0, 2, new CellDecorator(Color.Yellow, 69, SpriteEffects.None)); player = new Entity(animation) { Position = new Point(Width / 2, Height / 2) }; player.Components.Add(new SadConsole.Components.EntityViewSyncComponent()); playerPreviousPosition = player.Position; Children.Add(player); // Setup this console to accept keyboard input. UseKeyboard = true; IsVisible = false; }
public Entity(AnimatedConsole animation, Coord position, int layer, bool isWalkable, bool isTransparent) : base(animation) { Initialize(position, layer, isWalkable, isTransparent); }