• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Keyboard类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Keyboard的典型用法代码示例。如果您正苦于以下问题:C# Keyboard类的具体用法?C# Keyboard怎么用?C# Keyboard使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Keyboard类属于命名空间,在下文中一共展示了Keyboard类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DemoGame

        public DemoGame()
            : base()
        {
            this.Window.Title = "Snowball Demo Game";

            this.graphicsDevice = new GraphicsDevice(this.Window);
            this.Services.AddService(typeof(IGraphicsDevice), this.graphicsDevice);

            this.keyboard = new Keyboard();
            this.Services.AddService(typeof(IKeyboard), this.keyboard);

            this.mouse = new Mouse(this.Window);
            this.Services.AddService(typeof(IMouse), this.mouse);

            this.gamePad = new GamePad(GamePadIndex.One);

            this.soundDevice = new SoundDevice();
            this.Services.AddService(typeof(ISoundDevice), this.soundDevice);

            this.starfield = new Starfield(this.graphicsDevice);

            this.ship = new Ship(this.graphicsDevice, this.keyboard, this.gamePad);

            this.console = new GameConsole(this.Window, this.graphicsDevice);
            this.console.InputEnabled = true;
            this.console.InputColor = Color.Blue;
            this.console.InputReceived += (s, e) => { this.console.WriteLine(e.Text); };
            this.console.IsVisibleChanged += (s, e) => { this.console.WriteLine("Console toggled."); };

            this.contentManager = new ContentManager<DemoGameContent>(this.Services);

            this.RegisterContent();
        }
开发者ID:smack0007,项目名称:Snowball_v1,代码行数:33,代码来源:DemoGame.cs


示例2: CharacterDialog

 public CharacterDialog(string title, bool disableNumbersAndSymbols, bool disableEnter)
     : base(Font.MediumFont, title, Lcd.Width, Lcd.Height-14)
 {
     keyBoard = new Keyboard(this.innerWindow, disableEnter,disableNumbersAndSymbols);
     keyBoard.OnOk += () => this.OnExit();
     keyBoard.OnCancel += () => {okWithEsc = true; OnExit();};
 }
开发者ID:bernhard-hofmann,项目名称:monoev3,代码行数:7,代码来源:CharacterDialog.cs


示例3: LoadContent

        public override void LoadContent()
        {
            //((ScreenWidth / 2) - 400)
            base.LoadContent();
            myNewLevelPosition = (new Vector2(((ScreenWidth / 2) - 300), 0));

            //descriptionBackgroundPosition = (new Vector2 (((ScreenWidth / 2) - 100), ((ScreenHeight / 2) - 100))) ;
            descriptionByTherapistPosition = (new Vector2(((ScreenWidth / 2) - 100), ((ScreenHeight / 2) - 100))) ;
            myDescriptionPosition = (new Vector2(((ScreenWidth / 2) - 300), ((ScreenHeight / 2) - 100)));

            //nameBackgroundPosition = (new Vector2(((ScreenWidth / 2) - 100), ((ScreenHeight / 2) - 40)));
            nameOfTherapistPosition = (new Vector2(((ScreenWidth / 2) - 100), ((ScreenHeight / 2) - 40)));
            myNamePosition = (new Vector2(((ScreenWidth / 2) - 300), ((ScreenHeight / 2) - 40)));

            font = Content.Load<SpriteFont>("font");
            nameOfTherapist = "";
            descriptionByTherapist = "";
            textBackgorund = Content.Load<Texture2D>("GUI/textBackground");
            myNewLevelTitle = Content.Load<Texture2D>("GUI/newLevel");

            btnCancel = MakeButton(0, 0, "GUI/cancel");
            btnCreate = MakeButton(((ScreenWidth) - 120), 0, "GUI/createButton");
            btnHelp = MakeButton(((ScreenWidth) - 55), ScreenHeight - 55, "HELP/helpIcon");
            delDesc = MakeButton(((ScreenWidth / 2) + 301), ((ScreenHeight / 2) - 107), "Gui/miniX");
            delName = MakeButton(((ScreenWidth / 2) + 301), ((ScreenHeight / 2) - 47), "Gui/miniX");

            myName = Content.Load<Texture2D>("GUI/name");
            clearNameButton = MakeButton(((ScreenWidth / 2) - 200), ((ScreenHeight / 2) - 40), "GUI/nothing");

            myDescription = Content.Load<Texture2D>("GUI/description");
            clearDescriptionButton = MakeButton(((ScreenWidth / 2) - 200), ((ScreenHeight / 2) - 100), "GUI/nothingHighlight");

            keyboard = new Keyboard(((ScreenWidth / 2) - 250), ((ScreenHeight) - 240), Content);
            keyboard.LoadContent();
        }
