コード例 #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
ファイル: ContentHandler.cs プロジェクト: ezamagni/xebab
        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
ファイル: GameEditor.cs プロジェクト: ezamagni/xebab
        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);
        }