Example #1
0
#pragma warning restore 618
        public void TestFixtureSetUp()
        {
            BossManager       = MockRepository.GenerateStub <IBossManager>();
            BulletManager     = MockRepository.GenerateStub <IBulletManager>();
            CollisionManager  = MockRepository.GenerateStub <ICollisionManager>();
            CommandManager    = MockRepository.GenerateStub <ICommandManager>();
            ConfigManager     = MockRepository.GenerateStub <IConfigManager>();
            ContentManager    = MockRepository.GenerateStub <IContentManager>();
            ControlManager    = MockRepository.GenerateStub <IControlManager>();
            DebugManager      = MockRepository.GenerateStub <IDebugManager>();
            DelayManager      = MockRepository.GenerateStub <IDelayManager>();
            DeviceManager     = MockRepository.GenerateStub <IDeviceManager>();
            EnemyManager      = MockRepository.GenerateStub <IEnemyManager>();
            EventManager      = MockRepository.GenerateStub <IEventManager>();
            ExplosionManager  = MockRepository.GenerateStub <IExplosionManager>();
            IconManager       = MockRepository.GenerateStub <IIconManager>();
            ImageManager      = MockRepository.GenerateStub <IImageManager>();
            InputManager      = MockRepository.GenerateStub <IInputManager>();
            LevelManager      = MockRepository.GenerateStub <ILevelManager>();
            MoverManager      = MockRepository.GenerateStub <IMoverManager>();
            RandomManager     = MockRepository.GenerateStub <IRandomManager>();
            RenderManager     = MockRepository.GenerateStub <IRenderManager>();
            ResolutionManager = MockRepository.GenerateStub <IResolutionManager>();
            ScoreManager      = MockRepository.GenerateStub <IScoreManager>();
            ScreenManager     = MockRepository.GenerateStub <IScreenManager>();
            SoundManager      = MockRepository.GenerateStub <ISoundManager>();
            SpriteManager     = MockRepository.GenerateStub <ISpriteManager>();
            StateManager      = MockRepository.GenerateStub <IStateManager>();
            StopwatchManager  = MockRepository.GenerateStub <IStopwatchManager>();
            StorageManager    = MockRepository.GenerateStub <IStorageManager>();
            TextManager       = MockRepository.GenerateStub <ITextManager>();
            ThreadManager     = MockRepository.GenerateStub <IThreadManager>();
            FileManager       = MockRepository.GenerateStub <IFileManager>();
            Logger            = MockRepository.GenerateStub <ILogger>();
        }
Example #2
0
#pragma warning restore 618
        public void TestFixtureTearDown()
        {
            BossManager       = null;
            BulletManager     = null;
            CollisionManager  = null;
            CommandManager    = null;
            ConfigManager     = null;
            ContentManager    = null;
            ControlManager    = null;
            DebugManager      = null;
            DelayManager      = null;
            DeviceManager     = null;
            EnemyManager      = null;
            EventManager      = null;
            ExplosionManager  = null;
            IconManager       = null;
            ImageManager      = null;
            InputManager      = null;
            LevelManager      = null;
            MoverManager      = null;
            RandomManager     = null;
            RenderManager     = null;
            ResolutionManager = null;
            ScoreManager      = null;
            ScreenManager     = null;
            SoundManager      = null;
            SpriteManager     = null;
            StateManager      = null;
            StopwatchManager  = null;
            StorageManager    = null;
            TextManager       = null;
            ThreadManager     = null;
            FileManager       = null;
            Logger            = null;
        }
Example #3
0
        public bool DrawFrame(IRenderManager manager, Device device)
        {
            // If the radius of this sphere is 0 skip drawing it.
            if (this.Radius == 0.0f)
            {
                return(true);
            }

            // Set the primitive type to line strip.
            device.ImmediateContext.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.LineStrip;

            // Set the vertex buffer.
            device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(this.vertexBuffer, 28, 0));

            // Setup the wireframe shader.
            this.shader.DrawFrame(manager, device);

            Vector3 xaxis = new Vector3(this.Radius, 0.0f, 0.0f);
            Vector3 yaxis = new Vector3(0.0f, this.Radius, 0.0f);
            Vector3 zaxis = new Vector3(0.0f, 0.0f, this.Radius);

            DrawRing(device, xaxis, zaxis);
            DrawRing(device, xaxis, yaxis);
            DrawRing(device, yaxis, zaxis);

            return(true);
        }
