예제 #1
0
 public void SetUp()
 {
     stubKeyboard = MockRepository.GenerateStub<IKeyboard>();
     stubMouse = MockRepository.GenerateStub<IMouse>();
     stubKeyMapping = MockRepository.GenerateStub<IKeyMapping>();
     gameInput = new GameInput(stubKeyMapping, stubKeyboard, stubMouse);
 }
예제 #2
0
파일: Screen.cs 프로젝트: jeffbernard/fcbrd
        /// <summary>
        /// Creates a new screen
        /// </summary>
        public Screen(int width, int height, int fps)
        {
            Fps = Config.Get("Fps", fps);
            base.Width = Config.Get("ScreenWidth", width);
            base.Height = Config.Get("ScreenHeight", height);
            Trace.Info("new Screen(Fps = {0}, Width = {1}, Height = {2})", Fps, Width, Height);

            _dirty = true;
            _clipping = new Rect(0, 0, Width, Height);
            _backBuffer = new DrawingImage(_buffer = new DrawingGroup());
            _keyMapping = Module.Get<IKeyMapping>();

            (_window = new Window()
            {
                WindowStyle = WindowStyle.None,
                ResizeMode = ResizeMode.NoResize,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                Content = this,
                SizeToContent = SizeToContent.WidthAndHeight,
            }).Show();
            _window.KeyDown += _window_KeyDown;
            _window.KeyUp += _window_KeyUp;

            (_refreshTimer = new Timer(FrameTime)).Update += OnRenderCallback;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="exp"></param>
        /// <returns></returns>
        public IKeySetMapping <T> ForKey(Expression <Func <T, string> > exp)
        {
            var func = exp.Compile();
            var name = GetName(exp);

            _key = new KeyMappingExpression <T> {
                KeyAccessor = func,
                KeyName     = name
            };

            CassandraConfiguration.FireTypeChangedEvent(typeof(T));
            return((IKeySetMapping <T>)_key);
        }
예제 #4
0
 public GameInput(IKeyMapping keyMapping, IKeyboard keyboard, IMouse mouse)
 {
     this.KeyMapping = keyMapping;
     this.Keyboard = keyboard;
     this.Mouse = mouse;
 }