本文整理汇总了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();
}
示例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();};
}
示例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();
}
示例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);
}
示例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);
//}
}
示例6: MessageKeyPressed
public void MessageKeyPressed(Keyboard.Key key)
{
foreach (Entity iEntity in entities)
{
iEntity.MessageKeyPressed(key);
}
}
示例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);
}
}
示例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;
}
}
示例9: ScreenManager
public ScreenManager(Game game)
: base(game)
{
menuScreen = new MenuScreen();
gameScreen = new GameScreen();
keyboard = new Keyboard();
}
示例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;
}
示例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);
}
示例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());
}
示例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!
}
示例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();
}
示例15: InputCommands
public InputCommands(Keyboard keyboard, Mouse mouse, Touch touch, GamePad gamePad)
{
this.keyboard = keyboard;
this.mouse = mouse;
this.touch = touch;
this.gamePad = gamePad;
}