Example #4
0
        public virtual void CleanupGraphics(IRenderManager manager, Device device)
        {
            // Dispose of all resource.
            if (this.VertexDeclaration != null)
            {
                this.VertexDeclaration.Dispose();
            }

            if (this.VertexSampleStates != null)
            {
                for (int i = 0; i < this.VertexSampleStates.Length; i++)
                {
                    this.VertexSampleStates[i].Dispose();
                }
            }

            if (this.VertexShader != null)
            {
                this.VertexShader.Dispose();
            }

            if (this.PixelShader != null)
            {
                this.PixelShader.Dispose();
            }
        }
Example #5
0
        public OnMiniMap(
            MenuManager menumanager,
            IRenderManager renderer,
            GlobalMiniMap globalminimap)
        {
            MenuManager   = menumanager;
            Render        = renderer;
            GlobalMiniMap = globalminimap;

            if (MenuManager.OnMinimapItem.Value)
            {
                Render.Draw += OnDraw;
            }

            MenuManager.OnMinimapItem.PropertyChanged += OnMiniMapChanged;

            if (Drawing.RenderMode == RenderMode.Dx9)
            {
                TextSize    = 14;
                IconExtra   = new Vector2(12, 23);
                IconSize    = 35;
                TPTextSize  = 12;
                TPTextExtra = new Vector2(8, 10);
            }
            else if (Drawing.RenderMode == RenderMode.Dx11)
            {
                TextSize    = 15;
                IconExtra   = new Vector2(12, 19);
                IconSize    = 21;
                TPTextSize  = 14;
                TPTextExtra = new Vector2(9, 13);
            }
        }
        public bool InitializeGraphics(IRenderManager manager, Device device)
        {
            // Initialize the direct input object.
            this.directInput = new DirectInput();

            // Initialize the keyboard device.
            this.keyboardDevice = new Keyboard(this.directInput);
            this.keyboardDevice.SetCooperativeLevel(this.formHandle, CooperativeLevel.Foreground | CooperativeLevel.NonExclusive);
            this.keyboardDevice.Properties.BufferSize = 128;

            // Initialize the mouse device.
            this.mouseDevice = new Mouse(this.directInput);
            this.mouseDevice.SetCooperativeLevel(this.formHandle, CooperativeLevel.Foreground | CooperativeLevel.NonExclusive);

            // Initialize the xbox game pad.
            this.gamepadDevice = new Controller(UserIndex.One);
            if (this.gamepadDevice.IsConnected == true)
            {
                // Get the initial gamepad state.
                this.gamepadState = this.gamepadDevice.GetState();
            }

            // Successfully initialized.
            return(true);
        }
Example #7
0
        public DrawBlockInfo(IRenderManager renderManager, OrderBlockerMenu menu)
        {
            this.renderManager = renderManager;
            this.menu          = menu;

            menu.ShowInfo.ValueChange += this.ShowInfoOnValueChange;
        }
        public LightingManager(IGameContext gameContext,
                               IGameProperties gameProperties,
                               IMeshManager meshManager,
                               IMaterialManager materialManager,
                               ITextureManager textureManager,
                               IRenderManager renderManager,
                               CameraManager cameraManager,
                               LightStore lightStore,
                               ILightManager lightManager,
                               TimeManager timeManager)
        {
            this.gameContext    = gameContext;
            this.gameProperties = gameProperties;
            this.meshManager    = meshManager;
            this.textureManager = textureManager;
            this.renderManager  = renderManager;
            this.cameraManager  = cameraManager;
            this.lightStore     = lightStore;
            this.lightManager   = lightManager;
            this.timeManager    = timeManager;
            skySphereMesh       = meshManager.CreateMesh(ObjParser.LoadObj("meshes/skysphere.obj").MeshData);
            skyMaterial         = materialManager.CreateMaterial("data/skybox.json");
            noiseTexture        = textureManager.LoadTexture("textures/noise_512.png");

            skyMaterial.SetTexture("cloudsTex", noiseTexture);
        }
Example #9
0
        public virtual bool DrawFrame(IRenderManager manager, Device device)
        {
            // Set the vertex and pixel shaders.
            device.ImmediateContext.VertexShader.Set(this.VertexShader);
            device.ImmediateContext.PixelShader.Set(this.PixelShader);

            // If we have any vertex sampler states set them.
            if (this.VertexSampleStates != null)
            {
                // Loop and set all the shader sampler states.
                for (int i = 0; i < this.VertexSampleStates.Length; i++)
                {
                    device.ImmediateContext.VertexShader.SetSampler(i, this.VertexSampleStates[i]);
                }
            }

            // If we have any pixel shader sampler states set them.
            if (this.PixelSampleStates != null)
            {
                // Loop and set all the shader sampler states.
                for (int i = 0; i < this.PixelSampleStates.Length; i++)
                {
                    device.ImmediateContext.PixelShader.SetSampler(i, this.PixelSampleStates[i]);
                }
            }

            // Set the vertex declaration.
            device.ImmediateContext.InputAssembler.InputLayout = this.VertexDeclaration;

            return(true);
        }
