protected override void onDraw(Cairo.Context gr) { Rectangle rBack = new Rectangle(Slot.Size); //rBack.Inflate (-Margin); // if (BorderWidth > 0) // rBack.Inflate (-BorderWidth / 2); Background.SetAsSource(gr, rBack); CairoHelpers.CairoRectangle(gr, rBack, CornerRadius); gr.Fill(); if (BorderWidth > 0) { Foreground.SetAsSource(gr, rBack); CairoHelpers.CairoRectangle(gr, rBack, CornerRadius, BorderWidth); } gr.Save(); if (ClipToClientRect) { //clip to client zone CairoHelpers.CairoRectangle(gr, ClientRectangle, Math.Max(0.0, CornerRadius - Margin)); gr.Clip(); } if (child != null) { child.Paint(ref gr); } gr.Restore(); }
public override void Draw(GameTime gameTime) { Camera.Draw(spriteBatch); Cursor.Instance.Draw(gameTime, spriteBatch); if (!Parameter.ShouldChangeBGScale) { Background.Draw(gameTime, spriteBatch); } PopupHandler.Draw(gameTime, spriteBatch); if (!Parameter.ShouldChangeBGScale) { BackgroundFlipbookList.ForEach((x) => x.Draw(gameTime, spriteBatch)); } Foreground.Draw(gameTime, spriteBatch); WeatherHandler.Draw(gameTime, spriteBatch); lock (MobileList) { MobileList.ForEach((x) => x.Draw(gameTime, spriteBatch)); HUD.Draw(gameTime, spriteBatch); } MineList.ForEach((x) => x.Draw(gameTime, spriteBatch)); ThorSatellite.Draw(gameTime, spriteBatch); DeathAnimation.Draw(gameTime, spriteBatch); SpecialEffectHandler.Draw(gameTime, spriteBatch); TextBalloonHandler.Draw(spriteBatch); }
protected override void onDraw(Cairo.Context gr) { gr.Save(); int spacing = (Parent as TabView).Spacing; gr.MoveTo(0.5, TabTitle.Slot.Bottom - 0.5); gr.LineTo(TabTitle.Slot.Left - spacing, TabTitle.Slot.Bottom - 0.5); gr.CurveTo( TabTitle.Slot.Left - spacing / 2, TabTitle.Slot.Bottom - 0.5, TabTitle.Slot.Left - spacing / 2, 0.5, TabTitle.Slot.Left, 0.5); gr.LineTo(TabTitle.Slot.Right, 0.5); gr.CurveTo( TabTitle.Slot.Right + spacing / 2, 0.5, TabTitle.Slot.Right + spacing / 2, TabTitle.Slot.Bottom - 0.5, TabTitle.Slot.Right + spacing, TabTitle.Slot.Bottom - 0.5); gr.LineTo(Slot.Width - 0.5, TabTitle.Slot.Bottom - 0.5); gr.LineTo(Slot.Width - 0.5, Slot.Height - 0.5); gr.LineTo(0.5, Slot.Height - 0.5); gr.ClosePath(); gr.LineWidth = 2; Foreground.SetAsSource(gr); gr.StrokePreserve(); gr.Clip(); base.onDraw(gr); gr.Restore(); }
public override object ProvideValue(IServiceProvider serviceProvider) { switch (PatternType) { case PatternTypes.DiagonalHatched: return(InkedPattern.CreateDiagonalHatchedPattern( Foreground.ToDrawingColor(), Background.ToDrawingColor()).AsMediaBrushTiled()); case PatternTypes.DiagonalFatStripes: return(InkedPattern.CreateFatStripedPattern( Foreground.ToDrawingColor(), Background.ToDrawingColor()).AsMediaBrushTiled()); case PatternTypes.DiagonalStripes: return(InkedPattern.CreateStripedPattern( Foreground.ToDrawingColor(), Background.ToDrawingColor()).AsMediaBrushTiled()); case PatternTypes.Dithered: return(InkedPattern.CreateDitheredPattern( Foreground.ToDrawingColor(), Background.ToDrawingColor()).AsMediaBrushTiled()); case PatternTypes.Solid: return(InkedPattern.CreateSolidPattern(Foreground.ToDrawingColor()).AsMediaBrushTiled()); } return(null); }
public override int GetHashCode() { unchecked { return((Name != null ? Name.GetHashCode() : 0) ^ Foreground.GetHashCode() ^ Background.GetHashCode() ^ FontWeight.GetHashCode() ^ FontStyle.GetHashCode()); } }
//initialize game here public Level(MyGame pMyGame) { _myGame = pMyGame; rnd = new Random(); player1 = new Player("assets\\player_sprite\\player_sheet.png", Key.A, Key.D, Key.W, Key.S, Key.V, Key.B, 20, 7); AddChildAt(player1, 3); player1.SetXY(100, 600); background = new Background(); foreground = new Foreground(); foreground.y = -1; AddChildAt(background, 2); bgMusicSound = new Sound("assets\\sfx\\level.wav", true, true); levelCompleteMusic = new Sound("assets\\sfx\\level_complete.wav", false, false); playMusic = bgMusicSound.Play(); _em = new EnemyManager(player1); _em.createEnemies(); _em.GetDeadEnemyList().CollectionChanged += Level_CollectionChanged; fighterListOrder.Add(player1); foreach (Fighter fighter in _em.GetAllEnemies()) { fighterListOrder.Add(fighter); } hud = new HUD(this, GetPlayer()); hud.y = game.height - hud.height; game.AddChildAt(hud, 1); }
public void Save(XmlTextWriter writer) { writer.WriteStartElement("Overlay"); writer.WriteAttributeString("name", Name); writer.WriteAttributeString("x", Tiles.BaseX.ToString()); writer.WriteAttributeString("y", Tiles.BaseY.ToString()); if (Foreground) { writer.WriteAttributeString("foreground", Foreground.ToString()); } if (Parallax) { writer.WriteAttributeString("parallax", Parallax.ToString()); } foreach (var entity in Entities) { entity.Save(writer); } foreach (var keyframe in Keyframes) { keyframe.Save(writer); } writer.WriteEndElement(); }
protected override void onDraw(Cairo.Context gr) { base.onDraw(gr); Rectangle r = ClientRectangle; if (Foreground != null) //TODO:test if null should be removed { Foreground.SetAsSource(gr, r); CairoHelpers.CairoRectangle(gr, r, CornerRadius); gr.Fill(); } Crow.Gradient grad = new Gradient(Gradient.Type.Horizontal); grad.Stops.Add(new Gradient.ColorStop(0, new Color(1, 1, 1, 1))); grad.Stops.Add(new Gradient.ColorStop(1, new Color(1, 1, 1, 0))); grad.SetAsSource(gr, r); CairoHelpers.CairoRectangle(gr, r, CornerRadius); gr.Fill(); grad = new Gradient(Gradient.Type.Vertical); grad.Stops.Add(new Gradient.ColorStop(0, new Color(0, 0, 0, 0))); grad.Stops.Add(new Gradient.ColorStop(1, new Color(0, 0, 0, 1))); grad.SetAsSource(gr, r); CairoHelpers.CairoRectangle(gr, r, CornerRadius); gr.Fill(); }
protected override void onDraw(Context gr) { gr.Save(); TabView tv = Parent as TabView; Rectangle r = TabTitle.Slot; r.Width = TabWidth; gr.MoveTo(0.5, r.Bottom - 0.5); gr.LineTo(r.Left - tv.LeftSlope, r.Bottom - 0.5); gr.CurveTo( r.Left - tv.LeftSlope / 2, r.Bottom - 0.5, r.Left - tv.LeftSlope / 2, 0.5, r.Left, 0.5); gr.LineTo(r.Right, 0.5); gr.CurveTo( r.Right + tv.RightSlope / 2, 0.5, r.Right + tv.RightSlope / 2, r.Bottom - 0.5, r.Right + tv.RightSlope, r.Bottom - 0.5); gr.LineTo(Slot.Width - 0.5, r.Bottom - 0.5); gr.LineTo(Slot.Width - 0.5, Slot.Height - 0.5); gr.LineTo(0.5, Slot.Height - 0.5); gr.ClosePath(); gr.LineWidth = 1; Foreground.SetAsSource(gr); gr.StrokePreserve(); gr.Clip(); base.onDraw(gr); gr.Restore(); }
public void Draw() { BG.Draw(); Road.Draw(); Obstacles.ForEach(o => o.Draw()); Player.Draw(); Foreground.Draw(); if (Paused && !lost) { Util.DrawText("Press SPACE to jump!", new Vector2(150, 20)); } if (lost) { if (highScore) { Util.DrawText("NEW HIGH SCORE: " + score.ToString(), new Vector2(150, 20)); } else { Util.DrawText("Final score: " + score.ToString(), new Vector2(150, 20)); } } DrawScore(); }
private String getStoryboardContent(String BackgroundContent, String FailContent, String PassContent, String ForegroundContent) { String StoryboardContent = ""; StoryboardContent += "//Storyboard Layer 0 (Background)\n"; if (BackgroundContent != null) { StoryboardContent += Background.getContent(); } StoryboardContent += "//Storyboard Layer 1 (Fail)\n"; if (FailContent != null) { StoryboardContent += Fail.getContent(); } StoryboardContent += "//Storyboard Layer 2 (Pass)\n"; if (PassContent != null) { StoryboardContent += Pass.getContent(); } StoryboardContent += "//Storyboard Layer 3 (Foreground)\n"; if (ForegroundContent != null) { StoryboardContent += Foreground.getContent(); } StoryboardContent += "//Storyboard Sound Samples\n"; return(StoryboardContent); }
internal WEL_CFG(PFSSection Section) { _pfsHandle = Section; for (int i = 1; i <= Section.GetSectionsNo(); i++) { PFSSection sub = Section.GetSection(i); switch (sub.Name) { case "WELLDATA": WELLDATA = new WELLDATA(sub); break; case "WELLFIELD": WELLFIELD = new WELLFIELD(sub); break; case "Foreground": Foreground = new Foreground(sub); break; case "Background": Background = new Foreground(sub); break; default: _unMappedSections.Add(sub.Name); break; } } }
public MainWindow() { InitializeComponent(); //Didn't know it was this easy to get raw quality... RenderOptions.SetBitmapScalingMode(MainCanvas, BitmapScalingMode.NearestNeighbor); RenderOptions.SetBitmapScalingMode(TileCanvas, BitmapScalingMode.NearestNeighbor); //Draw Grid by default. DrawGrid(PlannerSettings.DefaultWorldWidth, PlannerSettings.DefaultWorldHeight); //Used for zooming stuff. defaultMatrix = MainCanvas.LayoutTransform.Value; //We have block type selected by default. _selectedTile = new Foreground(); //Load Images, searching and tile selection box. GenerateSelector(); //Initialize the map used to store tiles, normal world size by default GenerateTileMap(PlannerSettings.DefaultWorldWidth, PlannerSettings.DefaultWorldHeight); //Set Background to forest. MainCanvas.Background = BackgroundData.GetBackground(BackgroundData.MainBackgroundType.Forest); DB.MainBackground = BackgroundData.MainBackgroundType.Forest; DB.hasMainBackground = true; //Draw Bedrock by default. DrawBedrock(); this.Title = $"{this.Title} ({UpdateChecker.current})"; }
public override void OnExit() { base.OnExit(); Foreground.RemoveAllChildren(true); Background.RemoveAllChildren(true); }
protected override void onDraw(Context gr) { base.onDraw(gr); Rectangle r = ClientRectangle; Foreground.SetAsSource(gr, r); gr.Rectangle(r, 0.1); gr.Stroke(); r.Width = _pic.Dimensions.Width * zoom / 100; r.Height = _pic.Dimensions.Height * zoom / 100; gr.Save(); editorMutex.EnterReadLock(); gr.Translate(-ScrollX, -ScrollY); if (_pic != null) { _pic.Paint(gr, r); } editorMutex.ExitReadLock(); gr.Restore(); }
public UserDropdownHeader() { Foreground.Padding = new MarginPadding { Left = 10, Right = 10 }; Margin = new MarginPadding { Bottom = 5 }; Masking = true; CornerRadius = 5; EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Shadow, Colour = Color4.Black.Opacity(0.25f), Radius = 4, }; Icon.TextSize = 14; Icon.Margin = new MarginPadding(0); Foreground.Add(statusIcon = new TextAwesome { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Icon = FontAwesome.fa_circle_o, TextSize = 14, }); Text.Margin = new MarginPadding { Left = LABEL_LEFT_MARGIN }; }
private void Canvas_Draw(CanvasControl sender, CanvasDrawEventArgs args) { var textFormat = new CanvasTextFormat() { FontSize = (float)FontSize, FontFamily = FontFamily.Source, FontStretch = FontStretch, FontWeight = FontWeight, FontStyle = FontStyle }; switch (TextWrapping) { case TextWrapping.NoWrap: textFormat.WordWrapping = CanvasWordWrapping.NoWrap; break; case TextWrapping.Wrap: textFormat.WordWrapping = CanvasWordWrapping.Wrap; break; case TextWrapping.WrapWholeWords: textFormat.WordWrapping = CanvasWordWrapping.WholeWord; break; default: throw new ArgumentOutOfRangeException(nameof(TextWrapping)); } _textLayout = new CanvasTextLayout(sender, Text, textFormat, (float)sender.Size.Width, (float)sender.Size.Height); args.DrawingSession.DrawGeometry(CanvasGeometry.CreateText(_textLayout), Foreground.ToCanvasBrush(sender), (float)StrokeThickness); }
public Form1() { InitializeComponent(); this.SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true); //set up the game timer GameTimer = new Timer(); GameTimer.Interval = 10; //10 milliseconds 1/100 second GameTimer.Tick += new EventHandler(GameTimer_Tick); //create the graphics object to draw with gameCanvas = pictureBox1.CreateGraphics(); //initialise sprite liono = new Liono(); //initialise bg bg = new Background(); stage = new Foreground(); //start the game if (gameStart == true) { GameTimer.Start(); } //handle game input // Set KeyPreview object to true to allow the form to process // the key before the control with focus processes it. this.KeyPreview = true; this.KeyDown += new KeyEventHandler(userInput); this.KeyUp += new KeyEventHandler(userNoInput); }
/// <summary> /// Returns the markup representation of this style. /// </summary> /// <returns>The markup representation of this style.</returns> public string ToMarkup() { var builder = new List <string>(); if (Decoration != Decoration.None) { var result = DecorationTable.GetMarkupNames(Decoration); if (result.Count != 0) { builder.AddRange(result); } } if (Foreground != Color.Default) { builder.Add(Foreground.ToMarkup()); } if (Background != Color.Default) { if (builder.Count == 0) { builder.Add("default"); } builder.Add("on " + Background.ToMarkup()); } return(string.Join(" ", builder)); }
public UserDropdownHeader() { Foreground.Padding = new MarginPadding { Left = 10, Right = 10 }; Margin = new MarginPadding { Bottom = 5 }; Masking = true; CornerRadius = 5; EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Colour = Color4.Black.Opacity(0.25f), Radius = 4, }; Icon.Size = new Vector2(14); Icon.Margin = new MarginPadding(0); Foreground.Add(statusIcon = new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Icon = FontAwesome.Regular.Circle, Size = new Vector2(14), }); Text.Margin = new MarginPadding { Left = LABEL_LEFT_MARGIN }; }
/// <inheritdoc/> public override int GetHashCode() { int?GetLinkHashCode() { #if NETSTANDARD2_0 return(Link?.GetHashCode()); #else return(Link?.GetHashCode(StringComparison.Ordinal)); #endif } unchecked { var hash = (int)2166136261; hash = (hash * 16777619) ^ Foreground.GetHashCode(); hash = (hash * 16777619) ^ Background.GetHashCode(); hash = (hash * 16777619) ^ Decoration.GetHashCode(); if (Link != null) { hash = (hash * 16777619) ^ GetLinkHashCode() ?? 0; } return(hash); } }
void StartGame() { _timeup = new Sound("time-up.wav"); _background = new Background(width, height); AddChild(_background); _charater = new Character(550, 300); AddChild(_charater); _clock = new Clock((width / 6) * 5, 0); AddChild(_clock); _foreground = new Foreground(width, height); AddChild(_foreground); _textBox = new TextBox(400, 800, _textboxText); AddChild(_textBox); _button1 = new Button(1300, 500, _text1); AddChild(_button1); _button2 = new Button(1300, 650, _text2); AddChild(_button2); _button3 = new Button(1300, 800, _text3); AddChild(_button3); }
/// <summary> /// Renders the specified matrix. /// </summary> /// <param name="matrix">The matrix.</param> /// <param name="format">The format.</param> /// <param name="content">The content.</param> /// <param name="options">The options.</param> /// <returns></returns> public Bitmap Render(BitMatrix matrix, BarcodeFormat format, string content, EncodingOptions options) { var width = matrix.Width; var height = matrix.Height; var pixels = new int[width * height]; var outputIndex = 0; var fColor = Foreground.ToArgb(); var bColor = Background.ToArgb(); for (var y = 0; y < height; y++) { for (var x = 0; x < width; x++) { pixels[outputIndex] = matrix[x, y] ? fColor : bColor; outputIndex++; } } //IntPtr bitmap ; //bitmap = System.Runtime.InteropServices.Marshal.AllocHGlobal(width * height * 4); //System.Runtime.InteropServices.Marshal.Copy(pixels, 0, bitmap, pixels.Length); //return new Bitmap(width, height, 4 * width, System.Drawing.Imaging.PixelFormat.Format32bppArgb, bitmap); Bitmap bitmap = Bitmap.CreateBitmap(width, height, Bitmap.Config.Argb8888); bitmap.SetPixels(pixels, 0, width, 0, 0, width, height); return(bitmap); }
public GameplaySceneBackgroundAndMusicManager(Game game) : base(game) { SizeOfTextures = new Rectangle(0, 0, Game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height); Foreground foreground = new Foreground(Game); Game.Services.GetService <GameplayScene>().SceneComponents.Add(foreground); }
public override int GetHashCode() { return (Background.GetHashCode() ^ Foreground.GetHashCode() ^ Char.GetHashCode()); }
public override void Reload() { //clean up FCanvas.Clear(); Foreground.Clear(); Background.Clear(); DepthOffsets.Clear(); if (FRootMapper != null) { FRootMapper.Dispose(); } FRootMapper = new ModelMapper(Input, Registry); FCanvas.Root.Add(Background); FCanvas.Root.Add(Foreground); //start building the tree from the root if (FRootNode != null) { FRootNode.Dispose(); } FRootNode = new MapperHierarchyNode(FRootMapper, FCanvas, Background, this); UpdateView(); ViewAll(); }
public void initPause() { this.Camera2D.SetViewFromViewport(); if (sprite_button_returntogame == null) { sprite_button_returntogame = new SpriteUV(new TextureInfo("/Application/data/button_returntogame.png")); } sprite_button_returntogame.CenterSprite(new Vector2(0.5f, 0.5f)); sprite_button_returntogame.Scale = sprite_button_returntogame.TextureInfo.TextureSizef * 1.5f; sprite_button_returntogame.Position = new Vector2(960.0f / 2.0f, 544.0f / 2.0f + 100.0f); if (sprite_button_returntomenu == null) { sprite_button_returntomenu = new SpriteUV(new TextureInfo("/Application/data/button_returntomenu.png")); } sprite_button_returntomenu.CenterSprite(new Vector2(0.5f, 0.5f)); sprite_button_returntomenu.Scale = sprite_button_returntomenu.TextureInfo.TextureSizef * 1.5f; sprite_button_returntomenu.Position = new Vector2(960.0f / 2.0f, 544.0f / 2.0f - 100.0f); Foreground.AddChild(sprite_button_returntogame); Foreground.AddChild(sprite_button_returntomenu); }
public virtual string ToCss() { StringBuilder b = new StringBuilder(); if (Foreground != null) { Color?c = Foreground.GetColor(null); if (c != null) { b.AppendFormat(CultureInfo.InvariantCulture, "color: #{0:x2}{1:x2}{2:x2}; ", c.Value.R, c.Value.G, c.Value.B); } } if (FontWeight != null) { b.Append("font-weight: "); b.Append(FontWeight.Value.ToString().ToLowerInvariant()); b.Append("; "); } if (FontStyle != null) { b.Append("font-style: "); b.Append(FontStyle.Value.ToString().ToLowerInvariant()); b.Append("; "); } return(b.ToString()); }
protected override void DrawGraduations(Context gr, PointD pStart, PointD pEnd) { Rectangle r = ClientRectangle; Foreground.SetAsSource(gr); gr.LineWidth = 2; gr.MoveTo(pStart); gr.LineTo(pEnd); gr.Stroke(); gr.LineWidth = 1; double sst = unity * SmallIncrement; double bst = unity * LargeIncrement; PointD vBar = new PointD(0, sst); for (double x = Minimum; x <= Maximum - Minimum; x += SmallIncrement) { double lineLength = r.Height / 3; if (x % LargeIncrement != 0) { lineLength /= 3; } PointD p = new PointD(pStart.X + x * unity, pStart.Y); gr.MoveTo(p); gr.LineTo(new PointD(p.X, p.Y + lineLength)); } gr.Stroke(); }
public TutorialScene() { this.Camera2D.SetViewFromViewport(); tut1 = new SpriteUV(new TextureInfo("/Application/data/tut1.png")); tut1.Scale = tut1.TextureInfo.TextureSizef; Foreground.AddChild(tut1); }
// ///////////////////////////////////////////////////////////////////////////////// /// <summary> /// Returns the embedded string code for this color. /// <note>Embedded colors are currently not working correctly</note> /// </summary> /// <returns></returns> public string GetCode() { string str = string.Format("{0}{1}", Foreground.DoForegroundCode(), Background.DoBackgroundCode()); return(str); }
static void WriteHelper(string str, Foreground fColor, Background bColor, short attr) { IntPtr h = StdOut; SetConsTextAttr(h, (short)((ushort)fColor | (ushort)bColor)); Console.Write(str); // Restore old settings SetConsTextAttr(h, attr); }
public WEL_CFG(string pfsname) { _pfsHandle = new PFSSection(pfsname); WELLDATA = new WELLDATA("WELLDATA" ); _pfsHandle.AddSection(WELLDATA._pfsHandle); WELLFIELD = new WELLFIELD("WELLFIELD" ); _pfsHandle.AddSection(WELLFIELD._pfsHandle); Foreground = new Foreground("Foreground" ); _pfsHandle.AddSection(Foreground._pfsHandle); Background = new Foreground("Background" ); _pfsHandle.AddSection(Background._pfsHandle); }