/// <summary> /// starts the graphics renderer /// </summary> /// <param name="graphics">Target graphics</param> public void StartGraphics(Graphics graphics) { drawHandle = graphics; graphicsEngine = this; graphicsEngine.GraphicsInit(); }
public frmMaler() { InitializeComponent(); engine = GraphicsEngine.GetInstance(); engine.WorkingBitmapChanged += WorkingBitmapChanged_Event; engine.StableBitmapChanged += StableBitmapChanged_Event; }
static void Main(string[] args) { Player john = new Player("John Rambo"); john.AddScore(123); Console.WriteLine(john); Console.WriteLine(john.ToJson()); Apple apple = new Apple(23); Console.WriteLine(apple); Console.WriteLine(apple.ToJson()); List <IJsonRepresentable> jsonObjects = new List <IJsonRepresentable>(); jsonObjects.Add(john); jsonObjects.Add(apple); Console.WriteLine("Polymorphism at work"); foreach (var item in jsonObjects) { Console.WriteLine(item.ToJson()); } Console.WriteLine("\n\n GRAPHICS \n\n"); GraphicsEngine engine = new GraphicsEngine(); engine.Draw(apple); engine.Draw(john); }
private void OnClick(int x, int y, System.Windows.Forms.MouseButtons button) { if (button == System.Windows.Forms.MouseButtons.Left) { Point p = GraphicsEngine.TranslateToGrid(x, y); GridObject go = _grid[p]; if (go == null) { if (InputHandler.InputType != null) { go = GridObject.InstantiateObject(InputHandler.InputType, p.X, p.Y, 1, 1, InputHandler.SelectedRotation); if (go != null) { _grid.AddObject(go); } } } else { IClickableObject clicakble = go as IClickableObject; if (clicakble == null) { return; } clicakble.OnClick(button); } } }
//打开地图 private void button4_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); Console.WriteLine("url is " + AppDomain.CurrentDomain.BaseDirectory); string rootPath = AppDomain.CurrentDomain.BaseDirectory; rootPath = rootPath.Substring(0, rootPath.LastIndexOf(@"\")); rootPath = rootPath.Substring(0, rootPath.LastIndexOf(@"\")); rootPath = rootPath.Substring(0, rootPath.LastIndexOf(@"\")); rootPath = rootPath.Substring(0, rootPath.LastIndexOf(@"\")); rootPath = rootPath.Substring(0, rootPath.LastIndexOf(@"\")); rootPath = rootPath + @"\MapData"; dlg.InitialDirectory = rootPath; dlg.DefaultExt = ".json"; dlg.Filter = "Text documents (.json)|*.json"; Nullable <bool> result = dlg.ShowDialog(); if (result == true) { string filename = dlg.FileName; MapData data = new MapData(filename); board = new Board(50, 50, HEX_SIDE, HexOrientation.Flat); board.setMapData(data); engine = new GraphicsEngine(board); ((SpecialCanvas)canvas).Engine = engine; } }
private void startGame() { const int POSX = 15; const int POSY = 37; this.graphicsEngine = new GraphicsEngine(board, 20, 20); }
public virtual void Draw(GraphicsEngine GFX) { foreach (INode child in Children) { child.Draw(GFX); } }
public BodyEngine AttchBodyEngineToObject(GameObject gb, GameObject viewer, GraphicsEngine ge, Projector proj, RenderEngine re, FaceEngine fe, List <Vector2> axis, bool iscurve) { BodyEngine be = gb.AddComponent <BodyEngine>() as BodyEngine; be.CreateBodyEngine(viewer, ge, proj, re, fe, axis, iscurve); return(be); }
public static void LoadStatics(GameEngine game) { Game = game; Input = game.InputManager; Audio = game.AudioEngine; Scenes = game.SceneManager; Resources = game.ResourceManager; Graphics = game.GraphicsEngine; }
public override void Draw(GraphicsEngine gfx) { gfx.Circle(new Color(0, 0, 1.0f), AbsolutePosition, 2); gfx.Circle(new Color(1, 1, 0.0f), AbsolutePosition + AbsoluteSize, 2); gfx.Circle(new Color(0, 1, 0.0f), AbsolutePosition + (AnchorPoint * AbsoluteSize), 2); //gfx.Text($"abs pos{this.AbsolutePosition} size{this.AbsoluteSize}", AbsolutePosition); //gfx.Text($"{this.Children.Count} children", AbsolutePosition + new Vector2(0, 12)); base.Draw(gfx); }
public FaceEngineMulti(GraphicsEngine engine, Projector projector, RenderEngine renderEngine, List <FaceEngine> fe_list) { m_engine = engine; m_FEs = fe_list; m_projector = projector; m_renderEngine = renderEngine; // Assume all cuboid }
public BodyEngine AttchHandleEngineToObject(GameObject gb, GameObject viewer, GraphicsEngine ge, Projector proj, RenderEngine re, FaceEngine fe, BodyEngine be, Image <Gray, byte> img, List <Vector2> axis, bool iscurve) { BodyEngine he = gb.AddComponent <BodyEngine>() as BodyEngine; bool isHandle = true; he.CreateHandleEngine(viewer, ge, proj, re, fe, be, axis, img, iscurve, isHandle); return(he); }
public void createNewMap(string name, int width, int height) { board = new Board(50, 50, HEX_SIDE, HexOrientation.Flat); engine = new GraphicsEngine(board); MapData data = new MapData(name, width, height); board.setMapData(data); ((SpecialCanvas)canvas).Engine = engine; }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (hexModel == null) { hexModel = new Model(); } board = new Board(50, 50, HEX_SIDE, HexOrientation.Flat); engine = new GraphicsEngine(board); ((SpecialCanvas)canvas).Engine = engine; }
static void panel_MouseMove(object sender, MouseEventArgs e) { if (_ghostObject == null) { return; } lock (_ghostObject) { _ghostObject.X = GraphicsEngine.TranslateToGrid(e.X); _ghostObject.Y = GraphicsEngine.TranslateToGrid(e.Y); } }
private void InitializeVulkan(object sender, EventArgs eventArgs) { Loaded -= InitializeVulkan; m_luxGraphicEngine = new GraphicsEngine(); m_luxGraphicEngine.Run(UserControl.Handle, true, Title); UserControl.ClientSizeChanged += OnSizeChanged; Console.WriteLine("Now Starting Main Loop"); m_renderingThread = new Thread(MainLoop); m_renderingThread.Start(); }
private static void PrintClicks(int x, int y, System.Windows.Forms.MouseButtons button) { System.Drawing.Point p = GraphicsEngine.TranslateToGrid(x, y); Log(String.Format("Click event: X: {0}, Y: {1}, Button: {2}, Grid: {3}/{4}", x, y, button, p.X, p.Y)); if (engine != null && engine.Grid != null) { GridObject go = engine.Grid[p]; if (go != null) { Log("Clicked on object:", go); } } }
protected override void Initialize() { base.Initialize(); GFX = new GraphicsEngine(this) { ContentManager = Content, GraphicsDevice = GraphicsDevice, GraphicsDeviceManager = GraphicsDeviceManager, SpriteBatch = new SpriteBatch(GraphicsDevice) }; GFX.Initialize(); }
private void Form_Closing(object sender, FormClosingEventArgs e) { if (graphicsEngine != null) { graphicsEngine = null; } if (board != null) { board = null; } Application.Exit(); }
public void PaintMovingObject(Graphics g, MovingObject mo) { Train train = mo as Train; if (train == null) { return; } Point p = GraphicsEngine.TranslateToView(mo.X, mo.Y); Rectangle rect = new Rectangle(p.X - (GlobalVars.GRIDSIZE / 2), p.Y - (TrainWidth / 2), GlobalVars.GRIDSIZE / 2, TrainWidth); RotateRectangle(g, rect, train.Rotate, p); g.FillRectangle(tempLinePen, p.X - 2, p.Y - 2, 5, 5); }
/// <summary> /// Attempt to add an object to the grid /// </summary> /// <param name="go">The object to add to the grid</param> /// <returns>True if successfully added, otherwise false</returns> public bool AddObject(GridObject go) { Point p = new Point(go.X, go.Y); if (!CanObjectBeAdded(p, go.Width, go.Height)) { return(false); } for (int x = 0; x < go.Width; x++) { for (int y = 0; y < go.Height; y++) { int newX = go.X + x, newY = go.Y + y; _gridObjects[newX, newY] = go; GraphicsEngine.UpdateGrid(newX, newY); } } RegisterObject(go); return(true); }
/// <summary> /// Register a bitmap to a type of an object. /// </summary> /// <param name="type">The type of the object</param> /// <param name="map">The bitmap to register.</param> /// <param name="width">Optional width in grid squares, defaults to 1</param> /// <param name="height">Optional height in grid squares, defaults to 1</param> public void RegisterTypeRenderer(Type type, Bitmap map, int width = 1, int height = 1) { if (map.Width * height != map.Height * width) { throw new ArgumentException("The supplied bitmap is not a square, or not in the given dimennsions"); } if (renderMaps.ContainsKey(type)) { Bitmap oldMap = renderMaps[type]; oldMap.Dispose(); renderMaps.Remove(type); } if (map.Width != GraphicsEngine.TranslateToView(width)) { Bitmap newBitmap = new Bitmap(map, new Size(GraphicsEngine.TranslateToView(width), GraphicsEngine.TranslateToView(height))); map.Dispose(); //Dispose the original, we no longer need it map = newBitmap; } renderMaps.Add(type, map); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here //Load our Bloomfilter! _bloomFilter = new BloomFilter(); _graphicsEngine = new GraphicsEngine(Content, _graphics.GraphicsDevice); _gameEngine = new RunningGameEngine(); _board = new Board(_screenWidth, _screenHeight); _hiveClient = new HiveGameClient(_address, _port); SetWindowSize(); _bloomFilter.BloomPreset = BloomFilter.BloomPresets.SuperWide; _board.AddTile(new BlankTile { Location = new Hex(0, 0, 0) }); }
public void CaptureMeshMask() { m_renderEngine.isRenderingGizmos = false; int w = m_Img.width; int h = m_Img.height; Texture2D meshMask = new Texture2D(w, h, TextureFormat.RGB24, false); RenderTexture rt = new RenderTexture((int)canvasPlane2D.width, (int)canvasPlane2D.height, 1); m_meshCaptor.pixelRect = canvasPlane2D; m_meshCaptor.targetTexture = rt; m_meshCaptor.Render(); RenderTexture.active = rt; meshMask.ReadPixels(new Rect((canvasPlane2D.width - w) / 2, 0, w, h), 0, 0); //meshMask.Apply(); m_meshCaptor.targetTexture = null; RenderTexture.active = null; UnityEngine.Object.Destroy(rt); GraphicsEngine.SaveImg(meshMask, m_ImgName + ".png"); m_renderEngine.isRenderingGizmos = true; }
public override void Draw(GraphicsEngine GFX) { string DisplayedText = ""; if (Text != null) { DisplayedText = Text; } if (TextWrap) { DisplayedText = WrapText(Font, Text, AbsoluteSize.X); } Vector2 textDim = Font.MeasureString(DisplayedText); Vector2 TextOutputPosition = AbsolutePosition; // Text Alignment if (XAlignment == TextXAlignment.Center) { TextOutputPosition += new Vector2((AbsoluteSize.X / 2) - (textDim.X / 2), 0); } if (XAlignment == TextXAlignment.Right) { TextOutputPosition += new Vector2(AbsoluteSize.X - textDim.X, 0); } if (YAlignment == TextYAlignment.Center) { TextOutputPosition += new Vector2(0, (AbsoluteSize.Y / 2) - (textDim.Y / 2)); } if (YAlignment == TextYAlignment.Bottom) { TextOutputPosition += new Vector2(0, AbsoluteSize.Y - textDim.Y); } TextOutputPosition.Floor(); GFX.Text(Font, DisplayedText, TextOutputPosition, TextColor); base.Draw(GFX); }
public void RenderGridObjectBackground(Graphics g, GridObject go, Point p) { Type type = go.GetType(); if (renderMaps.ContainsKey(type)) { g.DrawImageUnscaled(renderMaps[type], p); } else { Point point = new Point(); for (int x = 0; x < go.Width; x++) { point.X = GraphicsEngine.TranslateToView(go.X + x); for (int y = 0; y < go.Height; y++) { point.Y = GraphicsEngine.TranslateToView(go.Y + y); g.DrawImageUnscaled(_defaultTexture, point); } } } }
void LoadImageAndCircle() { IsTopGeometryLoaded = false; string realPhoto_path = EditorUtility.OpenFilePanel("Load Image", "", "jpg"); if (realPhoto_path.Length != 0) { //-------------------------------------------------------------------- // Data Prepare -- Background Image Texture2D CanvasMaskRawImg = new Texture2D(4, 4); if (File.Exists(realPhoto_path)) { m_MaskRawImg = new Image <Rgb, byte>(realPhoto_path); CanvasMaskRawImg = ResizeImgWithHeight(m_MaskRawImg, canvasPlane2D.height); m_MaskRawImg = m_MaskRawImg.Resize(CanvasMaskRawImg.width, CanvasMaskRawImg.height, Inter.Linear); // Background Image backimg.sprite = Sprite.Create(CanvasMaskRawImg, new Rect(0, 0, CanvasMaskRawImg.width, CanvasMaskRawImg.height), Vector2.zero); backimg.rectTransform.sizeDelta = new Vector2(CanvasMaskRawImg.width, CanvasMaskRawImg.height); IExtension.SetTransparency(backimg, 0.3f); //m_engine.m_faceEngine.img = m_MaskRawImg.Convert<Gray, byte>(); //m_engine.m_faceEngine.imgPath = maskRawImg_path; IsTopGeometryLoaded = false; } // Updata Path string folderPath = Path.GetDirectoryName(realPhoto_path); string fileName = Path.GetFileName(realPhoto_path); m_engine.m_Img = CanvasMaskRawImg; // Load Mesh Text m_engine.LoadMesh(realPhoto_path.Substring(0, realPhoto_path.Length - 4) + ".obj"); // Save Img GraphicsEngine.SaveImg(CanvasMaskRawImg, fileName); m_engine.Invoke_CaptureMeshMask(); } }
static extern bool PeekMessage(out GraphicsEngine.Core.Message msg, IntPtr hWnd, uint messageFilterMin, uint messageFilterMax, uint flags);
public void GenNewComponent() { Random r = new Random(); var a = GraphicsEngine.camera.VisibleRectangle; int type = r.Next(3); //0 = component, 1,2 = wire if (type == 0) //component { int ci = r.Next(0, GUIEngine.s_componentSelector.components.Count); GUIEngine.s_componentSelector.components[ci].avalable = 1; var c = GUIEngine.s_componentSelector.components[ci].GetNewInstance() as Components.Component; if (c == null || c is Components.Cursor || c is Components.Wire || c is Components.Properties.IDragDropPlacable || c is Components.Properties.ICore) { return; } var rots = c.Graphics.GetPossibleRotations(); if (rots != null && rots.Length > 0) { int rot = r.Next(0, rots.Length); c.ComponentRotation = rots[rot]; } int x = r.Next(a.X - 100, a.X + a.Width + 100); int y = r.Next(a.Y - 100, a.Y + a.Height + 100); if (!GraphicsEngine.CanDrawGhostComponent(x - 16, y - 16, (int)c.Graphics.GetSize().X + 32, (int)c.Graphics.GetSize().Y + 32)) { return; } c.Graphics.Position = new Vector2(x, y); //components.Add(c); c.Initialize(); c.InitAddChildComponents(); c.Tag = 0; Components.ComponentsManager.Add(c); } else//wire { if (Components.ComponentsManager.Components.Count == 0) { return; } var c1 = Components.ComponentsManager.GetComponent(r.Next(0, Components.ComponentsManager.Components.Count)); var c2 = Components.ComponentsManager.GetComponent(r.Next(0, Components.ComponentsManager.Components.Count)); if (c1 == null || c2 == null) { return; } var cj1 = c1.getJoints(); var cj2 = c2.getJoints(); if (cj1 == null || cj2 == null || cj1.Length == 0 || cj2.Length == 0) { return; } var j1 = Components.ComponentsManager.GetComponent(cj1[r.Next(cj1.Length)]); var j2 = Components.ComponentsManager.GetComponent(cj2[r.Next(cj2.Length)]); if (j1 == null || j2 == null || !(j1 is Components.Joint) || !(j2 is Components.Joint) || !(j1 as Components.Joint).Graphics.Visible || !(j2 as Components.Joint).Graphics.Visible) { return; } Components.Wire w = new Components.Wire(j1 as Components.Joint, j2 as Components.Joint); w.Initialize(); w.InitAddChildComponents(); w.Tag = 0; Components.ComponentsManager.Add(w); } ticksSinceLastComponentAdd = 0; }
public override void Draw(Renderer renderer) { if (Main.curState.StartsWith("GAME")) { //Grid #region Grid MicroWorld.Graphics.GUI.GridDraw.DrawGrid(); #endregion //AoE-s #region AoE-s renderer.End(); renderer.BeginUnscaled(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, DepthStencilState.None, RasterizerState.CullNone); LightAOE.Draw(renderer); MagnetAOE.Draw(renderer); renderer.End(); renderer.Begin(); #endregion //Components #region Components Components.ComponentsManager.Draw(); Components.ComponentsManager.PostDraw(); #endregion //SelectedGhost #region SelectedGhost if (MicroWorld.Graphics.GUI.GUIEngine.s_componentSelector.SelectedComponent.Text != "Cursor" && InputEngine.curMouse.X > GUI.Scene.ComponentSelector.CSTile.SIZE_X && !Logics.GameInputHandler.isLine)// && //!MicroWorld.Graphics.GUI.GUIEngine.s_componentSelector.SelectedComponent.IsComponentOfType<Components.Properties.IDragDropPlacable>()) { int x = (int)((InputEngine.curMouse.X) / Settings.GameScale - Settings.GameOffset.X); int y = (int)((InputEngine.curMouse.Y) / Settings.GameScale - Settings.GameOffset.Y); Components.Component.Rotation rot = Logics.GameInputHandler.GhostRotation; Vector2 size = MicroWorld.Graphics.GUI.GUIEngine.s_componentSelector.SelectedComponentGraphics.GetSizeRotated(rot); Logics.GridHelper.GridCoords(ref x, ref y); Logics.PlacableAreasManager.MakePlacable(ref x, ref y, (int)size.X, (int)size.Y); Logics.GridHelper.GridCoords(ref x, ref y); Vector2 so = MicroWorld.Graphics.GUI.GUIEngine.s_componentSelector.SelectedComponentGraphics.GetCenter(rot); int nx = x - (int)so.X, ny = y - (int)so.Y; bool b = GraphicsEngine.CanDrawGhostComponent(ref nx, ref ny, (int)size.X, (int)size.Y); Color c = Main.renderer.Overlay; if (!b) { renderer.Overlay = Color.Red * 0.5f; } if (InputEngine.curMouse.LeftButton == ButtonState.Pressed && GUI.GUIEngine.s_componentSelector.SelectedComponent.Avalable == 0) { Main.renderer.Overlay = Main.Ticks % 40 < 20 ? Color.Red : c; } MicroWorld.Graphics.GUI.GUIEngine.s_componentSelector.SelectedComponentGraphics.DrawGhost( nx, ny, Main.renderer, Logics.GameInputHandler.GhostRotation); Main.renderer.Overlay = c; #region Dotted Lines MicroWorld.Graphics.GUI.GUIEngine.s_componentSelector.SelectedComponentGraphics.DrawBorder( nx, ny, Logics.GameInputHandler.GhostRotation, renderer); #endregion } #endregion //RemovingComponentsVisuals #region RemovingComponentsVisuals MicroWorld.Graphics.Effects.Effects.DrawRemovingVisuals(); #endregion //MouseOverComponent #region MouseOverComponent if (Logics.GameInputHandler.MouseOverComponent != null) { Logics.GameInputHandler.MouseOverComponent.Graphics.DrawBorder(renderer); } #endregion //wire #region Wire if (Logics.GameInputHandler.isLine) { lock (Logics.GameInputHandler.pendingWirePath) Components.Graphics.WireGraphics.DrawWire(Logics.GameInputHandler.pendingWirePath); #region Dotted Lines if (Logics.GameInputHandler.pendingWirePath != null && Logics.GameInputHandler.pendingWirePath.Count > 0) { //optimization List <Vector2> l = new List <Vector2>(); Vector2 v1 = new Vector2(), v2 = new Vector2(); lock (Logics.GameInputHandler.pendingWirePath) { l.Add(new Vector2(Logics.GameInputHandler.pendingWirePath[0].X, Logics.GameInputHandler.pendingWirePath[0].Y)); for (int i = 1; i < Logics.GameInputHandler.pendingWirePath.Count - 1; i++) { v1 = new Vector2(Logics.GameInputHandler.pendingWirePath[i].X - Logics.GameInputHandler.pendingWirePath[i - 1].X, Logics.GameInputHandler.pendingWirePath[i].Y - Logics.GameInputHandler.pendingWirePath[i - 1].Y); v2 = new Vector2(Logics.GameInputHandler.pendingWirePath[i + 1].X - Logics.GameInputHandler.pendingWirePath[i].X, Logics.GameInputHandler.pendingWirePath[i + 1].Y - Logics.GameInputHandler.pendingWirePath[i].Y); if (((v1.X != 0) != (v2.X != 0)) || (v1.Y != 0) != (v2.Y != 0)) { l.Add(new Vector2(Logics.GameInputHandler.pendingWirePath[i].X, Logics.GameInputHandler.pendingWirePath[i].Y)); } } l.Add(new Vector2(Logics.GameInputHandler.pendingWirePath[Logics.GameInputHandler.pendingWirePath.Count - 1].X, Logics.GameInputHandler.pendingWirePath[Logics.GameInputHandler.pendingWirePath.Count - 1].Y)); } //draw Components.Graphics.WireGraphics.DrawBorder(l, renderer); } #endregion } #endregion //dnd #region DnD if (Logics.GameInputHandler.isComponentDnD) { int x = (int)((InputEngine.curMouse.X) / Settings.GameScale - Settings.GameOffset.X); int y = (int)((InputEngine.curMouse.Y) / Settings.GameScale - Settings.GameOffset.Y); Logics.PlacableAreasManager.MakePlacable(ref x, ref y); MicroWorld.Logics.GridHelper.GridCoords(ref x, ref y); Logics.GameInputHandler.DnDComponent.DrawGhost(Main.renderer, (int)Logics.GameInputHandler.pendingWireP1.X, (int)Logics.GameInputHandler.pendingWireP1.Y, x, y); #region Dotted Lines (Logics.GameInputHandler.DnDComponent as Components.Component).Graphics.DrawBorder(renderer); #endregion } #endregion //Pending placable area #region PlacableAreas if (PlacableAreasCreator.create) { int x = InputEngine.curMouse.X, y = InputEngine.curMouse.Y; Utilities.Tools.ScreenToGameCoords(ref x, ref y); Logics.GridHelper.GridCoords(ref x, ref y); RenderHelper.DrawDottedLinesToBorders(new Point[] { new Point(x, y) }, Color.White, renderer, true); } if (Logics.GameInputHandler.isPlacableAreaPending) { int x = (int)Logics.GameInputHandler.pendingWireP1.X; int y = (int)Logics.GameInputHandler.pendingWireP1.Y; int w = InputEngine.curMouse.X; int h = InputEngine.curMouse.Y; Utilities.Tools.ScreenToGameCoords(ref w, ref h); Logics.GridHelper.GridCoords(ref w, ref h); if (w < x) { int t = w; w = x; x = t; } if (h < y) { int t = h; h = y; y = t; } w -= x; h -= y; Main.renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)x, (int)y, (int)w, (int)h), Color.Yellow * 0.4f); RenderHelper.DrawDottedLinesToBorders( new Point[] { new Point(x, y), new Point(x + w, y), new Point(x, y + h), new Point(x + w, y + h) }, Color.White, renderer, true); } else { //highlight deleting area if (Graphics.GUI.Scene.PlacableAreasCreator.delete) { Rectangle r; for (int i = 0; i < Logics.PlacableAreasManager.areas.Count; i++) { r = Logics.PlacableAreasManager.areas[i]; int x = InputEngine.curMouse.X; int y = InputEngine.curMouse.Y; Utilities.Tools.ScreenToGameCoords(ref x, ref y); if (r.Contains(x, y)) { Main.renderer.Draw(GraphicsEngine.pixel, new Rectangle(r.X, r.Y, r.Width, r.Height), Color.Yellow * 0.4f); RenderHelper.DrawDottedLinesToBorders( new Point[] { new Point(r.X, r.Y), new Point(r.X + r.Width, r.Y), new Point(r.X, r.Y + r.Height), new Point(r.X + r.Width, r.Y + r.Height) }, Color.White, renderer, true); break; } } } } #endregion //Particles #region Particles ParticleManager.Draw(); #endregion } }
private void GameBox_Paint(object sender, PaintEventArgs e) { GraphicsEngine.DrawFood(e, _food, _settings); GraphicsEngine.DrawSnake(e, _snake, _settings); }