Example #10
0
        public override void Render(IRenderManager renderManager, Entity entity, Renderable position)
        {
            SpriteRenderManager spriteRenderManager = renderManager as SpriteRenderManager;
            if (spriteRenderManager == null)
                throw new ArgumentException("renderManager must be of type SpriteRenderManager");

            Render(spriteRenderManager.SpriteBatch, spriteRenderManager.World, entity, position);
        }
Example #11
0
 public IllusionSplitterConfig(IRenderManager renderer)
 {
     renderer.TextureManager.LoadAbilityFromDota("item_bottle_illusion");
     renderer.TextureManager.LoadAbilityFromDota("item_manta");
     renderer.TextureManager.LoadAbilityFromDota("naga_siren_mirror_image");
     renderer.TextureManager.LoadAbilityFromDota("terrorblade_conjure_image");
     renderer.TextureManager.LoadAbilityFromDota("phantom_lancer_doppelwalk");
 }
Example #12
0
        public override void Render(IRenderManager renderManager, Entity entity, Renderable position)
        {
            DrawRenderManager drawRenderManager = renderManager as DrawRenderManager;
            if (drawRenderManager == null)
                throw new ArgumentException("renderManager must be of type DrawRenderManager");

            Render(drawRenderManager.DrawBatch, drawRenderManager.World, entity, position);
        }
Example #13
0
 protected MenuBase(string name, [CanBeNull] string textureKey, View view, IRenderManager renderer, MenuConfig menuConfig, object instance)
 {
     this.MenuConfig  = menuConfig;
     this.Name        = name;
     this.TextureKey  = textureKey;
     this.View        = view;
     this.Renderer    = renderer;
     this.DataContext = instance;
 }
Example #14
0
        public Renderer(IRenderManager renderManager, IDirectContributionModel renderModel)
        {
            this.renderManager = renderManager;
            this.renderModel = renderModel;

            this.width = renderManager.Width;
            this.height = renderManager.Height;

            taskFactory = new TaskFactory<RenderData>();
        }
Example #15
0
        protected override void OnActivate()
        {
            base.OnActivate();

            this.BatteryAssault = this.Context.AbilityFactory.GetAbility <rattletrap_battery_assault>();
            this.Cogs           = this.Context.AbilityFactory.GetAbility <rattletrap_power_cogs>();
            this.Rocket         = this.Context.AbilityFactory.GetAbility <rattletrap_rocket_flare>();
            this.Ulti           = this.Context.AbilityFactory.GetAbility <rattletrap_hookshot>();
            this.Overclocking   = this.Owner.GetAbilityById(AbilityId.rattletrap_overclocking);

            var factory  = this.Config.Hero.Factory;
            var itemMenu = this.Config.Hero.ItemMenu;

            this.Drawings = factory.Menu("Drawings");
            var drawings = this.Drawings;

            RendererManager = this.Context.Renderer;

            this.InformationDrawings = drawings.Item("Enable Information Drawings", true);
            this.InsecDrawings       = drawings.Item("Draw insec indicator", true);
            this.PosX     = drawings.Item("Drawing X", new Slider(1520, 0, 1800));
            this.PosY     = drawings.Item("Drawing Y", new Slider(920, 0, 1800));
            this.TextSize = drawings.Item("Text size", new Slider(50, 1, 100));

            this.MinimumHookChanceMenu = factory.Item("Minimum Hook Chance",
                                                      new StringList(new[] { "Low", "Medium", "High" }, 1));
            this.RocketPush = factory.Item("Rocket Pusher", false);
            this.RocketPush.Item.Tooltip =
                "Will use rocket on creepwaves to push.";
            this.Insec = factory.Item("Insec controller", new KeyBind(70, KeyBindType.Toggle));
            this.Insec.Item.Tooltip =
                "If enabled, will try to push target with cogs rather than trap them inside of cogs.";
            this.MinimumHookChance = this.MinimumHookChanceMenu.GetEnum <HitChance>();

            this.UrnHeroes = itemMenu.Item("Urn",
                                           new HeroToggler(new Dictionary <string, bool>(), true, false, true));
            this.VesselHeroes = itemMenu.Item("Vessel",
                                              new HeroToggler(new Dictionary <string, bool>(), true, false, true));
            this.NullifierHeroes = itemMenu.Item("Nullifier",
                                                 new HeroToggler(new Dictionary <string, bool>(), true, false, true));
            this.HalberdHeroes = itemMenu.Item("Halberd",
                                               new HeroToggler(new Dictionary <string, bool>(), true, false, true));
            this.OrchidHeroes = itemMenu.Item("Orchid Bloodthorn",
                                              new HeroToggler(new Dictionary <string, bool>(), true, false, true));
            this.BladeMailUsage = itemMenu.Item("Use BladeMail?", true);
            this.LotusUsage     = itemMenu.Item("Use Lotus?", true);


            this.RocketHandler = UpdateManager.Run(this.OnUpdate);
            this.MinimumHookChanceMenu.PropertyChanged += this.MinimumHookChancePropertyChanged;
            // this.RocketPush.PropertyChanged += this.RocketPushPropertyChanged;
            Unit.OnModifierAdded   += this.OnHookAdded;
            Unit.OnModifierRemoved += this.OnHookRemoved;
            RendererManager.Draw   += OnDraw;
        }
