示例#1
0
文件: Scene.cs 项目: ezamagni/xebab
 public Scene(Game game, SpriteBatch spriteBatch, Level level, 
     Camera camera/*, ResourceHandler resourceHandler*/)
     : base(game)
 {
     this.spriteBatch = spriteBatch;
     //TODO hack temporaneo con resourcehandler
     contentHandler = new ContentHandler(game.GraphicsDevice,
         spriteBatch, level, camera, new ResourceHandler(new System.Collections.Generic.List<Resource>()));
 }
示例#2
0
文件: Game1.cs 项目: ezamagni/xebab
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Texture2D[,] tiles = new Texture2D[2, 2];
            tiles[0, 0] = Content.Load<Texture2D>("t1");
            tiles[0, 1] = Content.Load<Texture2D>("t2");
            tiles[1, 0] = Content.Load<Texture2D>("t3");
            tiles[1, 1] = Content.Load<Texture2D>("t4");

            level = new Level(tiles);
        }
示例#3
0
        internal ContentHandler(GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, 
            Level level, Camera camera, ResourceHandler resourceHandler)
        {
            SpriteHandler = new SpriteHandler();
            KeyboardHandler = new KeyboardHandler();
            CursorHandler = new CursorHandler();
            //EffectHandler = new EffectHandler();
            ResourceHandler = resourceHandler;

            this.SpriteBatch = spriteBatch;
            this.Level = level;
            this.Camera = camera;
            this.graphicsDevice = graphicsDevice;
        }
示例#4
0
        protected override void LoadContent()
        {
            // Load crosshair
            crosshair = Content.Load<Texture2D>("crosshair");
            crosshairCenter = new Vector2(crosshair.Width / 2, crosshair.Height / 2);

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

            //Initialize level
            Texture2D[,] tiles = new Texture2D[2, 2];
            tiles[0, 0] = Content.Load<Texture2D>("t1");
            tiles[0, 1] = Content.Load<Texture2D>("t2");
            tiles[1, 0] = Content.Load<Texture2D>("t3");
            tiles[1, 1] = Content.Load<Texture2D>("t4");
            level = new Level(tiles);

            //Initialize scene
            camera = new Camera(Vector2.Zero,
                new Size(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
            scene = new Scene(this, spriteBatch, level, camera);
            Components.Add(scene);
        }