开发者ID:oh-team-machine,项目名称:Target-Tapping,代码行数:35,代码来源:NewLevelScreen.cs


示例4: TextToSpeech

        public TextToSpeech(bool isQwerty)
        {
            InitializeComponent();

            clearTextConfirmation = new ClearTextConfirmation();

            btnCallouts.setFontSize();
            btnMenu.setFontSize();
            btnSpeak.setFontSize();

            initControlsRecursive(this.Controls);
            this.MouseClick += (sender, e) =>
            {
                updateCursor();
                //*TODO Delete temporary code
                getCurrentSentence();
            };

            if (isQwerty)
                alsKeyboard = new QwertyKeyboard();
            else
                alsKeyboard = new LargeButtonKeyboard();

            Controls.Add(alsKeyboard);
            alsKeyboard.Location = new Point(MainMenu.GAP, MainMenu.GAP);
            alsKeyboard.SendToBack();

            alsKeyboard.setClearConfirmation(true);
        }
开发者ID:allisonChilton,项目名称:teamEyePad,代码行数:29,代码来源:TextToSpeech.cs


示例5: Main

        static void Main(string[] args)
        {
            Organizer org = new Organizer();
            Menu menu = new Menu();
            Keyboard key = new Keyboard();
            ConsoleComunicator communicator = new ConsoleComunicator();

            Engine eng = new Engine(key, org, menu, communicator);

            List<Entry> entries = new List<Entry>(){
                new Anniversary("Anniversary event","Does not expire event, hot when 15 are remaining or become 1 day old",DateTime.Now.AddDays(2)),
                new Meeting("Meeting event","Expires on the scheduled date and hour + 2 hours, hot when 1 day is remaining",DateTime.Now.AddMinutes(200)),
                new Memo("Memo","Just a Memo"),
                new ToDo("ToDo","Expires on the scheduled date&time, hot when 2 hours are remaining",DateTime.Now.AddMinutes(100))
            };

            foreach (Entry entry in entries)
            {
                org.Add(entry);
               }

            eng.Run();

            //Entry newE = org.GetCurrent();

            //if (newE.EntryType ==  EntryType.Anniversary)
            //{
            //    Anniversary ani = newE as Anniversary;
            //    Console.WriteLine(ani.DateOfAnniversary);
            //}
        }
开发者ID:BobbyBorisov,项目名称:TelerikAcademy,代码行数:31,代码来源:Program.cs


示例6: MessageKeyPressed

 public void MessageKeyPressed(Keyboard.Key key)
 {
     foreach (Entity iEntity in entities)
     {
         iEntity.MessageKeyPressed(key);
     }
 }
开发者ID:MrPhil,项目名称:LD24,代码行数:7,代码来源:Screen.cs


示例7: Main

        static void Main()
        {
            using (var source = new CancellationTokenSource())
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                var form = new Form1();
                var manager = new EntityManager();
                var keyboard = new Keyboard();
                var systems = new SystemBase[] {
                    new EnemySpawnSystem(manager),
                    new FieldOfPlaySystem(manager),
                    new BulletEnemyCollisionSystem(manager),
                    new KeyboardSystem(manager, form, keyboard),
                    new LifetimeSystem(manager),
                    new MovementSystem(manager),
                    new RenderingSystem(form, manager)
                };

                PlayerTemplate.Create(manager);

                form.KeyDown += (s, e) => keyboard.KeyDown(e.KeyCode);
                form.KeyUp += (s, e) => keyboard.KeyUp(e.KeyCode);
                form.FormClosing += (s, e) => source.Cancel();
                form.Load += (s, e) => Run(systems, source.Token);

                Application.Run(form);
            }
        }
