소스 검색

Docs: Add static usage

Jean-David Moisan 5 년 전
부모
커밋
bc87cc0188
2개의 변경된 파일33개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      README.md
  2. 32 0
      docs/getting-started.md

+ 1 - 1
README.md

@@ -41,7 +41,7 @@ protected override void Update(GameTime gametime) {
 
 ```csharp
 //Create a condition to toggle fullscreen.
-//It should work on either Alt keys with Enter.
+//It should work on either Alt keys combined along with Enter.
 var toggleFullScreen = new AllCondition(
     new AnyCondition(
         new KeyboardCondition(Keys.LeftAlt),

+ 32 - 0
docs/getting-started.md

@@ -1,5 +1,28 @@
 # Getting started
 
+## Install
+
+Install using the following dotnet command:
+```
+dotnet add package Apos.Input
+```
+
+## Static usage
+
+If you don't want to setup anything, you can use `KeyboardCondition`, `GamePadCondition`, and `MouseCondition` statically.
+
+```csharp
+if (KeyboardCondition.Pressed(Keys.Space) ||
+    GamePadCondition.Pressed(GamePadButton.A, 0) ||
+    MouseCondition.Pressed(MouseButton.LeftButton)) {
+
+    // Do the jump.
+
+}
+```
+
+## Instance usage
+
 Create a keyboard condition:
 ```csharp
 ICondition jump = new KeyboardCondition(Keys.Space);
@@ -24,3 +47,12 @@ ICondition jump =
         new MouseCondition(MouseButton.LeftButton)
     );
 ```
+
+To use `jump`, you can do:
+
+```csharp
+if (jump.Pressed()) {
+
+    // Do the jump.
+
+}