Example #1
0
        public override void Update (IInputManager inputManager, float deltaTime)
		{
			IsMouseOver = ContainsPoint(inputManager.MousePosition);
			
			if(IsMouseOver)
			{
				if(IsPressed)
				{
					if(!inputManager.IsInputPressed || (_remainingRepeatDelay <= 0 && IsRepeating))
					{
						_remainingRepeatDelay = _repeatDelay;
						Click();
					}

					if(IsRepeating)
						_remainingRepeatDelay -= deltaTime;
				}
				
                IsPressed = inputManager.IsInputPressed;
			}
			else
			{
				IsPressed = false;
				_remainingRepeatDelay = _repeatDelay;
			}		
		}
Example #2
0
        public override void Initialize()
        {
            base.Initialize();

            m_InputManager = Game.Services.GetService(typeof(IInputManager)) as IInputManager;
            updateScreenTitle();
        }
 public override void Initialize()
 {
     m_InputManager = Game.Services.GetService<IInputManager>();
     SetCameraSettings();
     SetCameraState();
     base.Initialize();
 }
Example #4
0
        public Holodeck()
        {
            var gdm = new GraphicsDeviceManager(this);
            gdm.SynchronizeWithVerticalRetrace = false;
            #if XBOX
            gdm.IsFullScreen = true;
            gdm.PreferredBackBufferHeight = 720;
            gdm.PreferredBackBufferWidth = 1280;
            #elif WINDOWS_PHONE
            gdm.IsFullScreen = true;
            gdm.PreferredBackBufferHeight = 800;
            gdm.PreferredBackBufferWidth = 400;
            #endif

            this.IsFixedTimeStep = false;
            TaskManager.IsThreadingEnabled = false;

            _viewManager = new ViewManager(this);
            _inputManager = new InputManager(this);
            _stateManager = new StateManager(this);
            _physics = new PhysicsManager(this);
            this.Components.Add(new PhysicsScene(this, _physics));

            Content.RootDirectory = "Content";
        }
 public CreditsView(CreditsViewModel viewModel, SpriteBatch spriteBatch, ContentManager content, IInputManager input)
 {
     this.viewModel = viewModel;
     this.content = content;
     this.input = input;
     this.spriteBatch = spriteBatch;
 }
Example #6
0
 public TestServices(
     IAssetLoader assetLoader = null,
     IFocusManager focusManager = null,
     IInputManager inputManager = null,
     Func<IKeyboardDevice> keyboardDevice = null,
     ILayoutManager layoutManager = null,
     IPclPlatformWrapper platformWrapper = null,
     IPlatformRenderInterface renderInterface = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler = null,
     Func<Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     AssetLoader = assetLoader;
     FocusManager = focusManager;
     InputManager = inputManager;
     KeyboardDevice = keyboardDevice;
     LayoutManager = layoutManager;
     PlatformWrapper = platformWrapper;
     RenderInterface = renderInterface;
     StandardCursorFactory = standardCursorFactory;
     Styler = styler;
     Theme = theme;
     ThreadingInterface = threadingInterface;
     WindowImpl = windowImpl;
     WindowingPlatform = windowingPlatform;
 }
 public DoodadViewFactory(IInputManager input, IKeyboardInputManager keyInput, Random random, Level level)
 {
     this.input = input;
     this.level = level;
     this.random = random;
     this.keyInput = keyInput;
 }
Example #8
0
 public TestServices With(
     IAssetLoader assetLoader = null,
     IInputManager inputManager = null,
     ILayoutManager layoutManager = null,
     IPclPlatformWrapper platformWrapper = null,
     IPlatformRenderInterface renderInterface = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler = null,
     Func<Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     return new TestServices(
         assetLoader: assetLoader ?? AssetLoader,
         inputManager: inputManager ?? InputManager,
         layoutManager: layoutManager ?? LayoutManager,
         platformWrapper: platformWrapper ?? PlatformWrapper,
         renderInterface: renderInterface ?? RenderInterface,
         standardCursorFactory: standardCursorFactory ?? StandardCursorFactory,
         styler: styler ?? Styler,
         theme: theme ?? Theme,
         threadingInterface: threadingInterface ?? ThreadingInterface,
         windowImpl: windowImpl ?? WindowImpl,
         windowingPlatform: windowingPlatform ?? WindowingPlatform);
 }
