Beispiel #1
0
        public override void Initialize()
        {
            // create our content manager
            content = new ContentManager(IService, "Content");

            IGraphicsDeviceService graphicsDeviceService = (IGraphicsDeviceService)IService.GetService(typeof(IGraphicsDeviceService));
            GraphicsDevice graphicsDevice = graphicsDeviceService.GraphicsDevice;

            // create our spritebatch
            spriteBatch = new SpriteBatch(graphicsDevice);

            // get the game console
            console = (IGameConsole)IService.GetService(typeof(IGameConsole));

            // get the audio manager
            audioManager = (IAudioManager)IService.GetService(typeof(IAudioManager));            

            // setup camera
            camera = new Camera(graphicsDevice.Viewport);
            camera.Limits = WorldUnitsToPixels(new RectangleF(-WorldSize / 2, -WorldSize / 2, WorldSize, WorldSize));
            camera.LookAt(Vector2.Zero);

            graphicsDevice.DeviceReset += GraphicsDeviceReset;

            base.Initialize();
        }
Beispiel #2
0
        public override void Initialize()
        {
            // get our graphics device
            graphicsDevice = Game.GraphicsDevice;

            // create our content manager
            content = new ContentManager(Game.Services, Game.Content.RootDirectory);

            // create our spritebatch
            spriteBatch = new SpriteBatch(graphicsDevice);

            // get the game console
            console = (IGameConsole)Game.Services.GetService(typeof(IGameConsole));

            // setup camera
            camera = new Camera(graphicsDevice.Viewport);
            camera.Limits = WorldUnitsToPixels(new RectangleF(-WorldSize / 2, -WorldSize / 2, WorldSize, WorldSize));
            camera.LookAt(Vector2.Zero);

            graphicsDevice.DeviceReset += GraphicsDeviceReset;
            ServerLink.MessageReceivedEvent += HandleReceivedMessage;

            base.Initialize();
        }