Example #16
0
        public override bool InitializeGraphics(IRenderManager manager, Device device)
        {
            // Compile our vertex and pixel shaders.
            ShaderBytecode vertexByteCode = ShaderBytecode.FromFile(System.Windows.Forms.Application.StartupPath + "\\FileFormats\\Geometry\\Shaders\\XfMesh.vs");

            this.VertexShader = new VertexShader(device, vertexByteCode);

            ShaderBytecode pixelByteCode = ShaderBytecode.FromFile(System.Windows.Forms.Application.StartupPath + "\\FileFormats\\Geometry\\Shaders\\XfMesh.ps");

            this.PixelShader = new PixelShader(device, pixelByteCode);

            // Setup the sampler states for the vertex shader.
            SamplerStateDescription samplerDesc = new SamplerStateDescription();

            samplerDesc.AddressU          = TextureAddressMode.Wrap;
            samplerDesc.AddressV          = TextureAddressMode.Wrap;
            samplerDesc.AddressW          = TextureAddressMode.Wrap;
            samplerDesc.BorderColor       = new SharpDX.Mathematics.Interop.RawColor4(0.0f, 0.0f, 0.0f, 0.0f);
            samplerDesc.MaximumLod        = 0;
            samplerDesc.Filter            = Filter.Anisotropic;
            samplerDesc.MipLodBias        = 0;
            samplerDesc.MaximumAnisotropy = 3;
            this.PixelSampleStates        = new SamplerState[] { new SamplerState(device, samplerDesc) };

            // Setup our vertex declaration and bind it to the inputs for the vertex shader.
            this.VertexDeclaration = new InputLayout(device, vertexByteCode.Data, new InputElement[]
            {
                /*
                 *  Id: 0x87a34e22
                 *      Elem 0: Slot=0 Offset=0 Format=R16G16B16A16_SNORM SemanticName=POSITION Index=0
                 *      Elem 1: Slot=0 Offset=8 Format=R8G8B8A8_UINT SemanticName=BLENDINDICES Index=0
                 *      Elem 2: Slot=0 Offset=12 Format=R8G8B8A8_UINT SemanticName=BLENDINDICES Index=1
                 *      Elem 3: Slot=0 Offset=16 Format=R8G8B8A8_UNORM SemanticName=BLENDWEIGHT Index=0
                 *      Elem 4: Slot=0 Offset=20 Format=R8G8B8A8_UNORM SemanticName=BLENDWEIGHT Index=1
                 *      Elem 5: Slot=0 Offset=24 Format=R16G16B16A16_SNORM SemanticName=NORMAL Index=0
                 *      Elem 6: Slot=0 Offset=32 Format=R16G16_SNORM SemanticName=TEXCOORD Index=0
                 *      Elem 7: Slot=1 Offset=0 Format=R16G16B16A16_SNORM SemanticName=TANGENT Index=0
                 *      Elem 8: Slot=1 Offset=8 Format=R16G16_SNORM SemanticName=TEXCOORD Index=1
                 */

                new InputElement("POSITION", 0, Format.R16G16B16A16_SNorm, 0, 0),
                new InputElement("TEXCOORD", 0, Format.R16G16_SNorm, 24, 0),
                new InputElement("BLENDWEIGHT", 0, Format.R8G8B8A8_UNorm, 12, 0),
                new InputElement("BLENDINDICES", 0, Format.R8G8B8A8_SInt, 8, 0),

                new InputElement("NORMAL", 0, Format.R16G16B16A16_SNorm, 16, 0),
                new InputElement("TANGENT", 0, Format.R16G16B16A16_SNorm, 0, 0),
                new InputElement("TEXCOORD", 1, Format.R16G16_SNorm, 8, 0),
                new InputElement("TEXCOORD", 2, Format.R16G16_SNorm, 0, 0),
                new InputElement("TEXCOORD", 3, Format.R16G16_SNorm, 0, 0),
            });

            // Successfully initialized.
            return(true);
        }
        public override bool InitializeGraphics(IRenderManager manager, Device device)
        {
            // Compile our vertex and pixel shaders.
            ShaderBytecode vertexByteCode = ShaderBytecode.FromFile(System.Windows.Forms.Application.StartupPath + "\\FileFormats\\Geometry\\Shaders\\XfMesh.vs");

            this.VertexShader = new VertexShader(device, vertexByteCode);

            ShaderBytecode pixelByteCode = ShaderBytecode.FromFile(System.Windows.Forms.Application.StartupPath + "\\FileFormats\\Geometry\\Shaders\\XfMesh.ps");

            this.PixelShader = new PixelShader(device, pixelByteCode);

            // Setup the sampler states for the vertex shader.
            SamplerStateDescription vertexDesc = new SamplerStateDescription();

            vertexDesc.AddressU           = TextureAddressMode.Wrap;
            vertexDesc.AddressV           = TextureAddressMode.Wrap;
            vertexDesc.AddressW           = TextureAddressMode.Wrap;
            vertexDesc.BorderColor        = new SharpDX.Mathematics.Interop.RawColor4(0.0f, 0.0f, 0.0f, 0.0f);
            vertexDesc.MaximumLod         = 13;
            vertexDesc.Filter             = Filter.MinMagMipPoint;
            vertexDesc.MipLodBias         = 0;
            vertexDesc.MaximumAnisotropy  = 1;
            vertexDesc.ComparisonFunction = Comparison.Never;
            this.VertexSampleStates       = new SamplerState[] { new SamplerState(device, vertexDesc) };

            SamplerStateDescription pixelDesc = new SamplerStateDescription();

            pixelDesc.AddressU          = TextureAddressMode.Wrap;
            pixelDesc.AddressV          = TextureAddressMode.Wrap;
            pixelDesc.AddressW          = TextureAddressMode.Wrap;
            pixelDesc.BorderColor       = new SharpDX.Mathematics.Interop.RawColor4(0.0f, 0.0f, 0.0f, 0.0f);
            pixelDesc.MaximumLod        = 0;
            pixelDesc.Filter            = Filter.Anisotropic;
            pixelDesc.MipLodBias        = 0;
            pixelDesc.MaximumAnisotropy = 3;
            this.PixelSampleStates      = new SamplerState[] { new SamplerState(device, pixelDesc) };

            // Setup our vertex declaration and bind it to the inputs for the vertex shader.
            this.VertexDeclaration = new InputLayout(device, vertexByteCode.Data, new InputElement[]
            {
                // Id: 0x0550228e
                new InputElement("POSITION", 0, Format.R16G16B16A16_SNorm, 0, 0),
                new InputElement("NORMAL", 0, Format.R16G16B16A16_SNorm, 16, 0),
                new InputElement("TANGENT", 0, Format.R16G16B16A16_SNorm, 0, 1),
                new InputElement("TEXCOORD", 0, Format.R16G16_SNorm, 24, 0),
                new InputElement("TEXCOORD", 1, Format.R16G16_SNorm, 8, 1),
                new InputElement("BLENDWEIGHT", 0, Format.R8G8B8A8_UNorm, 12, 0),
                new InputElement("BLENDINDICES", 0, Format.R8G8B8A8_SInt, 8, 0),
                new InputElement("TEXCOORD", 2, Format.R32G32B32A32_Float, 0, 0),
                new InputElement("TEXCOORD", 3, Format.R32G32B32A32_Float, 0, 0),
            });

            // Successfully initialized.
            return(true);
        }
 public void CleanupGraphics(IRenderManager manager, Device device)
 {
     // Cleanup all shaders in the dictionary.
     BuiltInShaderType[] keys = this.Shaders.Keys.ToArray();
     for (int i = 0; i < keys.Length; i++)
     {
         // Dispose of any resources.
         this.Shaders[keys[i]].CleanupGraphics(manager, device);
         this.Shaders.Remove(keys[i]);
     }
 }