Example #9
0
 public GuiSystem(IDrawManager drawManager, IInputManager inputManager, 
     int virtualScreenWidth = 800, int virtualScreenHeight = 480)
 {
     VirtualScreenWidth = virtualScreenWidth;
     VirtualScreenHeight = virtualScreenHeight;
     _drawManager = drawManager;
     _inputManager = inputManager;
 }
Example #10
0
        public FreeLookState(IStateManager stateManager)
            : base(stateManager)
        {
            _camera = (IViewManager)stateManager.Game.Services.GetService(typeof(IViewManager));
            _input = (IInputManager)stateManager.Game.Services.GetService(typeof(IInputManager));

            _input.CaptureMouse = true;
        }
Example #11
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder, IInputManager inputManager)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new FloatParameter("position", "0,0,0")); //
            sequenceBuilder.addParameter(new FloatParameter("speed","1"));

            objectBuilder.registerElement(new Constructor(inputManager), sequenceBuilder.CurrentSequence, typeof(KeyboardPosition3D), "KeyboardPosition3D", null);
        }
Example #12
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder, IInputManager inputManager)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new BoolParameter("invertY", "false")); //
            sequenceBuilder.addParameter(new BoolParameter("invertX", "false")); //
            sequenceBuilder.addParameter(new FloatParameter("scale", "0.001"));

            objectBuilder.registerElement(new Constructor(inputManager), sequenceBuilder.CurrentSequence, typeof(TouchRotation3D), "TouchRotation3D", null);
        }
Example #13
0
        public override void Initialize()
        {
            base.Initialize();

            m_InputManager = Game.Services.GetService<IInputManager>();

            initializeRandomPositions();
            initializeLetters();
            initializeDradles();
        }
Example #14
0
        public TouchRotationCircle3D(IDataReader state, IInputManager inputManager)
            : base(state)
        {
            addInterface(typeof(IOrientation3D));

            m_inputManager = inputManager;
            m_invertY = state.ReadBoolean();
            m_invertX = state.ReadBoolean();
            m_scale = state.ReadSingle();
        }
Example #15
0
 public PlayerMovementSystem(IInputManager inputManager,
     EntityWorld world)
     : base(Aspect.All(typeof(Velocity),
         typeof(Position),
         typeof(PlayerAction),
         typeof(Sprite)))
 {
     _inputManager = inputManager;
     _world = world;
 }
Example #16
0
 public ButtonView(
     IInputManager inputManager, 
     string textureName, 
     Vector2 position)
 {
     this.inputManager = inputManager;
     this.textureName = textureName;
     this.position = position;
     this.scaleTween = TweenFactory.Tween(1, 0.9f, TimeSpan.FromSeconds(.1));
     this.scaleTween.IsPaused = true;
 }
Example #17
0
        public KeyboardPosition3D(IDataReader state, IInputManager inputManager)
            : base(state)
        {
            addInterface(typeof(IPosition3D));

            m_inputManager = inputManager;
            m_position.X = state.ReadSingle();
            m_position.Y = state.ReadSingle();
            m_position.Z = state.ReadSingle();
            m_speed = state.ReadSingle();
        }
Example #18
0
 public override void Initialize()
 {
     m_InputManager = Game.Services.GetService(typeof(IInputManager)) as IInputManager;
     TintColor = Color.White;
     Scales *= new Vector2(0.7f);
     Position = Vector2.Zero;
     base.Initialize();
     m_Tooltip.TextString = m_TooltipMessages[0];
     m_Tooltip.Position = new Vector2(this.Position.X, this.Position.Y + this.Height + 20);
     m_Tooltip.Visible = false;
 }
Example #19
0
 protected TiledGame()
 {
     loader = new ModuleLoader();
     loader.Load();
     this.stateManager = loader.GetStateManager();
     this.spriteDrawer = loader.GetDrawer();
     this.spriteFontDawer = loader.GetFontDrawer();
     this.inputManager = loader.GetInputManager();
     this.virtualScreen = loader.GetVirtualScreen();
     this.camera = loader.GetCamera();
     this.contentLoader = loader.GetContentLoader();
 }
