当前位置: 首页>>代码示例>>C#>>正文


C# Map.Draw方法代码示例

本文整理汇总了C#中Map.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# Map.Draw方法的具体用法?C# Map.Draw怎么用?C# Map.Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Map的用法示例。


在下文中一共展示了Map.Draw方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CargarMapa

 public void CargarMapa(Map m)
 {
     R_M.Render_List.Clear();
     temMap = m;
     width.Value = m.w;
     height.Value = m.h;
     temMap.Escenario = new Rectangle(0, 0, m.w * trackBar1.Maximum, m.h * trackBar1.Maximum);
     CrearMatriz(m.h, m.w, trackBar1.Value, 1);
     temMap.SortingElements();
     temMap.Draw(new RenderHandler(R_M.AddData));
     temMap.Ele.Reverse();
     pictureBox1.Refresh();
 }
开发者ID:RuVT,项目名称:RPG_Editor_Claustrophobia,代码行数:13,代码来源:MakeMap.cs

示例2: VentanaJuego

        public VentanaJuego()
        {
            InitializeComponent();
            //this.Width = w;
            //this.Height = h;
            //pictureBox1.Width = w ;
            //pictureBox1.Height = h;
            //----------Manager--------------------//
            F_M = new FileManager();
            R_M = new RenderManager();
            S_M = new SceneManager();
            PM = new PhisicManager();

            //--------Delegados-------------------//
            S_H = new SceneHandler(S_M.PlayScene);
            R_H = new RenderHandler(R_M.AddData);
            F_H = new FileHandler(F_M.GetImg);

            //---------Inicializacion------------//
            R_M.AddHandlers(S_H, F_H);
            //mapa1.SetFileManager(F_H);
            mapa1 = F_M.CargarMapa("../../Mapas/mapa3.xml", this.Width, this.Height, 32);
            mapa1.IM.left = Keys.A;
            mapa1.IM.right = Keys.D;
            mapa1.IM.up = Keys.W;
            mapa1.IM.down = Keys.S;
            mapa1.Draw(R_H);
            R_M.Sorting();
            //--------Timer--------------------//
            //Thread mov = new Thread(Caminar);
            //Thread col = new Thread(Colicion);
            //mov.Start();
            timer1.Start();
            //col.Start();
            mapa1.FraccPantalla(pictureBox1.Width, pictureBox1.Height);
            mapa1.CentrarJugador();
            //----------Sonido------------------//
            //mp = new MP3Player();
            //mp.Open(F_M.GetAud_Path("Correr"));
            //mp.Play();

            pictureBox1.Refresh();
        }
开发者ID:RuVT,项目名称:RPG_Editor_Claustrophobia,代码行数:43,代码来源:VentanaJuego.cs

示例3: MakeMap

 //, AddElemento ae)
 public MakeMap(FileHandler fh, List<Elemento> herr, CreateMap cm)
 {
     InitializeComponent();
     //
     Matriz = new List<Elemento>();
     temMap = new Map("", 0, 0, (int)width.Value, (int)height.Value, trackBar1.Maximum);
     S_M = new SceneManager();
     R_M = new RenderManager();
     R_M.AddHandlers(new SceneHandler(S_M.PlayScene), fh);
     F_H = fh;
     temMap.SetFileManager(fh);
     CrearMatriz((int)height.Value,(int)width.Value,trackBar1.Value,1);
     temMap.Draw(new RenderHandler(R_M.AddData));
     R_M.Fondo = Color.White;
     temp = new List<Elemento>();
     Herramienta = herr;
     pm = new PhisicManager();
     C_M = cm;
 }
开发者ID:RuVT,项目名称:RPG_Editor_Claustrophobia,代码行数:20,代码来源:MakeMap.cs

示例4: RenderToMapThenToBitmap

        // Render a description to a map, then to a bitmap for testing purposes. Hardcoded 6 mm box size.
        internal static Bitmap RenderToMapThenToBitmap(SymbolDB symbolDB, DescriptionLine[] description, DescriptionKind kind, int numColumns)
        {
            DescriptionRenderer descriptionRenderer = new DescriptionRenderer(symbolDB);
            descriptionRenderer.Description = description;
            descriptionRenderer.DescriptionKind = kind;
            descriptionRenderer.CellSize = 6.0F;
            descriptionRenderer.Margin = 0.7F;
            descriptionRenderer.NumberOfColumns = numColumns;
            PointF location = new PointF(30, -100);

            SizeF size = descriptionRenderer.Measure();

            Bitmap bm = new Bitmap((int) size.Width * 8, (int) size.Height * 8);
            Graphics g = Graphics.FromImage(bm);
            g.ScaleTransform(bm.Width / size.Width, -bm.Height / size.Height);
            g.TranslateTransform(-location.X, -location.Y);

            g.Clear(Color.White);

            Map map = new Map(new GDIPlus_TextMetrics(), null);
            using (map.Write()) {
                Dictionary<object, SymDef> dict = new Dictionary<object, SymDef>();

                // Create white color and white-out symdef.
                SymColor white = map.AddColorBottom("White", 44, 0, 0, 0, 0, false);
                AreaSymDef whiteArea = new AreaSymDef("White out", "890", white, null);
                whiteArea.ToolboxImage = MapUtil.CreateToolboxIcon(Properties.Resources.WhiteOut_OcadToolbox);
                map.AddSymdef(whiteArea);
                dict[CourseLayout.KeyWhiteOut] = whiteArea;

                SymColor color = map.AddColor("Purple", 11, 0.045F, 0.59F, 0, 0.255F, false);
                descriptionRenderer.RenderToMap(map, color, location, dict);
            }

            InputOutput.WriteFile(TestUtil.GetTestFile("descriptions\\desc_temp.ocd"), map, new MapFileFormat(MapFileFormatKind.OCAD, 8));

            using (map.Read()) {
                RenderOptions renderOpts = new RenderOptions();
                renderOpts.usePatternBitmaps = true;
                renderOpts.minResolution = 0.1F;
                renderOpts.renderTemplates = RenderTemplateOption.MapAndTemplates;
                map.Draw(new GDIPlus_GraphicsTarget(g), new RectangleF(location.X, location.Y - size.Height, size.Width, size.Height), renderOpts, null);
            }

            g.Dispose();

            return bm;
        }