Example #19
0
        internal override void SetRenderer(IRenderManager renderer)
        {
            base.SetRenderer(renderer);

            foreach (var texture in this.loadTextures)
            {
                this.Renderer.TextureManager.LoadHeroFromDota(texture);
            }

            EntityManager9.UnitAdded += this.OnUnitAdded;
        }
Example #20
0
        public VisionControl([Import] IServiceContext context)
        {
            hero   = context.Owner;
            render = context.RenderManager;
            myTeam = context.Owner.Team;

            unitTypes = Assembly.GetExecutingAssembly()
                        .GetTypes()
                        .Where(x => x.IsClass && !x.IsAbstract && typeof(BaseUnit).IsAssignableFrom(x))
                        .ToDictionary(x => x, x => x.GetCustomAttribute <UnitAttribute>());
        }
 public GameManager(IContainerProvider containerProvider,
                    IContainerRegistry registry,
                    IGameProperties gameProperties,
                    IRenderManager renderManager)
 {
     this.containerProvider = containerProvider;
     this.registry          = registry;
     this.gameProperties    = gameProperties;
     this.renderManager     = renderManager;
     updateLoop             = new UpdateManager();
 }
Example #22
0
        public Game(DrawScreen screen, string title, IRenderManager render, IControlManager control, IActorManager actorManager)
            : base(screen.Width, screen.Height, GraphicsMode.Default, title, GameWindowFlags.Default, DisplayDevice.Default, 4, 5, GraphicsContextFlags.ForwardCompatible)
        {
            _renderManager  = render ?? throw new ArgumentNullException(nameof(render));
            _controlManager = control ?? throw new ArgumentNullException(nameof(control));
            _actorManager   = actorManager ?? throw new ArgumentNullException(nameof(actorManager));

            UpdateFrame += Update;
            RenderFrame += Render;
            _renderManager.SwapBuffers += SwapBuffers;
        }
