void tileDisplay1_OnInitialize(object sender, EventArgs e)
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            string buildError;
            string currentDirectory = FileHelper.GetAssemblyDirectory();

            ContentBuilder builder = new ContentBuilder();

            // create content manager
            ContentManager manager = new ContentManager(tileDisplay1.Services,
                                                        builder.OutputDirectory);

            contentManager = new WinformsContentManager(builder, manager);


            spriteFont = contentManager.LoadContent <SpriteFont>
                             (currentDirectory + "\\Content\\hudFont.spritefont", null,
                             "FontDescriptionProcessor", out buildError, false, false);

            using (Stream stream = File.OpenRead("Content/tile.png"))
            {
                tileTexture = Texture2D.FromStream(GraphicsDevice, stream);
            }

            using (Stream stream = File.OpenRead("Content/DoorStop.png"))
            {
                doorStop = Texture2D.FromStream(GraphicsDevice, stream);
            }

            using (Stream stream1 = File.OpenRead("Content/unPassable.png"))
            {
                unPassable = Texture2D.FromStream(GraphicsDevice, stream1);
            }

            using (Stream stream2 = File.OpenRead("Content/slowDown.png"))
            {
                slowDown = Texture2D.FromStream(GraphicsDevice, stream2);
            }

            using (Stream stream3 = File.OpenRead("Content/PlayerPoint.png"))
            {
                PlayerPoint = Texture2D.FromStream(GraphicsDevice, stream3);
            }

            using (Stream stream4 = File.OpenRead("Content/EnemyPoint.png"))
            {
                EnemyPoint = Texture2D.FromStream(GraphicsDevice, stream4);
            }

            using (Stream stream5 = File.OpenRead("Content/MiscPoint.png"))
            {
                MiscPoint = Texture2D.FromStream(GraphicsDevice, stream5);
            }

            collisionPics.Add("Unpassable", unPassable);
            collisionPics.Add("Platform", slowDown);
            collisionPics.Add("DoorStop", doorStop);

            collisionTiles.Items.Add("Erase");

            foreach (var picName in collisionPics)
            {
                collisionTiles.Items.Add(picName.Key);
            }

            collisionTiles.Items.Add("SpawnDraw");

            point.ReadFile(point.PlayerFile);
            point.ReadFile(point.EnemyFile);
            point.ReadFile(point.MiscFile);

            AssociateBox.Items.Add("Do Nothing");
            AssociateBox.Items.Add("Associate");
            AssociateBox.Items.Add("Unassociate");

            AssociateBox.SelectedIndex = 0;
        }
Exemplo n.º 2
0
        void tileDisplay1_OnInitialize(object sender, EventArgs e)
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            string buildError;
            string currentDirectory = FileHelper.GetAssemblyDirectory();

            ContentBuilder builder = new ContentBuilder();

            // create content manager
            ContentManager manager = new ContentManager(tileDisplay1.Services,
                                                        builder.OutputDirectory);

            contentManager = new WinformsContentManager(builder, manager);


            spriteFont = contentManager.LoadContent <SpriteFont>
                             (currentDirectory + "\\Content\\hudFont.spritefont", null,
                             "FontDescriptionProcessor", out buildError, false, false);

            FontLarge = contentManager.LoadContent <SpriteFont>
                            (currentDirectory + "\\Content\\font_large.spritefont", null,
                            "FontDescriptionProcessor", out buildError, false, false);

            FontSmall = contentManager.LoadContent <SpriteFont>
                            (currentDirectory + "\\Content\\font_small.spritefont", null,
                            "FontDescriptionProcessor", out buildError, false, false);

            FillTexture = new Texture2D(GraphicsDevice, 1, 1);
            FillTexture.SetData <Color>(new Color[] { Color.White });

            using (Stream stream = File.OpenRead("Content/tile.png"))
            {
                tileTexture = Texture2D.FromStream(GraphicsDevice, stream);
            }

            using (Stream stream1 = File.OpenRead("Content/unPassable.png"))
            {
                unPassable = Texture2D.FromStream(GraphicsDevice, stream1);
            }

            using (Stream stream2 = File.OpenRead("Content/Platform.png"))
            {
                platformTile = Texture2D.FromStream(GraphicsDevice, stream2);
            }

            using (Stream stream3 = File.OpenRead("Content/PlayerPoint.png"))
            {
                PlayerPoint = Texture2D.FromStream(GraphicsDevice, stream3);
            }

            using (Stream stream4 = File.OpenRead("Content/EnemyPoint.png"))
            {
                EnemyPoint = Texture2D.FromStream(GraphicsDevice, stream4);
            }

            using (Stream stream5 = File.OpenRead("Content/Normal.png"))
            {
                normalTile = Texture2D.FromStream(GraphicsDevice, stream5);
            }

            using (Stream stream6 = File.OpenRead("Content/MiscPoint.png"))
            {
                MiscPoint = Texture2D.FromStream(GraphicsDevice, stream6);
            }

            using (Stream stream7 = File.OpenRead("Content/SlopeRight.png"))
            {
                RightSlope = Texture2D.FromStream(GraphicsDevice, stream7);
            }

            using (Stream stream8 = File.OpenRead("Content/SlopeLeft.png"))
            {
                LeftSlope = Texture2D.FromStream(GraphicsDevice, stream8);
            }


            collisionPics.Add("Unpassable", unPassable);
            collisionPics.Add("NormalTile", normalTile);
            collisionPics.Add("CameraNode", platformTile);
            collisionPics.Add("Ladder", platformTile);
            collisionPics.Add("Patrol", platformTile);
            collisionPics.Add("RightSlope", RightSlope);
            collisionPics.Add("LeftSlope", LeftSlope);



            collisionTiles.Items.Add("Erase");

            foreach (var picName in collisionPics)
            {
                collisionTiles.Items.Add(picName.Key);
            }

            collisionTiles.Items.Add("SpawnDraw");

            point.ReadFile(point.PlayerFile);
            point.ReadFile(point.EnemyFile);
            point.ReadFile(point.MiscFile);

            AssociateBox.Items.Add("Do Nothing");
            AssociateBox.Items.Add("Associate");
            AssociateBox.Items.Add("Unassociate");

            AssociateBox.SelectedIndex = 0;
        }