Example #20
0
 public Background(Space game, ContentManager content, IInputManager input)
     : base(game)
 {
     this.content = content;
     DrawOrder = 1;
     input.OnMoveUp += new GameEventHandler(OnMoveUp);
     input.OnMoveDown += new GameEventHandler(OnMoveDown);
     input.OnMoveLeft += new GameEventHandler(OnMoveLeft);
     input.OnMoveRight += new GameEventHandler(OnMoveRight);
     input.OnTiltLeft += new GameEventHandler(OnTiltLeft);
     input.OnTiltRight += new GameEventHandler(OnTiltRight);
 }
Example #21
0
        public override void Update(IInputManager inputManager, float deltaTime)
        {
            if(_firstUpdate)
            {
                inputManager.KeyPressed += HandleKeyPressed;;
                _firstUpdate = false;
            }

            _isShiftDown = inputManager.IsShiftDown;

            base.Update(inputManager, deltaTime);
        }
        public SpaceInvadersGame()
        {
            Content.RootDirectory = "Content";

            r_GraphicsMgr = new GraphicsDeviceManager(this);
            r_InputManager = new InputManager(this);
            r_SoundManager = new SoundManager(this);
            r_FontManager = new FontManager(this, @"Fonts\Arial");
            r_SettingsManager = new SettingsManager(this);
            r_CollisionsManager = new CollisionsManager(this);
            r_ScreensMananger = new ScreensMananger(this);
            r_ScreensMananger.SetCurrentScreen(new WelcomeScreen(this));
        }
 public LevelCompleteView(
     ContentManager content, 
     SpriteBatch spriteBatch, 
     LevelCompleteViewModel viewModel, 
     LevelView levelView, 
     IInputManager input)
 {
     this.content = content;
     this.levelView = levelView;
     this.viewModel = viewModel;
     this.spriteBatch = spriteBatch;
     this.nextLevelButton = new ButtonView(input, "Images/LevelComplete/NextLevelButton", new Vector2(328, 342));
     this.nextLevelButton.Command = this.viewModel.NextLevelCommand;
 }
Example #24
0
        public override void Update(IInputManager inputManager, float deltaTime)
        {
            ListBoxItem hoveredItem = null;

            foreach(var item in Items)
            {
                if(item.ContainsPoint(inputManager.MousePosition))
                    hoveredItem = item;
            }

            HoveredItem = hoveredItem;

            if(inputManager.IsInputPressed && ContainsPoint(inputManager.MousePosition))
                SelectedItem = HoveredItem;
        }
 public GameOverView(
     ContentManager content, 
     GameOverViewModel viewModel,
     SpriteBatch spriteBatch,
     LevelView levelView,
     IInputManager input)
 {
     this.content = content;
     this.viewModel = viewModel;
     this.spriteBatch = spriteBatch;
     this.levelView = levelView;
     this.input = input;
     this.restartLevelButton = new ButtonView(input, "Images/GameOver/RestartLevelButton", new Vector2(328, 342));
     this.restartLevelButton.Command = this.viewModel.NewGameCommand;
 }
        public PlayerControlledTankView(
            PlayerControlledTank tank, 
            IInputManager input, 
            IKeyboardInputManager keyInput, 
            Random random)
            : base(tank, random)
        {
            this.tank = tank;
            this.input = input;

            this.input.MouseDown += this.OnMouseDown;
            this.input.MouseMoved += this.OnMouseMoved;
            this.keyInput = keyInput;
            this.keyInput.KeyDown += this.OnKeyDown;
        }
Example #27
0
 public Player(Game game, ContentManager content, IInputManager input, NetworkClient other)
     : base(game)
 {
     this.DrawOrder = 2;
     this.input = input;
     this.other = other;
     input.OnMoveUp += new GameEventHandler(OnMoveUp);
     input.OnMoveDown += new GameEventHandler(OnMoveDown);
     input.OnMoveLeft += new GameEventHandler(OnMoveLeft);
     input.OnMoveRight += new GameEventHandler(OnMoveRight);
     input.OnTiltLeft += new GameEventHandler(OnTiltLeft);
     input.OnTiltRight += new GameEventHandler(OnTiltRight);
     input.OnMoveFront += new GameEventHandler(OnMoveFront);
     input.OnMoveBack += new GameEventHandler(OnMoveBack);
     input.OnFire += new GameEventHandler(OnFire);
     this.content = content;
 }