Example #23
0
 private Engine()
 {
     _random          = new Random();
     _renderer        = new RenderManager();
     _entityManager   = new EntityManager();
     _entityObservers = (IEntityNotifier)_entityManager;
     _inputManager    = new InputManager();
     _sceneManager    = new SceneManager(_entityManager);
     _gameManager     = new GameManager();
     _audioManager    = new AudioManager();
 }
Example #24
0
        public SnatcherConfig(IRenderManager renderer)
        {
            renderer.TextureManager.LoadAbilityFromDota("item_aegis");
            renderer.TextureManager.LoadAbilityFromDota("item_cheese");
            renderer.TextureManager.LoadAbilityFromDota("item_gem");
            renderer.TextureManager.LoadAbilityFromDota("item_rapier");
            renderer.TextureManager.LoadAbilityFromDota("rune_doubledamage");

            // this.GreedMode = this.factory.Item("Greed Mode", new AbilityToggler(this.greedDictionary));
            this.ToggleHotkey = new HotkeySelector(Key.None, this.ToggleActive, HotkeyFlags.Press);
            this.HoldHotkey   = new HotkeySelector(Key.None, this.HoldActive, HotkeyFlags.Down | HotkeyFlags.Up);
        }
        public void CleanupGraphics(IRenderManager manager, Device device)
        {
            // Release device access.
            this.keyboardDevice.Unacquire();
            this.mouseDevice.Unacquire();

            // Cleanup device objects.
            this.gamepadDevice = null;
            this.mouseDevice.Dispose();
            this.keyboardDevice.Dispose();
            this.directInput.Dispose();
        }
        internal override void SetRenderer(IRenderManager renderer)
        {
            base.SetRenderer(renderer);

            foreach (var texture in this.loadTextures)
            {
                this.Renderer.TextureManager.LoadAbilityFromDota(texture);
            }

            foreach (var texture in this.loadTextures2)
            {
                this.Renderer.TextureManager.LoadAbilityFromDota(texture);
            }
        }
Example #27
0
        // Constructor
        public Engine(IAssetManager assetManager, IInputManager inputManager, IScreenManager screenManager,
                      ITimeManager timeManager, ISceneManager sceneManager, IRenderManager renderManager, IDebugManager debugManager)
        {
            // Managers
            _assetManager  = assetManager as IAssetManagerInternal;
            _inputManager  = inputManager as IInputManagerInternal;
            _screenManager = screenManager as IScreenManagerInternal;
            _timeManager   = timeManager as ITimeManagerInternal;
            _sceneManager  = sceneManager as ISceneManagerInternal;
            _renderManager = renderManager as IRenderManagerInternal;
            _debugManager  = debugManager as IDebugManagerInternal;

            Instance = this;
        }
Example #28
0
        internal override void SetRenderer(IRenderManager renderer)
        {
            base.SetRenderer(renderer);

            foreach (var item in this.MenuItems)
            {
                item.SetRenderer(renderer);
            }

            if (!string.IsNullOrEmpty(this.TextureKey))
            {
                this.LoadTexture();
            }
        }
