示例#1
0
 public MenuItem(Game1 game,Color col,Vector2 pos,string txt,Del trig)
 {
     _normalcolour = col;
     _color = _normalcolour;
     displayText = txt;
     _position = pos;
     TriggerMethod = trig;
     textures = game.Services.GetService<Textures>();
 }
示例#2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        /// 
        protected override void Initialize()
        {
            krypton.Initialize();
            _world = new World(new Vector2(0, 0));

            _camera = new Camera(new Viewport(0, 0, (int)Globals.Screensize.X, (int)Globals.Screensize.Y));
            _particleRenderer = new SpriteBatchRenderer { GraphicsDeviceService = graphics };
            _particleRenderer.LoadContent(Content);
            spriteBatch = new SpriteBatch(GraphicsDevice);
            gameTextures = new Textures(this);

            //audio initialise
            audioEngine = new AudioEngine("Content\\Audio\\artefactAudio.xgs");
            waveBank = new WaveBank(audioEngine, "Content\\Audio\\Wave Bank.xwb");
            SoundBanks[0] = new SoundBank(audioEngine, "Content\\Audio\\Sound Bank.xsb");
            SoundBanks[1] = new SoundBank(audioEngine, "Content\\Audio\\AMB.xsb");
            SoundBanks[2] = new SoundBank(audioEngine, "Content\\Audio\\Menu.xsb");

            //_ambcues = new AMBCues();
            AMBCues.LoadContent(SoundBanks[1]);

            //Add services
            Services.AddService(typeof(World), _world);
            Services.AddService(typeof(SpriteBatch), spriteBatch);
            Services.AddService(typeof(GameComponentCollection), Components);
            Services.AddService(typeof(SpriteBatchRenderer), _particleRenderer);
            Services.AddService(typeof(Camera), _camera);
            Services.AddService(typeof(KryptonEngine), krypton);
            Services.AddService(typeof(Textures), gameTextures);
            Services.AddService(typeof(SoundBank[]), SoundBanks);
            //Services.AddService(typeof(AMBCues), _ambcues);

            //Services.AddService(typeof(KeyboardState), _keyboardState);

            SolidsMaker.Initialise(this);

            /*/TESTDOOR!!! HACK!!!
            var door = new DoorVert(this, new Vector2(800-Globals.SmallGridSize.X,600-(Globals.SmallGridSize.Y*10)), 0);
            Components.Add(door);
            //Globals.CurrentRoom = Globals.LevelList[0].Roomlist[0];
            */

            base.Initialize();
        }
示例#3
0
 public FPScounter(Game game)
 {
     textures = game.Services.GetService<Textures>();
 }