예제 #1
0
        public void Place(int x1, int y1, int x2, int y2)
        {
            MicroWorld.Logics.GridHelper.GridCoords(ref x1, ref y1);
            MicroWorld.Logics.GridHelper.GridCoords(ref x2, ref y2);
            if (x2 < x1)
            {
                int t = x2;
                x2 = x1;
                x1 = t;
            }
            if (y2 < y1)
            {
                int t = y1;
                y1 = y2;
                y2 = t;
            }
            Blocker rc = new Blocker(new Vector2(x1, y1), new Vector2(x2, y2));

            rc.Initialize();
            rc.AddComponentToManager();
            rc.OnPlaced();
            rc.fbo = new RenderTarget2D(Shortcuts.renderer.GraphicsDevice, (int)(x2 - x1) * 4, (int)(y2 - y1) * 4);
            (rc.Graphics as Graphics.BlockerGraphics).DrawToFBO(Shortcuts.renderer);
        }
예제 #2
0
 public void Place(int x1, int y1, int x2, int y2)
 {
     MicroWorld.Logics.GridHelper.GridCoords(ref x1, ref y1);
     MicroWorld.Logics.GridHelper.GridCoords(ref x2, ref y2);
     if (x2 < x1)
     {
         int t = x2;
         x2 = x1;
         x1 = t;
     }
     if (y2 < y1)
     {
         int t = y1;
         y1 = y2;
         y2 = t;
     }
     Blocker rc = new Blocker(new Vector2(x1, y1), new Vector2(x2, y2));
     rc.Initialize();
     rc.AddComponentToManager();
     rc.OnPlaced();
     rc.fbo = new RenderTarget2D(Shortcuts.renderer.GraphicsDevice, (int)(x2 - x1) * 4, (int)(y2 - y1) * 4);
     (rc.Graphics as Graphics.BlockerGraphics).DrawToFBO(Shortcuts.renderer);
 }