Example #29
0
        // TODO: Add ClientHooks with multiple events like: Draw, PlayAudio, PressKey, etc.
        public NegumClient(ISideConfiguration config)
        {
            this.PacketHandler = this.ResolveModule <IClientPacketHandler>();
            this.Input         = this.ResolveModule <IInputManager>();
            this.Hooks         = this.ResolveModule <IClientHooks>();
            this.Screen        = this.ResolveModule <IScreenManager>();
            this.Match         = this.ResolveModule <IMatchManager>();
            this.Renderer      = this.ResolveModule <IRenderManager>();

            this.CallerThread       = config.CallerThread;
            this.LocalServerContext = config.ConnectionContext;
            this.RefreshRate        = config.FrameRate;
            this.Engine             = config.Engine;
        }
Example #30
0
        public bool InitializeGraphics(IRenderManager manager, Device device)
        {
            // Compute the bounding box extents.
            SharpDX.BoundingBox box = new SharpDX.BoundingBox(this.BoundMin.ToVector3(), this.BoundMax.ToVector3());

            // Allocate the vertex array.
            this.vertices = new D3DColoredVertex[8];

            // Calculate the half-widths of the box.
            float halfWidth  = box.Width / 2.0f;
            float halfHeight = box.Height / 2.0f;
            float halfDepth  = box.Depth / 2.0f;

            // Build the vertex array from the bounding box info.
            this.vertices[0].Position = new Vector3(box.Center.X - halfWidth, box.Center.Y - halfHeight, box.Center.Z + halfDepth);
            this.vertices[1].Position = new Vector3(box.Center.X + halfWidth, box.Center.Y - halfHeight, box.Center.Z + halfDepth);
            this.vertices[2].Position = new Vector3(box.Center.X + halfWidth, box.Center.Y - halfHeight, box.Center.Z - halfDepth);
            this.vertices[3].Position = new Vector3(box.Center.X - halfWidth, box.Center.Y - halfHeight, box.Center.Z - halfDepth);

            this.vertices[4].Position = new Vector3(box.Center.X - halfWidth, box.Center.Y + halfHeight, box.Center.Z + halfDepth);
            this.vertices[5].Position = new Vector3(box.Center.X + halfWidth, box.Center.Y + halfHeight, box.Center.Z + halfDepth);
            this.vertices[6].Position = new Vector3(box.Center.X + halfWidth, box.Center.Y + halfHeight, box.Center.Z - halfDepth);
            this.vertices[7].Position = new Vector3(box.Center.X - halfWidth, box.Center.Y + halfHeight, box.Center.Z - halfDepth);

            // Setup the vertex buffer using the vertex data stream.
            BufferDescription desc = new BufferDescription();

            desc.BindFlags           = BindFlags.VertexBuffer;
            desc.CpuAccessFlags      = CpuAccessFlags.Read | CpuAccessFlags.Write;
            desc.StructureByteStride = 28;
            desc.Usage        = ResourceUsage.Default;
            this.vertexBuffer = SharpDX.Direct3D11.Buffer.Create <D3DColoredVertex>(device, BindFlags.VertexBuffer, this.vertices);

            // Setup the index buffer using the indice data.
            desc                     = new BufferDescription();
            desc.BindFlags           = BindFlags.IndexBuffer;
            desc.CpuAccessFlags      = CpuAccessFlags.Read | CpuAccessFlags.Write;
            desc.StructureByteStride = 4;
            desc.Usage               = ResourceUsage.Default;
            this.indexBuffer         = SharpDX.Direct3D11.Buffer.Create <int>(device, BindFlags.IndexBuffer, this.BoxIndices);

            // Get the wireframe shader.
            this.shader = manager.GetBuiltInShader(BuiltInShaderType.Wireframe);

            return(true);
        }
Example #31
0
        public bool InitializeGraphics(IRenderManager manager, Device device)
        {
            // Allocate vertex array.
            this.vertices = new D3DColoredVertex[(RingSegments + 1)];

            // Setup the vertex buffer using the vertex data stream.
            BufferDescription desc = new BufferDescription();

            desc.BindFlags           = BindFlags.VertexBuffer;
            desc.CpuAccessFlags      = CpuAccessFlags.Read | CpuAccessFlags.Write;
            desc.StructureByteStride = 28;
            desc.Usage        = ResourceUsage.Default;
            this.vertexBuffer = SharpDX.Direct3D11.Buffer.Create <D3DColoredVertex>(device, BindFlags.VertexBuffer, this.vertices);

            // Get the wireframe shader.
            this.shader = manager.GetBuiltInShader(BuiltInShaderType.Wireframe);

            return(true);
        }