开发者ID:jjvdangelo,项目名称:EStroids,代码行数:30,代码来源:Program.cs


示例8: Shutdown

        public void Shutdown()
        {
            // Release the mouse.
            if (_Mouse != null)
            {
                _Mouse.Unacquire();
                _Mouse.Dispose();
                _Mouse = null;
            }

            // Release the keyboard.
            if (_Keyboard != null)
            {
                _Keyboard.Unacquire();
                _Keyboard.Dispose();
                _Keyboard = null;
            }

            // Release the main interface to direct input.
            if (_DirectInput != null)
            {
                _DirectInput.Dispose();
                _DirectInput = null;
            }
        }
开发者ID:nyx1220,项目名称:sharpdx-examples,代码行数:25,代码来源:Input.cs


示例9: ScreenManager

 public ScreenManager(Game game)
     : base(game)
 {
     menuScreen = new MenuScreen();
     gameScreen = new GameScreen();
     keyboard = new Keyboard();
 }
开发者ID:NaterTots,项目名称:PongClone,代码行数:7,代码来源:ScreenManager.cs


示例10: TranslateKeyCode

 /// <summary>
 /// Translates control key's SFML key code to GWEN's code.
 /// </summary>
 /// <param name="sfKey">SFML key code.</param>
 /// <returns>GWEN key code.</returns>
 private static Key TranslateKeyCode(Keyboard.Key sfKey)
 {
     switch (sfKey)
     {
         case Keyboard.Key.Back: return Key.Backspace;
         case Keyboard.Key.Return: return Key.Return;
         case Keyboard.Key.Escape: return Key.Escape;
         case Keyboard.Key.Tab: return Key.Tab;
         case Keyboard.Key.Space: return Key.Space;
         case Keyboard.Key.Up: return Key.Up;
         case Keyboard.Key.Down: return Key.Down;
         case Keyboard.Key.Left: return Key.Left;
         case Keyboard.Key.Right: return Key.Right;
         case Keyboard.Key.Home: return Key.Home;
         case Keyboard.Key.End: return Key.End;
         case Keyboard.Key.Delete: return Key.Delete;
         case Keyboard.Key.LControl: return Key.Control;
         case Keyboard.Key.LAlt: return Key.Alt;
         case Keyboard.Key.LShift: return Key.Shift;
         case Keyboard.Key.RControl: return Key.Control;
         case Keyboard.Key.RAlt: return Key.Alt;
         case Keyboard.Key.RShift: return Key.Shift;
     }
     return Key.Invalid;
 }
开发者ID:LawlietRyuuzaki,项目名称:gwen-dotnet,代码行数:30,代码来源:SFML.cs


示例11: Init

        public static void Init(TextScreenBase textScreen, Keyboard keyboard)
        {
            if (textScreen != null)
              {
            TextScreen = textScreen;
              }
              if (keyboard == null)
              {
            mDebugger.Send("No keyboard specified!");
            throw new SystemException("No keyboard specified!");
              }
              else
              {
            Keyboard = keyboard;
              }
              mDebugger.Send("Before Core.Global.Init");
              Core.Global.Init();
              mDebugger.Send("Static Devices");
              InitStaticDevices();
              mDebugger.Send("PCI Devices");
              InitPciDevices();
              mDebugger.Send("Done initializing Cosmos.HAL.Global");

              mDebugger.Send("ATA Primary Master");
              InitAta(Ata.ControllerIdEnum.Primary, Ata.BusPositionEnum.Master);

              //TODO Need to change code to detect if ATA controllers are present or not. How to do this? via PCI enum?
              // They do show up in PCI space as well as the fixed space.
              // Or is it always here, and was our compiler stack corruption issue?
              mDebugger.Send("ATA Secondary Master");
              InitAta(Ata.ControllerIdEnum.Secondary, Ata.BusPositionEnum.Master);
              //InitAta(BlockDevice.Ata.ControllerIdEnum.Secondary, BlockDevice.Ata.BusPositionEnum.Slave);
        }