开发者ID:petergolde,项目名称:PurplePen,代码行数:49,代码来源:DescriptionRendererTests.cs

示例5: TestCodeBook

      /*
      public static void TestCodeBook()
      {
         int learningFrames = 40;
         using (BlobDetector detector = new BlobDetector(CvEnum.BlobDetectorType.Simple))
         using (BlobSeq blobs = new BlobSeq())
         using (Capture capture = new Capture("tree.avi"))
         using (BGCodeBookModel<Ycc> bgmodel = new BGCodeBookModel<Ycc>())
         {
            
            #region Set color thresholds values
            //bgmodel.MCvBGCodeBookModel.ModMin0 = bgmodel.MCvBGCodeBookModel.ModMin1 = bgmodel.MCvBGCodeBookModel.ModMin2 = 3;
            //bgmodel.MCvBGCodeBookModel.ModMax0 = bgmodel.MCvBGCodeBookModel.ModMax1 = bgmodel.MCvBGCodeBookModel.ModMax2 = 10;
            //bgmodel.MCvBGCodeBookModel.CbBounds0 = bgmodel.MCvBGCodeBookModel.CbBounds1 = bgmodel.MCvBGCodeBookModel.CbBounds2 = 10;
            #endregion
            

            ImageViewer viewer = new ImageViewer();
            int count = 0;
            EventHandler processFrame = delegate(Object sender, EventArgs e)
            {
               Image<Bgr, Byte> img = capture.RetrieveBgrFrame();
               if (img == null)
               {
                  return;
               }

               viewer.Text = String.Format("Processing {0}th image. {1}", count++, learningFrames > 0 ? "(Learning)" : String.Empty);

               using (Image<Ycc, Byte> ycc = img.Convert<Ycc, Byte>()) //using YCC color space for BGCodeBook
               {
                  if (learningFrames == 0) //training is completed
                     bgmodel.ClearStale(bgmodel.MCvBGCodeBookModel.T / 2, Rectangle.Empty, null);

                  if (learningFrames > 0)
                     bgmodel.Apply(ycc); 
                  else if (learningFrames <= 0)
                  {
                     bgmodel.Diff(ycc, Rectangle.Empty);
                     Image<Gray, Byte> m = bgmodel.ForegroundMask.Clone();
                     blobs.Clear();
                     if (detector.DetectNewBlob(m, blobs, null))
                     {
                        foreach (MCvBlob b in blobs)
                           m.Draw((Rectangle) b, new Gray(100), 2);
                     }
                     viewer.Image = m;
                  }
                  learningFrames--;
                  System.Threading.Thread.Sleep(100);
               }

               img.Dispose();
            };
            capture.ImageGrabbed += processFrame;
            capture.Start();

            viewer.ShowDialog();
         }
      }

      public void TestArrayChangeDimension()
      {
         float[] vec = new float[10];
         for (int i = 0; i < vec.Length; i++)
            vec[i] = (float)i;

         float[,] vec2 = new float[vec.Length, 1];

         GCHandle hdl1 = GCHandle.Alloc(vec, GCHandleType.Pinned);
         GCHandle hdl2 = GCHandle.Alloc(vec2, GCHandleType.Pinned);
         Emgu.Util.Toolbox.memcpy(hdl1.AddrOfPinnedObject(), hdl2.AddrOfPinnedObject(), vec.Length * Marshal.SizeOf(typeof(float)));
         hdl1.Free();
         hdl2.Free();
         //Array.Copy(vec, vec2, vec.Length);

         for (int i = 0; i < vec.Length; i++)
         {
            Assert.AreEqual(vec[i], vec2[i, 0]);
         }
      }*/

      
      private void TestMap()
      {
         PointF center = new PointF(-110032, -110032);
         float width = 10000, height = 12000;


         Map<Gray, Byte> map = new Map<Gray, byte>(new RectangleF(center.X - width/2, center.Y - height/2, width, height), new PointF(100, 100));
         PointF[] pts = new PointF[]
            {
                new PointF( (float)center.X + 3120,(float) center.Y + 2310),
                new PointF((float)center.X -220, (float) center.Y-4120)
            };
         map.DrawPolyline(pts, false, new Gray(255.0), 1);
         Triangle2DF tri = new Triangle2DF(
             new PointF((float)center.X - 1000.0f, (float)center.Y + 200.0f),
             new PointF((float)center.X - 3000.0f, (float)center.Y + 200.0f),
             new PointF((float)center.X - 700f, (float)center.Y + 800.0f));
//.........这里部分代码省略.........
开发者ID:Warren-GH,项目名称:emgucv,代码行数:101,代码来源:Class1.cs

示例6: TestMapDrawRectangle

      public void TestMapDrawRectangle()
      {
         PointF p1 = new PointF(1.1f, 2.2f);
         SizeF p2 = new SizeF(2.2f, 4.4f);
         RectangleF rect = new RectangleF();
         rect.Location = PointF.Empty;
         rect.Size = p2;

         Map<Gray, Byte> map = new Map<Gray, Byte>(new RectangleF(PointF.Empty, new SizeF(4.0f, 8.0f)), new PointF(0.1f, 0.1f), new Gray(255.0));
         map.Draw(rect, new Gray(0.0), 1);
      }
开发者ID:neutmute,项目名称:emgucv,代码行数:11,代码来源:AutoTestImage.cs

示例7: HandleDirection

 private void HandleDirection(Direction direction, Map map, GameWindow window, IGameEngine engine)
 {
     if (map.InTargettingMode)
     {
         Point pointWantToGoTo = PointDirectionUtils.ConvertDirectionToDestinationPoint(map.TargetPoint, direction);
         Point resultPoint = TargetHandlerHelper.MoveSelectionToNewPoint(engine, pointWantToGoTo, direction, m_targetablePoints);
         if (resultPoint != Point.Invalid)
             map.TargetPoint = resultPoint;
         map.Draw();
     }
     else
     {
         throw new InvalidOperationException("TargettingModeKeyboardHandler and Map disagree on current state");
     }
 }
开发者ID:donblas,项目名称:magecrawl,代码行数:15,代码来源:TargettingModeKeyboardHandler.cs

示例8: Begin

        /// <summary>
        /// Begins the adventure
        /// </summary>
        /// <param name="human">human pbject</param>
        /// <param name="map">map object</param>
        public static void Begin(Human human, Map map)
        {
            humanRef = human;

            ConsoleKey key;
            int[] direction;

            // Initializes the map and then draws it
            Console.Clear();
            Console.WriteLine("Generating map...");
            map.Generate();
            map.Draw();

            int cycles = 0;

            do
            {
                Thread.Sleep(25);
                cycles = (cycles + 1) % 15;
                key = KeyInput.Key;

                if (key == ConsoleKey.UpArrow)
                    direction = up;
                else if (key == ConsoleKey.RightArrow)
                    direction = right;
                else if (key == ConsoleKey.LeftArrow)
                    direction = left;
                else if (key == ConsoleKey.DownArrow)
                    direction = down;
                else if (key == ConsoleKey.E && KeyInput.Modifier == ConsoleModifiers.Control)
                {
                    Constants.Edit();
                    map.Draw();
                    continue;
                }
                else
                {
                    if (key == ConsoleKey.M)
                    {
                        if (MastermindRPG.Actions.Action.Execute("Menu").ToString().Equals("Save"))
                            break;
                    }
                    else if (key == ConsoleKey.H)
                        MastermindRPG.Actions.Action.Execute("AdventureHelp");
                    else if (key == ConsoleKey.I)
                    {
                        MastermindRPG.Actions.Action.Execute("Inventory");
                        if (map.Id != human.area)
                        {
                            map = WorldTransition.CreateMap(human.area, human);
                            map.Generate();
                        }
                    }
                    else
                    {
                        if (cycles == 0)
                            map.Tick();
                        continue;
                    }
                    map.Draw();
                    continue;
                }

                if (cycles == 0)
                    map.Tick();

                // Move the player
                try
                {
                    bool? check = map.WalkableTile(human.Position[0] + direction[0], human.Position[1] + direction[1]);
                    if (check == null)
                        map.ChangeRoom(direction);
                    else if (check == true)
                    {
                        human.Move(direction);
                        map.MoveAction();
                    }
                }

                // If the player went out of the bounds of the room,
                // change to the next room
                catch (Exception e)
                {
                    Console.SetBufferSize(Console.LargestWindowWidth, 300);
                    Console.Clear();
                    Console.WriteLine(e.Message);
                    Console.WriteLine(e.StackTrace);
                    Console.ReadKey();
                    map.ChangeRoom(direction);
                }

                // If the map was ever changed, load the new map
                if (map.Id != human.area)
                {
                    map = WorldTransition.CreateMap(human.area, human);
//.........这里部分代码省略.........
开发者ID:Eniripsa96,项目名称:MastermindRPG,代码行数:101,代码来源:Adventure.cs


注:本文中的Map.Draw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。