Example #32
0
        public MenuManager9(IInputManager9 inputManager, IRenderManager renderer)
        {
            this.inputManager = inputManager;
            this.renderer     = renderer;

            this.mainMenu = new MainMenu(renderer, inputManager);

            if (SandboxConfig.Config.HotKeys.TryGetValue("Menu", out var menuKey))
            {
                this.menuHoldKey = KeyInterop.KeyFromVirtualKey(menuKey);
            }

            if (SandboxConfig.Config.HotKeys.TryGetValue("MenuToggle", out menuKey))
            {
                this.menuToggleKey = KeyInterop.KeyFromVirtualKey(menuKey);
            }

            inputManager.KeyDown += this.OnKeyDown;
        }
Example #33
0
        public MainMenu(IRenderManager renderer, IInputManager9 inputManager)
            : base("O9K", "O9K.Menu")
        {
            this.Renderer     = renderer;
            this.InputManager = inputManager;
            this.MenuStyle    = new MenuStyle();
            this.Language     = Managers.Menu.Language.GetLanguage();

            this.IsMainMenu = true;
            this.ChildWidth = 175 * Hud.Info.ScreenRatio;

            this.CalculateSize();
            this.LoadResources();

            this.menuSerializer = new MenuSerializer();
            this.Load(this.menuSerializer.Deserialize(this));

            Messenger <RootMenuExpandMessage> .Subscribe(this.RootMenuExpandMessage);
        }
Example #34
0
 public abstract void Render(IRenderManager renderManager, Entity entity, Renderable position);
Example #35
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TopLevel"/> class.
        /// </summary>
        /// <param name="impl">The platform-specific window implementation.</param>
        /// <param name="dependencyResolver">
        /// The dependency resolver to use. If null the default dependency resolver will be used.
        /// </param>
        public TopLevel(ITopLevelImpl impl, IDependencyResolver dependencyResolver)
        {
            dependencyResolver = dependencyResolver ?? Locator.Current;

            IPlatformRenderInterface renderInterface = dependencyResolver.GetService<IPlatformRenderInterface>();

            this.PlatformImpl = impl;
            this.accessKeyHandler = dependencyResolver.GetService<IAccessKeyHandler>();
            this.inputManager = dependencyResolver.GetService<IInputManager>();
            this.keyboardNavigationHandler = dependencyResolver.GetService<IKeyboardNavigationHandler>();
            this.LayoutManager = dependencyResolver.GetService<ILayoutManager>();
            this.renderManager = dependencyResolver.GetService<IRenderManager>();

            if (renderInterface == null)
            {
                throw new InvalidOperationException(
                    "Could not create an interface to the rendering subsystem: maybe no rendering subsystem was initialized?");
            }

            if (this.PlatformImpl == null)
            {
                throw new InvalidOperationException(
                    "Could not create window implementation: maybe no windowing subsystem was initialized?");
            }

            if (this.inputManager == null)
            {
                throw new InvalidOperationException(
                    "Could not create input manager: maybe Application.RegisterServices() wasn't called?");
            }

            if (this.LayoutManager == null)
            {
                throw new InvalidOperationException(
                    "Could not create layout manager: maybe Application.RegisterServices() wasn't called?");
            }

            if (this.renderManager == null)
            {
                throw new InvalidOperationException(
                    "Could not create render manager: maybe Application.RegisterServices() wasn't called?");
            }

            if (this.accessKeyHandler != null)
            {
                this.accessKeyHandler.SetOwner(this);
            }

            if (this.keyboardNavigationHandler != null)
            {
                this.keyboardNavigationHandler.SetOwner(this);
            }

            this.PlatformImpl.SetOwner(this);
            this.PlatformImpl.Activated = this.HandleActivated;
            this.PlatformImpl.Deactivated = this.HandleDeactivated;
            this.PlatformImpl.Closed = this.HandleClosed;
            this.PlatformImpl.Input = this.HandleInput;
            this.PlatformImpl.Paint = this.HandlePaint;
            this.PlatformImpl.Resized = this.HandleResized;

            Size clientSize = this.ClientSize = this.PlatformImpl.ClientSize;

            this.dispatcher = Dispatcher.UIThread;
            this.renderer = renderInterface.CreateRenderer(this.PlatformImpl.Handle, clientSize.Width, clientSize.Height);

            this.LayoutManager.Root = this;
            this.LayoutManager.LayoutNeeded.Subscribe(_ => this.HandleLayoutNeeded());
            this.LayoutManager.LayoutCompleted.Subscribe(_ => this.HandleLayoutCompleted());
            this.renderManager.RenderNeeded.Subscribe(_ => this.HandleRenderNeeded());

            IStyler styler = dependencyResolver.GetService<IStyler>();
            styler.ApplyStyles(this);

            this.GetObservable(ClientSizeProperty).Skip(1).Subscribe(x => this.PlatformImpl.ClientSize = x);
        }