Example #28
0
        //Should also take 'useKeyboard' Boolean
        public RacingControls(Racer myRacer, IInputManager inputManager)
        {
            //playerIndex = index;//Player index should be able to be 'any' or 'keyboard' too
            padIndex = PlayerIndex.One;

            setChosenInput(inputManager);

            racer = myRacer;
            tapNo = 0;
            lastTaps = new decimal[4];
            tapWeights = new decimal[4] {1,.3m,.1m,.05m};
            racer.beatQueue.isLevellingDown = false;
            racer.beatQueue.isLevellingUp = false;
            sequenceNumber = 0;
            vibrateNumber = 0;
            //vibrateSequence = true;
        }
Example #29
0
 public TitleView(
     ContentManager content,
     TitleViewModel viewModel,
     SpriteBatch spriteBatch,
     LevelView levelView,
     IInputManager input)
 {
     this.content = content;
     this.viewModel = viewModel;
     this.spriteBatch = spriteBatch;
     this.levelView = levelView;
     this.input = input;
     this.creditsButton = new ButtonView(input, "Images/Title/CreditsButton", new Vector2(388, 273));
     this.creditsButton.Command = this.viewModel.ShowCreditsCommand;
     this.playButton = new ButtonView(input, "Images/Title/PlayButton", new Vector2(406, 344));
     this.playButton.Command = this.viewModel.StartGameCommand;
 }
Example #30
0
        private Color[] userColours = { Color.Red, Color.Blue, Color.Green, Color.Orange, Color.Purple }; // Move this to config?

        #endregion Fields

        #region Constructors

        public BalloonClient(INetworkManager screenManager, IInputManager controller)
        {
            // Initialise Graphics
            graphics = new GraphicsDeviceManager(this);
            if (Configuration.FullScreen)
            {
                // use the current resolution of the screen
                graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
                graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
                graphics.IsFullScreen = true;
            }
            else
            {
                if (Configuration.ScreenWidth > 0)
                {
                    graphics.PreferredBackBufferWidth = Configuration.ScreenWidth;
                }
                if (Configuration.ScreenHeight > 0)
                {
                    graphics.PreferredBackBufferHeight = Configuration.ScreenHeight;
                }
            }
            graphics.PreferMultiSampling = true;
            screenDimensions = new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

            // Create a new content box
            if (Configuration.UseHtmlRendering)
            {
                contentBox = new HTMLContentBox(screenDimensions, graphics);
            }
            else
            {
                contentBox = new ManualContentBox(screenDimensions, graphics);
            }

            // Initialise Input
            this.input = controller;
            input.Initialize(screenDimensions);

            // Initialise Content
            Content.RootDirectory = "Content";

            // Initialise network
            this.NetworkManager = screenManager;
        }
Example #31
0
 public GameManager
 (
     IButtonManager buttonManager,
     ICollisionManager collisionManager,
     IConfigManager configManager,
     IContentManager contentManager,
     IDeviceManager deviceManager,
     IImageManager imageManager,
     IInputManager inputManager,
     IQuestionManager questionManager,
     IRandomManager randomManager,
     IResolutionManager resolutionManager,
     IScoreManager scoreManager,
     IScreenManager screenManager,
     ISoundManager soundManager,
     ISpriteManager spriteManager,
     IStorageManager storageManager,
     ITextManager textManager,
     IThreadManager threadManager,
     IFileManager fileManager,
     ILogger logger
 )
 {
     ButtonManager     = buttonManager;
     CollisionManager  = collisionManager;
     ConfigManager     = configManager;
     ContentManager    = contentManager;
     DeviceManager     = deviceManager;
     ImageManager      = imageManager;
     InputManager      = inputManager;
     QuestionManager   = questionManager;
     RandomManager     = randomManager;
     ResolutionManager = resolutionManager;
     ScoreManager      = scoreManager;
     ScreenManager     = screenManager;
     SoundManager      = soundManager;
     SpriteManager     = spriteManager;
     StorageManager    = storageManager;
     TextManager       = textManager;
     ThreadManager     = threadManager;
     FileManager       = fileManager;
     Logger            = logger;
 }
