public override Graphics CreateGraphics() { if (graphics == null) return null; var handler = new GraphicsHandler((GraphicsHandler)graphics.Handler); handler.BeginDrawing(); return new Graphics(Generator, handler); }
public override void Apply (object control, GraphicsHandler graphics) { var gradient = ((EtoGradient)control); if (!object.ReferenceEquals (gradient.Transform, null)) graphics.Control.Transform (gradient.Transform); graphics.Control.Pattern = gradient; graphics.Control.Fill (); }
private void OnPaint(object sender, PaintEventArgs e) { // Draw all the shapes foreach (Shape shape in shapes) { GraphicsHandler drawhandler = new GraphicsHandler(e); drawhandler.Draw(shapes); } }
public override void Apply(object control, GraphicsHandler graphics) { var gradient = ((EtoGradient)control); var scale = gradient.Radius.Height / gradient.Radius.Width; if (!object.ReferenceEquals(gradient.Transform, null)) graphics.Control.Transform(gradient.Transform); graphics.Control.Transform(new Cairo.Matrix(1, 0f, 0f, scale, 0, gradient.GradientOrigin.Y - gradient.GradientOrigin.Y * scale)); graphics.Control.SetSource(gradient); graphics.Control.Fill(); }
protected override void Initialize() { base.Initialize(); Control.SetStyle(swf.ControlStyles.SupportsTransparentBackColor | swf.ControlStyles.DoubleBuffer, false); Control.SetStyle(swf.ControlStyles.AllPaintingInWmPaint | swf.ControlStyles.Opaque, true); Control.HandleCreated += (sender, e) => { graphics = new Graphics(Generator, new GraphicsHandler(this)); graphicsHandler = (GraphicsHandler)graphics.Handler; }; }
public void Apply (GraphicsHandler graphics) { graphics.Control.SetSourceColor(Color); graphics.Control.LineWidth = Thickness; graphics.Control.LineCap = LineCap; graphics.Control.LineJoin = LineJoin; if (cairodashes != null) graphics.Control.SetDash (cairodashes, cairooffset); graphics.Control.MiterLimit = MiterLimit; graphics.Control.Stroke (); }
public void Draw(GraphicsHandler graphics, RectangleF rect) { var context = graphics.Control; context.SaveState(); context.ConcatCTM(transform); context.ConcatCTM(new CGAffineTransform(1, 0, 0, -1, 0, Image.Height)); //transform.ToEto().TransformRectangle(rect); if (Opacity < 1f) { context.SetBlendMode(CGBlendMode.Normal); context.SetAlpha(Opacity); } context.DrawTiledImage(new CGRect(0, 0, Image.Width, Image.Height), Image); context.RestoreState(); }
public void Apply (GraphicsHandler graphics) { if (!object.ReferenceEquals (Transform, null)) graphics.Control.Transform (Transform); Gdk.CairoHelper.SetSourcePixbuf (graphics.Control, Pixbuf, 0, 0); var surfacePattern = graphics.Control.Source as Cairo.SurfacePattern; if (surfacePattern != null) surfacePattern.Extend = Cairo.Extend.Repeat; if (Opacity < 1.0f) { graphics.Control.Clip(); graphics.Control.PaintWithAlpha(Opacity); } else graphics.Control.Fill(); }
public void Apply (GraphicsHandler graphics) { graphics.Control.SetFillColorSpace (patternColorSpace); // make current transform apply to the pattern var currentTransform = graphics.Control.GetCTM(); if (graphics.DisplayView != null) { var pos = graphics.DisplayView.ConvertPointToView (sd.PointF.Empty, null); currentTransform.Translate(pos.X, pos.Y); graphics.Control.SetPatternPhase(new sd.SizeF(-pos.X, -pos.Y)); } if (pattern == null || viewTransform != currentTransform) { viewTransform = currentTransform; SetPattern (); } graphics.Control.SetFillPattern (pattern, alpha); }
public void Apply(GraphicsHandler graphics) { graphics.SetFillColorSpace(); #if OSX if (graphics.DisplayView != null) { // adjust for position of the current view relative to the window var pos = graphics.DisplayView.ConvertPointToView(sd.PointF.Empty, null); graphics.Control.SetPatternPhase(new sd.SizeF(pos.X, pos.Y)); } #endif // make current transform apply to the pattern var currentTransform = graphics.CurrentTransform; if (pattern == null || viewTransform != currentTransform) { viewTransform = currentTransform; SetPattern(); } graphics.Control.SetFillPattern(pattern, alpha); }
public override void Draw(object control, GraphicsHandler graphics, RectangleF rect) { ((BrushObject)control).Draw(graphics, rect); }
public void Apply (Pen widget, GraphicsHandler graphics) { ((PenObject)widget.ControlObject).Apply (graphics); }
public void Draw(GraphicsHandler graphics, RectangleF rect) { var start = StartPoint; var end = EndPoint; if (transform != null) { start = transform.TransformPoint(start); end = transform.TransformPoint(end); } if (wrap == GradientWrapMode.Pad) { if (Gradient == null) Gradient = new CGGradient(CGColorSpace.CreateDeviceRGB(), new [] { StartColor, EndColor }, new nnfloat[] { (nnfloat)0f, (nnfloat)1f }); } else { var scale = GradientHelper.GetLinearScale(ref start, ref end, rect, lastScale, wrap == GradientWrapMode.Reflect ? 2f : 1f); if (Gradient == null || scale > lastScale) { var stops = GradientHelper.GetGradientStops(StartColor, EndColor, scale, wrap).ToList(); Gradient = new CGGradient(CGColorSpace.CreateDeviceRGB(), stops.Select(r => r.Item2).ToArray(), stops.Select(r => (nnfloat)r.Item1).ToArray()); lastScale = scale; } } var context = graphics.Control; context.DrawLinearGradient(Gradient, start.ToNS(), end.ToNS(), CGGradientDrawingOptions.DrawsAfterEndLocation | CGGradientDrawingOptions.DrawsBeforeStartLocation); }
public abstract void Draw(object control, GraphicsHandler graphics, RectangleF rect);
public override void Update(ref TouchHandler touchHandler_, GameTime gameTime_) { // Update in game state // ================ // Update touch input handler touchHandler_.Update(); // Create lists to contain touches for each player List <List <TouchLocation> > playerTouches = new List <List <TouchLocation> >(); for (int p = 0; p < m_players.Count; ++p) { playerTouches.Add(new List <TouchLocation>()); } // Iterate through each player and sort out which touches are for which player foreach (TouchLocation tl in touchHandler_.GetTouches()) { for (int index = 0; index < playerTouches.Count; ++index) { if (m_players[index].m_controlScheme.GetTouchZone().IsInsideZone(tl.Position)) { playerTouches[index].Add(tl); } } } //only want to do this when the main game isnt running if (!PlayersReady) { //check if a players ready up button has been pressed foreach (TouchLocation tl in touchHandler_.GetTouches()) { for (int index = 0; index < m_players.Count; ++index) { if (m_players[index].m_ReadyButton.Activated(tl.Position)) { m_players[index].m_ReadyUp = true; m_players[index].m_ReadyButton.m_sprite.SetTexture(TextureHandler.readySelectedButton); } } } //Set to 0 every run, so that it doesnt count multiple touches from same person NoPlayersReady = 0; foreach (Player p in m_players) { if (p.m_ReadyUp == true) { NoPlayersReady += 1; } } //When all players have readied up, start main game if (NoPlayersReady == m_players.Count) { countdownBeeps.IsLooped = false; countdownBeeps.Play(); PlayersReady = true; } h_trackHandler.Update(m_players, ref m_rankings); } else if (PlayersReady) { startTimer.Update(gameTime_.ElapsedGameTime.Milliseconds); if (startTimer.timerFinished) { for (int i = 0; i < m_players.Count; ++i) { if (m_players[i].m_currentLap == Settings.m_number_laps) { m_players[i].SetFinished(true); m_players[i].GetVehicle().SetToSensor(); m_players[i].AddFinishTime(gameTime_.ElapsedGameTime.Milliseconds); if (m_winner == 0) { m_winner = m_players[i].GetID(); } } if (!m_players[i].GetFinished() || (m_players[i].GetFinished() && m_players[i].GetFinishTime() < 500)) { bool left = false; bool right = false; bool brake = false; if (Keyboard.GetState().IsKeyDown(Keys.Left)) { left = true; } if (Keyboard.GetState().IsKeyDown(Keys.Right)) { right = true; } if (Keyboard.GetState().IsKeyDown(Keys.Space) || Keyboard.GetState().IsKeyDown(Keys.Down)) { brake = true; } m_players[i].KeyboardMove(left, right, brake); m_players[i].Update(playerTouches[i], m_rankings[i]); m_players[i].AddRaceTime(gameTime_.ElapsedGameTime.Milliseconds); } } } // Victory state finished = true; foreach (Player p in m_players) { if (!p.GetFinished()) { finished = false; break; } } if (finished) { m_currentExecutionState = ExecutionState.CHANGING; } // Update game objects float turn = 0; if (Keyboard.GetState().IsKeyDown(Keys.Left)) { turn--; } if (Keyboard.GetState().IsKeyDown(Keys.Right)) { turn++; } bool braked = Keyboard.GetState().IsKeyDown(Keys.Down); h_trackHandler.Update(m_players, ref m_rankings); // Update sprites foreach (AnimatedSprite anim in m_animatedSprites) { // If currently animating if (anim.GetCurrentState() == 1) { // Change the frame if (gameTime_.TotalGameTime.TotalMilliseconds - anim.GetLastTime() > anim.GetFrameTime()) { anim.ChangeFrame(gameTime_.TotalGameTime.TotalMilliseconds); } } } foreach (CheckpointContainer cp in h_trackHandler.m_checkpoints) { cp.GetEntity().UpdateSprites(); } //this set the sprite for the rankings, to the players to the corresponding rank for (int i = 0; i < m_rankings.Count; i++) { m_rankingSprites[i].SetTexture(m_players[m_rankings[i] - 1].GetVehicle().m_vehicleBody.GetSprite().GetTexture()); } // Update particles m_particles = GraphicsHandler.UpdatePFX(gameTime_.ElapsedGameTime.TotalMilliseconds); fs_world.Step((float)gameTime_.ElapsedGameTime.TotalMilliseconds * .001f); } }
public void Draw(GraphicsHandler graphics, RectangleF rect) { var outerRadius = Radius.Width; var yscale = Radius.Height / Radius.Width; var center = Center; var origin = GradientOrigin; var scale = 1f; if (wrap != GradientWrapMode.Pad) { // use eto's transformrectangle as it'll make the rect encompass the resulting transformed area var boundRect = transform.Invert().ToEto().TransformRectangle(rect); // find max number of iterations we need to fill the bounding rectangle scale = GradientHelper.GetRadialScale(Center, Radius, GradientOrigin, boundRect); } if (Gradient == null || scale > lastScale) { var stops = GradientHelper.GetGradientStops(StartColor.ToCG(), EndColor.ToCG(), scale, wrap).ToList(); lastScale = scale; Gradient = new CGGradient(CGColorSpace.CreateDeviceRGB(), stops.Select(r => r.Item2).ToArray(), stops.Select(r => (nfloat)r.Item1).ToArray()); } else { scale = lastScale; } var scaledRect = new RectangleF(GradientOrigin - (GradientOrigin - Center + Radius) * scale, GradientOrigin + (Center + Radius - GradientOrigin) * scale); center = scaledRect.Center; outerRadius *= scale; // adjust center based on ellipse scale from gradient origin center.Y = origin.Y - (origin.Y - center.Y) / yscale; // scale to draw elliptical gradient var t = new CGAffineTransform(1, 0f, 0f, yscale, 0, origin.Y - origin.Y * yscale); t.Multiply(transform); graphics.Control.SaveState(); graphics.Control.ConcatCTM(t); graphics.Control.DrawRadialGradient(Gradient, origin.ToNS(), 0, center.ToNS(), outerRadius, CGGradientDrawingOptions.DrawsAfterEndLocation | CGGradientDrawingOptions.DrawsBeforeStartLocation); graphics.Control.RestoreState(); }
public abstract void Apply (object control, GraphicsHandler graphics);
public static DebugGUIHandler Create(string name) { IGameObject gO = Scene.CreateGameObject(name); DebugGUIHandler handler = gO.AddComponent <DebugGUIHandler>(22); IGameObject fpsGO = Scene.CreateGameObject("fps", gO, new Vector2(Scene.MainViewport.Right, Scene.MainViewport.Top)); GUILabel fpsLabel = fpsGO.AddComponent <GUILabel>("fps", new FontFamily("Consolas"), Color.LIME); fpsLabel.Dock = GUIDock.TopRight; fpsLabel.Width = 0.1f; fpsLabel.Height = 0.06f; handler.FpsLabel = fpsLabel; IGameObject upsGO = Scene.CreateGameObject("ups", gO, new Vector2(Scene.MainViewport.Right - fpsLabel.WorldWidth * 1.1f, Scene.MainViewport.Top)); GUILabel upsLabel = upsGO.AddComponent <GUILabel>("ups", new FontFamily("Consolas"), Color.ORANGE); upsLabel.Dock = GUIDock.TopRight; upsLabel.Width = 0.1f; upsLabel.Height = 0.06f; handler.UpsLabel = upsLabel; Timer fpsUpsTimer = gO.AddComponent <Timer>(); fpsUpsTimer.Time = 0.1f; fpsUpsTimer.OnTimerComplete += timer => { fpsLabel.Text = Window.Window.FramesPerSecond + "fps"; upsLabel.Text = Time.UpdatesPerSecond + "ups"; timer.Start(); }; fpsUpsTimer.Start(); handler.Timer = fpsUpsTimer; IGameObject[] logGOs = new IGameObject[handler.LineCount]; GUILabel[] logLabels = new GUILabel[handler.LineCount]; for (int i = 0; i < handler.LineCount; i++) { logGOs[i] = Scene.CreateGameObject($"log_line_{i}", gO, new Vector2(Scene.MainViewport.Left, Scene.MainViewport.Top - i * Scene.MainViewport.Height / (handler.LineCount + 1))); logLabels[i] = logGOs[i].AddComponent <GUILabel>($"", new FontFamily("Consolas"), Color.WHITE); logLabels[i].Width = 2 / 3f; logLabels[i].Height = 2 / (float)(handler.LineCount + 1); } for (int i = 0; i < handler.LineCount; i++) { logLabels[i].Dock = GUIDock.TopLeft; logLabels[i].TextDock = GUIDock.LeftCenter; } handler.Logs = logLabels; IGameObject consoleGO = Scene.CreateGameObject("console", gO, new Vector2(Scene.MainViewport.Left, Scene.MainViewport.Bottom)); GUITextbox consoleTb = consoleGO.AddComponent <GUITextbox>("", new FontFamily("Consolas"), Color.WHITE, GraphicsHandler.CreateDefaultTexture(1, 1, new Color(31, 31, 31, 127))); consoleTb.Width = 2f / 3f; consoleTb.Height = 2f / handler.LineCount; consoleTb.Dock = GUIDock.BottomLeft; consoleTb.MaxTextLength = 40; handler.Console = consoleTb; return(handler); }
public override void Draw(GraphicsHandler graphicsHandler) { base.Draw(graphicsHandler); //drawBounds(graphicsHandler, new Color(0, 0, 255, 100)); }
public static void Draw(this Brush brush, GraphicsHandler graphics, bool stroke, FillMode fillMode, bool clip = true) { ((BrushHandler)brush.Handler).Draw(brush.ControlObject, graphics, stroke, fillMode, clip); }
public abstract void Apply(object control, GraphicsHandler graphics);
public override void Apply(object control, GraphicsHandler graphics) { ((BrushObject)control).Apply(graphics); }
public static void Apply(this Brush brush, GraphicsHandler graphics) => brush.Apply(graphics.Control);
public static void Apply(this Pen pen, GraphicsHandler graphics) => pen.Apply(graphics.Control);
public override void Apply(object control, GraphicsHandler graphics) { graphics.Control.SetSourceColor((Cairo.Color)control); graphics.Control.Fill(); }
private protected Game(IGameUI owner, Control gameArea) { GraphicsHandler = new GraphicsHandler(owner, gameArea); InputHandler = new InputHandler(); SoundHandler = new SoundHandler(); }
public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch) { GraphicsHandler.DrawSprite(_sprite, batch); }
public static void Draw(this Brush brush, GraphicsHandler graphics, RectangleF rect) { ((BrushHandler)brush.Handler).Draw(brush.ControlObject, graphics, rect); }
public MainMenuAnimation(GraphicsHandler graphicsHandler, Action onCompletion) : base(graphicsHandler, 500, onCompletion) { }
public static void Apply(this Pen pen, GraphicsHandler graphics) { ((PenHandler)pen.Handler).Apply(pen, graphics); }
public virtual void DrawImage(GraphicsHandler graphics, float x, float y) { DrawImage(graphics, x, y, Size.Width, Size.Height); }
public void Apply(Pen widget, GraphicsHandler graphics) { ((PenControl)widget.ControlObject).Apply(graphics); }
public virtual void DrawImage(GraphicsHandler graphics, float x, float y, float width, float height) { DrawImage(graphics, new RectangleF(PointF.Empty, Size), new RectangleF(x, y, width, height)); }
public override void Draw(object control, GraphicsHandler graphics, bool stroke, FillMode fillMode, bool clip) { ((BrushObject)control).Draw(graphics, stroke, fillMode, clip); }
public abstract void DrawImage(GraphicsHandler graphics, RectangleF source, RectangleF destination);
public override void Initialize(params object[] parameters) { base.Initialize(); int pIdx = 1; Color bgColor = Color.LIGHT_GRAY; if (parameters.Length >= 1 && parameters[0] is Color bgc) { bgColor = bgc; } Color pbColor = Color.LIME; if (parameters.Length >= 2 && parameters[1] is Color pbc) { pbColor = pbc; } ITexture bgtex; if (parameters.Length >= 3 && parameters[2] is ITexture bgt) { bgtex = bgt; } else { bgtex = GraphicsHandler.CreateDefaultTexture(1, 1, Color.WHITE); } ITexture pbtex; if (parameters.Length >= 4 && parameters[3] is ITexture pbt) { pbtex = pbt; } else { pbtex = GraphicsHandler.CreateDefaultTexture(1, 1, Color.WHITE); } IShader sh; if (parameters.Length >= 5 && parameters[4] is IShader s) { sh = s; } else { sh = GraphicsHandler.CreateDefaultShader(1); } backgroundSprite = GameObject.AddComponent <Sprite>(bgColor, bgtex, sh); barSprite = GameObject.AddComponent <Sprite>(pbColor, pbtex, sh); Value = 0.0f; UpdateMesh(); OnSizeChanged += UpdateMesh; }
public static void Apply(this Brush brush, GraphicsHandler graphics) { ((BrushHandler)brush.Handler).Apply(brush.ControlObject, graphics); }
private Texture2D GetTexture(string texture) => GraphicsHandler.GetGUI(krpg2, "StatusBar/" + texture);
public override void Initialize(object[] parameters) { base.Initialize(); string text = ""; if (parameters.Length >= 1 && parameters[0] is string txt) { text = txt; } FontFamily font = new FontFamily("Consolas"); if (parameters.Length >= 2 && parameters[1] is FontFamily fnt) { font = fnt; } Color color = Color.BLACK; if (parameters.Length >= 3 && parameters[2] is Color c) { color = c; } ITexture tex; if (parameters.Length >= 4 && parameters[3] is ITexture t) { tex = t; } else { tex = GraphicsHandler.CreateDefaultTexture(1, 1, Color.WHITE); } this.sprite = GameObject.AddComponent <Sprite>(Color.WHITE, tex); this.textSprite = GameObject.AddComponent <TextSprite>(text, 16, font, color, (Width, Height)); this.textSprite.Dock = GUIDock.LeftCenter; this.blinkTime = -CURSOR_BLINK_TIME; this.text = text; MaxTextLength = 10; OnSizeChanged += UpdateMesh; InputHandler.AddKeyPressEventHandler(keyChar => { if (!HasFocus) { return; } if (keyChar == '\0' || Text.Length == MaxTextLength) { return; } Text += keyChar; }); InputHandler.AddKeyDownEventHandler((key, modifiers) => { if (!HasFocus) { return; } if (key == Key.Back && Text.Length > 0) { Text = Text.Substring(0, Text.Length - 1); } if (key == Key.Enter) { OnTextApplied?.Invoke(this); } }); }
public static void Finish(this Pen pen, GraphicsHandler graphics) { ((PenHandler)pen.Handler).Finish(pen, graphics); }
public override void Apply (object control, GraphicsHandler graphics) { ((TextureBrushObject)control).Apply (graphics); }
public override void Draw(GraphicsDevice graphicsDevice_) { // Render objects to the screen // ================ // Clear the screen graphicsDevice_.Clear(Color.Beige); // Start rendering graphics GraphicsHandler.StartDrawing(); // Render background GraphicsHandler.DrawSprite(m_grassbackground); GraphicsHandler.DrawSprite(m_background); // Render animated sprites foreach (AnimatedSprite anim_ in m_animatedSprites) { if (anim_.IsVisible()) { GraphicsHandler.DrawAnimatedSprite(anim_); } } // Render particles TEMP foreach (Particle part_ in m_particles) { if (part_.GetLife() > 0) { GraphicsHandler.DrawParticle(part_.GetPosition(), part_.GetColour(), part_.GetLife()); } } h_trackHandler.Draw(); // Render player vehicles foreach (Player p in m_players) { GraphicsHandler.DrawSprite(p.GetVehicle().m_vehicleBody.GetSprite()); //GraphicsHandler.DrawSprite(p.GetCow()); GraphicsHandler.DrawSprite(p.m_controlScheme.m_controlInterfaceSprite); GraphicsHandler.DrawSprite(p.m_controlScheme.m_steeringIndicatorSprite); if (!PlayersReady) { GraphicsHandler.DrawSprite(p.m_ReadyButton.m_sprite); } } for (int i = 0; i < Settings.m_numberOfPlayers; i++) { //GraphicsHandler.DrawSprite(m_rankingSprites[i]); } // RENDER UI // Render ranking text if (m_rankings.Count != 0) { GraphicsHandler.DrawText("1st - Player " + m_rankings[0].ToString(), new Vector2(Settings.m_screenWidth / 2 - 450, Settings.m_screenHeight / 2 - 80), Color.Red, 0); if (m_rankings.Count > 1) { GraphicsHandler.DrawText("2nd - Player " + m_rankings[1].ToString(), new Vector2(Settings.m_screenWidth / 2 - 350, Settings.m_screenHeight / 2 - 80), Color.Red, 0); if (m_rankings.Count > 2) { GraphicsHandler.DrawText("3rd - Player " + m_rankings[2].ToString(), new Vector2(Settings.m_screenWidth / 2 - 250, Settings.m_screenHeight / 2 - 80), Color.Red, 0); if (m_rankings.Count > 3) { GraphicsHandler.DrawText("4th - Player " + m_rankings[3].ToString(), new Vector2(Settings.m_screenWidth / 2 - 150, Settings.m_screenHeight / 2 - 80), Color.Red, 0); } } } } for (int i = 0; i < m_rankingSprites.Count; i++) { GraphicsHandler.DrawSprite(m_rankingSprites[i]); } /*if (m_rankings.Count != 0) { * GraphicsHandler.DrawText(new DebugText("1st - Player " + m_players[0].GetRaceTime(), new Vector2(1000f, 440f))); * if (m_rankings.Count > 1) { * GraphicsHandler.DrawText(new DebugText("2nd - Player " + m_players[1].GetRaceTime(), new Vector2(1000f, 460f))); * if (m_rankings.Count > 2) { * GraphicsHandler.DrawText(new DebugText("3rd - Player " + m_players[2].GetRaceTime(), new Vector2(1000f, 480f))); * if (m_rankings.Count > 3) { * GraphicsHandler.DrawText(new DebugText("4th - Player " + m_players[3].GetRaceTime(), new Vector2(1000f, 500f))); * } * } * } * }*/ foreach (Player p in m_players) { Debug.AddSprite(p.GetVehicle().m_vehicleBody.GetSprite()); foreach (Tyre t in p.GetVehicle().m_vehicleTyres) { Debug.AddSprite(t.GetSprite()); } } foreach (Player p in m_players) { Debug.AddSprite(p.GetVehicle().m_vehicleTyres[0].GetSprite()); Debug.AddSprite(p.GetVehicle().m_vehicleTyres[1].GetSprite()); Debug.AddSprite(p.GetVehicle().m_vehicleTyres[2].GetSprite()); Debug.AddSprite(p.GetVehicle().m_vehicleTyres[3].GetSprite()); } //GraphicsHandler.DrawSprite(bsv.m_vehicleBody.GetSprite());*/ if (!startTimer.timerFinished) { GraphicsHandler.DrawText(((int)(startTimer.timeRemaining / 1000) + 1).ToString(), new Vector2(1000, 50), Color.Red, 3); } if (finished) { GraphicsHandler.DrawText("Player " + m_winner.ToString() + " is the winner", new Vector2(500, 500), Color.Red); } // Stop rendering graphics GraphicsHandler.StopDrawing(); }
public void Apply(GraphicsHandler graphics) { }
public void HandleExpose(object o, Gtk.ExposeEventArgs args) { Gdk.EventExpose ev = args.Event; var h = Handler; var handler = new GraphicsHandler(h.Control, ev.Window);
public override void DrawImage(GraphicsHandler graphics, RectangleF source, RectangleF destination) { CopyTo(bmp, Rectangle.Truncate(source)); bmp.DrawImage(graphics, source, destination); }
public override void Apply(object control, GraphicsHandler graphics) { graphics.Control.SetFillColor((CGColor)control); }
public override void Apply (object control, GraphicsHandler graphics) { graphics.Control.SetFillColor ((CGColor)control); }
public override void Draw(object control, GraphicsHandler graphics, RectangleF rect) { graphics.Control.SetFillColor((CGColor)control); graphics.Control.FillRect(rect.ToNS()); }
public void Apply (GraphicsHandler graphics) { graphics.Control.SetStrokeColor (Color); graphics.Control.SetLineCap (LineCap); graphics.Control.SetLineJoin (LineJoin); graphics.Control.SetLineWidth (Thickness); graphics.Control.SetMiterLimit (MiterLimit); if (cgdashes != null) graphics.Control.SetLineDash (cgoffset, cgdashes); }
private Texture2D GetTexture(string texture) => GraphicsHandler.GetGUI(krpg2, "Inventory/" + texture);
public override void Apply (object control, GraphicsHandler graphics) { graphics.Control.Color = (Cairo.Color)control; graphics.Control.Fill (); }
internal bool Update(TimeSpan elapsedTime, TileCollection tiles, IDictionary <string, GameObject> gameObjects, GraphicsHandler graphicsHandler) { elapsedTimeThisFrame += elapsedTime; if (Finished && !Repeat) { return(false); } if (elapsedTimeThisFrame.TotalMilliseconds > UntilNextFrame) { elapsedTimeThisFrame = new TimeSpan(); CurrentFrame = (CurrentFrame + 1) % FrameCount; if (CurrentFrame == 0) { Finished = true; if (!Repeat) { onCompletion(); return(false); } } NextFrame(tiles, gameObjects); return(true); } else if (CurrentFrame == 0 && !Finished) { NextFrame(tiles, gameObjects); return(true); } return(false); }