Esempio n. 1
0
 public FXAARenderer(GameCoreRenderer renderer, GraphicsDevice gd,
                     ContentManager content, AssetFinder finder)
     : base(renderer, gd, content, finder)
 {
     _fxaaEffect = Content.Load <Effect>("fxaa3");
     _sb         = new SpriteBatch(GraphicsDevice);
 }
Esempio n. 2
0
 public LightRenderer(GameCoreRenderer renderer, GraphicsDevice gd,
                      ContentManager content, AssetFinder finder)
     : base(renderer, gd, content, finder)
 {
     _sb                     = new SpriteBatch(GraphicsDevice);
     _lightRenderer          = Content.Load <Effect>("lightMaskRenderer");
     _lightMaskPreCompositor = Content.Load <Effect>("lightMaskPreCompositor");
 }
Esempio n. 3
0
        public AssetCache(GraphicsDevice gd, AssetLoader loader, GameCoreRenderer renderer)
        {
            _graphics = gd;
            _loader   = loader;
            _renderer = renderer;

            GenerateInternalSpriteSheet();
        }
Esempio n. 4
0
 protected override void LoadContent()
 {
     _sb            = new SpriteBatch(GraphicsDevice);
     _renderer      = new GameCoreRenderer(this, GameSettings.Instance.AssetSearchPaths, new[] { 0 }, new NullLogger());
     _renderer.Game = _game;
     _ui            = new UserInterface(this);
     CreateMap();
     UI_ShowPrimaryMenu();
     base.LoadContent();
 }
Esempio n. 5
0
        public GameWorldRenderer(GameCoreRenderer renderer, GraphicsDevice gd, ContentManager content,
                                 AssetFinder finder)
            : base(renderer, gd, content, finder)
        {
            if (_shadowEffect == null)
            {
                _shadowEffect = Content.Load <Effect>("shadowRenderer");
            }
            if (_drawEffect == null)
            {
                _drawEffect = Content.Load <Effect>("componentRenderer");
            }
            _vertexBuffer = new DynamicVertexBuffer(
                GraphicsDevice, GPUDrawable.VertexDeclaration, 1000, BufferUsage.None);

            _preProcessors = new PreProcessor[] {
                new PreProcessorTypes.AnimationPreProcessor(renderer, finder, this),
                new PreProcessorTypes.GameObjectPreProcessor(renderer, finder, this),
                new PreProcessorTypes.ParticlePreProcessor(renderer, finder, this)
            };

            _spriteBatch = new SpriteBatch(gd);

            //Generate indices
            var indices = new ushort[ushort.MaxValue];

            //6 to 4 ratio
            //0, 1, 2 | 2, 3, 0

            int    arrCounter  = 0;
            ushort vertCounter = 0;

            while (arrCounter < indices.Length - 8)
            {
                indices[arrCounter++] = (ushort)(vertCounter);
                indices[arrCounter++] = (ushort)(vertCounter + 1);
                indices[arrCounter++] = (ushort)(vertCounter + 2);
                indices[arrCounter++] = (ushort)(vertCounter + 2);
                indices[arrCounter++] = (ushort)(vertCounter + 3);
                indices[arrCounter++] = (ushort)(vertCounter);
                vertCounter          += 4;
            }

            _indexBuffer = new IndexBuffer(
                GraphicsDevice, IndexElementSize.SixteenBits, ushort.MaxValue, BufferUsage.WriteOnly);
            _indexBuffer.SetData(indices);
        }
Esempio n. 6
0
        /// <summary>
        /// Put init logic here. Will be called after LoadContent()
        /// </summary>
        private void InitializeGame()
        {
            //Log in to ZSB Servers
            try
            { ZSB.DrmClient.Initialize(GlobalSettings.Instance.StoredAccountInfo); }
            catch
            { ZSB.DrmClient.Initialize(); } //If an error occurs, clear info and restart
            ZSB.DrmClient.OnPersistentStorageChanged +=
                (a, b) => GlobalSettings.Instance.StoredAccountInfo.Value = ZSB.DrmClient.PersistentData;
            //Handle fatal login errors
            if (!ZSB.DrmClient.LoggedIn && !GlobalSettings.Instance.NoLoginMode)
            {
                Logger.Fatal("Not logged in. Panicking at the disco. Did you launch the game executable by accident?");
                Exit();
                return;
            }

            _fx = new BasicEffect(GraphicsDevice);

            //Create the user interface
            _ui = new UserInterface(this);

            //Initialize the input driver from the configuration
            InputDriver = InputDriverBase.GetDriver(GameSettings.Instance.InputDriverName, this);
            if (GameSettings.Instance.InputKeyBindings.Value != null)
            {
                InputDriver.SetKeyBindings(GameSettings.Instance.InputKeyBindings);
            }

            ShowSetupPrompt();
            //Initialize renderers
            GameRenderer = new GameCoreRenderer(this, GameSettings.Instance.AssetSearchPaths, new[] { 0 }, new NLogLogger(Logger.Instance));
            SoundPlayer  = new SoundPlayer();
            //And, finally, Begin the async mod loading
            _modLoader      = AsyncModLoader.Create(GameSettings.Instance);
            _hasInitialized = true;
        }
Esempio n. 7
0
 public AssetLoader(GameCoreRenderer renderer, GraphicsDevice gd, AssetResolver resolver)
 {
     _renderer = renderer;
     _graphics = gd;
     _resolver = resolver;
 }
 public ParticlePreProcessor(GameCoreRenderer renderer, Assets.AssetFinder finder, GameWorldRenderer compositor)
     : base(renderer, finder, compositor)
 {
 }
Esempio n. 9
0
 public AssetResolver(string[] searchPaths, GameCoreRenderer renderer)
 {
     SearchPaths = searchPaths;
     _renderer   = renderer;
 }
 public MapBackgroundRenderer(GameCoreRenderer renderer, GraphicsDevice gd,
                              ContentManager content, AssetFinder finder)
     : base(renderer, gd, content, finder)
 {
 }
Esempio n. 11
0
 public AssetFinder(GameCoreRenderer renderer, AssetCache cache)
 {
     _renderer = renderer;
     Cache     = cache;
 }