当前位置: 首页>>代码示例>>C#>>正文


C# Keyboard类代码示例

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


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


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