Пример #1
0
        public Game1(String gameFile = null)
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            //graphics.PreferredBackBufferWidth = 2000;
            //graphics.PreferredBackBufferHeight = 1250;
            graphics.PreferredBackBufferWidth = 1200;
            graphics.PreferredBackBufferHeight = 750;

            graphics.ApplyChanges();

            myScreenSize = new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

            if (gameFile != null)
            {
                game = GameData.ReadFromFile(gameFile);
                game.StartMap = game.LastEditedMap;
            }
        }
Пример #2
0
 public EditorState(GameData game, Size renderSize)
 {
     Game = game;
     this.RenderSize = renderSize;
 }
Пример #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            if (game == null)
            {
                game = GameData.ReadFromFile("../../../../../Game1.game");
            }

            map = game.StartMap;

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Texture2D bgSprite = Content.Load<Texture2D>("space");
            background = new Background(bgSprite, (int)myScreenSize.X, (int)myScreenSize.Y);

            // TODO: use this.Content to load your game content here
            // Make the hero
            Texture2D heroImage = Content.Load<Texture2D>("hero");
            Texture2D shadow = Content.Load<Texture2D>("shadow");
            Texture2D[] heroImages = {Content.Load<Texture2D>("hero0"),
                                         Content.Load<Texture2D>("hero1"),
                                         Content.Load<Texture2D>("hero2"),
                                         Content.Load<Texture2D>("hero3")};
            Vector2 center = myScreenSize / 2;
            myAnimatedHero = new AnimatedHero(heroImages, shadow, center, myScreenSize);

            LoadMap(map);

            overlay = new SplashScreen(GraphicsDevice, Content);
        }