开发者ID:Zino2201,项目名称:Cosmos,代码行数:33,代码来源:Global.cs


示例12: Main

 static void Main(string[] args)
 {
     Keyboard kb1 = new Keyboard("Corsair", "black", "red");
     kb1.RemoveKeys();
     kb1.AddKeys(new Keys("white"));
     Console.WriteLine(kb1.ToString());
 }
开发者ID:aamoJL,项目名称:Olio-ohj,代码行数:7,代码来源:Program.cs


示例13: LoadContent

        public override void LoadContent()
        {
            base.LoadContent();
            searchQueryPosition = (new Vector2(((ScreenWidth / 2) - 275), 120));
            magnifyGlassPosition = (new Vector2(((ScreenWidth / 2) - 300), 120));
            listBackgroundPosition = (new Vector2( ((ScreenWidth / 2) - 300), 200));
            //searchBackground = (new Vector2( ((screenWidth / 2) - 280), 200));

            myLoadLevelTitlePosition = (new Vector2(((ScreenWidth / 2) - 300), 0));
            //myCancelButtonPosition = (new Vector2(0, 0));

            font = Content.Load<SpriteFont>("font");
            searchQuery = "";
            textBackgorund = Content.Load<Texture2D>("GUI/textBackground");
            magnifyGlass = Content.Load<Texture2D>("GUI/magnifyGlass");
            listBackground = Content.Load<Texture2D>("GUI/listBackground");
            myLoadLevelTitle = Content.Load<Texture2D>("GUI/loadGameTitle");

            btnHelp = MakeButton(((ScreenWidth) - 55), ScreenHeight - 55, "HELP/helpIcon");
            btnCancel = MakeButton(0, 0, "GUI/cancel");
            btnOpen = MakeButton(((ScreenWidth) - 120), 0, "GUI/openButton");
            delSearch = MakeButton( ((ScreenWidth / 2) - 19), 113, "Gui/miniX");
            goSearch = MakeButton(  ((ScreenWidth / 2) + 40), 113, "Gui/go");
            clearSearchButton = MakeButton( ((ScreenWidth / 2) - 275), 120, "GUI/nothing2");
            keyboard = new Keyboard(((ScreenWidth / 2) - 250), ((ScreenHeight) - 240), Content);
            keyboard.LoadContent();

            fileList = new List(levelNames.getFileNames(), 600, 15, 25, listBackgroundPosition, listBackground, font, Color.Black, Color.Yellow);
            // Load buttons 'n' stuff, yo!
        }
开发者ID:oh-team-machine,项目名称:Target-Tapping,代码行数:30,代码来源:LoadLevelScreen.cs


示例14: Machine

		public Machine(byte[] appleIIe, byte[] diskIIRom)
		{
			Events = new MachineEvents();

			Cpu = new Cpu(this);
			Memory = new Memory(this, appleIIe);
			Keyboard = new Keyboard(this);
			GamePort = new GamePort(this);
			Cassette = new Cassette(this);
			Speaker = new Speaker(this);
			Video = new Video(this);
			NoSlotClock = new NoSlotClock(this);

			var emptySlot = new PeripheralCard(this);
			Slot1 = emptySlot;
			Slot2 = emptySlot;
			Slot3 = emptySlot;
			Slot4 = emptySlot;
			Slot5 = emptySlot;
			Slot6 = new DiskIIController(this, diskIIRom);
			Slot7 = emptySlot;

			Slots = new List<PeripheralCard> { null, Slot1, Slot2, Slot3, Slot4, Slot5, Slot6, Slot7 };
			Components = new List<MachineComponent> { Cpu, Memory, Keyboard, GamePort, Cassette, Speaker, Video, NoSlotClock, Slot1, Slot2, Slot3, Slot4, Slot5, Slot6, Slot7 };

			BootDiskII = Slots.OfType<DiskIIController>().Last();
		}