Example #32
0
 // method to initialise the class
 public void Initialise(IEntityManager pEntityManager, ISceneManager pSceneManager, ICollisionManager pCollisionManager, IAIComponentManager pAiComponentManager, IInputManager pInputManager, ISceneGraph pSceneGraph)
 {
     sceneGraph         = pSceneGraph;
     collisionManager   = pCollisionManager;
     entityManager      = pEntityManager;
     sceneManager       = pSceneManager;
     inputManager       = pInputManager;
     aiComponentManager = pAiComponentManager;
     _platformSpawn     = new List <Vector2>();
     _platformSSpawn    = new List <Vector2>();
     _platformEndLSpawn = new List <Vector2>();
     _platformEndRSpawn = new List <Vector2>();
     _wallSpawn         = new List <Vector2>();
     _hostileSpawn      = new List <Vector2>();
     _sawSpawn          = new List <Vector2>();
     _goldSpawn         = new List <Vector2>();
     // Populate spawn arrays
     LoadLevel();
 }
        protected void Awake()
        {
            _inputManager = GameClient.Get <IInputManager>();

            Init();

            GameClient.Get <ITimerManager>().AddTimer(
                x =>
            {
                _onMouseDownInputIndex =
                    _inputManager.RegisterInputHandler(Enumerators.InputType.MOUSE, 0, OnMouseButtonUpHandler);
                _onRightMouseDownInputIndex = _inputManager.RegisterInputHandler(Enumerators.InputType.MOUSE, 1,
                                                                                 OnRightMouseButtonUpHandler);
                _onEscapeInputIndex = _inputManager.RegisterInputHandler(Enumerators.InputType.KEYBOARD,
                                                                         (int)KeyCode.Escape, null, OnRightMouseButtonUpHandler);
            },
                null,
                0.75f);
        }
Example #34
0
        public DefaultEngine(IRenderableSurface surface, IInputManager inputManager, IContextState context, EngineNotificator notificator)
        {
            Context          = context;
            this.Surface     = surface;
            this.Notificator = notificator;
            InputManager     = inputManager;
            tokensource      = new CancellationTokenSource();
            token            = tokensource.Token;

            WorldTag = new ElementTag("World");
            context.GetEntityManager()
            .CreateEntity(WorldTag)
            .AddComponent(new PerfomanceComponent());

            CameraTag = new ElementTag("Camera");
            context.GetEntityManager()
            .CreateEntity(CameraTag);
            context.GetSynchronizationContext().Synchronize(-1);
        }
Example #35
0
    public static void UnRegisterMessageHandle <T, U>(this IInputManager manager, Dictionary <U, T> handlesDict, Dictionary <U, int> trackedTargets, T handle, params U[] target) where T : Delegate
    {
        Array.ForEach(target, (layer) =>
        {
            if (trackedTargets.ContainsKey(layer) && --trackedTargets[layer] <= 0)
            {
                trackedTargets.Remove(layer);
            }

            if (handlesDict.TryGetValue(layer, out T handleLists))
            {
                handlesDict[layer] = (T)Delegate.Remove(handleLists, handle);
                if (handlesDict[layer] == null)
                {
                    handlesDict.Remove(layer);
                }
            }
        });
    }
Example #36
0
        public Chess()
        {
            Content.RootDirectory = "Content";

            new GraphicsDeviceManager(this);

            m_inputManager = InputManagerFactory.GetInputManager(this);
            Components.Add(m_inputManager);

            m_audioManager = AudioManagerFactory.GetAudioManager(this);
            Components.Add(m_audioManager);

            m_resourceManager = ResourceManagerFactory.GetResourceManager(this);
            Components.Add(m_resourceManager);

            m_graphicsManager = GraphicsManagerFactory.GetGraphicsManager(this);
            Components.Add(m_graphicsManager);

            m_gameStateManager = GameStateManagerFactory.GetGameStateManager(this);
            Components.Add(m_gameStateManager);
        }