开发者ID:CadeLaRen,项目名称:BizHawk,代码行数:27,代码来源:Machine.cs


示例15: InputCommands

 public InputCommands(Keyboard keyboard, Mouse mouse, Touch touch, GamePad gamePad)
 {
     this.keyboard = keyboard;
     this.mouse = mouse;
     this.touch = touch;
     this.gamePad = gamePad;
 }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:7,代码来源:InputCommands.cs


示例16: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            mKeyboard = new Keyboard(this, Resource.Xml.keyboard2);
            mTargetView = (EditText)FindViewById(Resource.Id.target);

            mKeyboardView = (CustomKeyboardView)FindViewById(Resource.Id.keyboard_view);
            mKeyboardView.Keyboard = mKeyboard;

            mTargetView.Touch += (sender, e) => {
                Log.Info("onTouch", "true");
                ShowKeyboardWithAnimation();
                e.Handled = true;
            };

            mKeyboardView.Key += (sender, e) => {
                long eventTime = JavaSystem.CurrentTimeMillis();
                KeyEvent ev = new KeyEvent(eventTime, eventTime, KeyEventActions.Down, e.PrimaryCode, 0, 0, 0, 0, KeyEventFlags.SoftKeyboard | KeyEventFlags.KeepTouchMode);

                this.DispatchKeyEvent(ev);
            };
        }
开发者ID:Vaikesh,项目名称:CustomKeyboard,代码行数:26,代码来源:Activity1.cs


示例17: TestMethod1

 public void TestMethod1()
 {
     ComputerSystem mediator = new ComputerSystem();
     Computer computer = new Computer(mediator);
     Keyboard keyboard = new Keyboard(mediator);
     Screen screen = new Screen(mediator);
 }
开发者ID:Kalle-kula,项目名称:Patterns,代码行数:7,代码来源:UnitTest1.cs


示例18: CalculateNavigationPath

        /// <summary>
        /// Uses the input string to the constructor to create a navigation sequence through the keyboard
        /// </summary>
        private void CalculateNavigationPath()
        {
            this.navigationPath = String.Empty;

            Position startPosition = new Position(0, 0);
            Position currentPosition = startPosition;

            Keyboard keyBoard = new Keyboard();
            foreach (char a in searchCommand)
            {
                Key selectedKey = keyBoard.GetSelectedKey(a.ToString());
                //Handle Space character
                if (selectedKey.Value == " ")
                {
                    this.navigationPath += "S,";
                }
                else
                {
                    Position goToPosition = selectedKey.KeyPosition;
                    SetKeySequence(currentPosition, goToPosition);
                    this.navigationPath += "#,";
                    currentPosition = goToPosition;
                }
            }

            //Clean up hanging comma
            if (this.navigationPath.Length > 0)
                this.navigationPath = this.navigationPath.TrimEnd(',');
        }
开发者ID:smfriend,项目名称:OnScreenKeyboard,代码行数:32,代码来源:Navigator.cs


示例19: isKeyPressed

 protected bool isKeyPressed(Keyboard.Key key)
 {
     if (Keyboard.IsKeyPressed(key))
         return true;
     else
         return false;
 }
开发者ID:dolorismachina,项目名称:GCL,代码行数:7,代码来源:Screen.cs


示例20: Chip8Emulator

		public Chip8Emulator(Timers timers, Screen screen, Keyboard keyboard, Sound sound) {
			_cpu = new Cpu();
			_memory = new Memory();
			_timers = timers;
			_screen = screen;
			_keyboard = keyboard;
			_sound = sound;
		}
开发者ID:Q-Smith,项目名称:.NET-Chip-8,代码行数:8,代码来源:Chip8Emulator.cs



注:本文中的Keyboard类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# KeyboardState类代码示例发布时间:2022-05-24
下一篇:
C# KeyValuePair类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap