User Tools

Site Tools


en:tutorials:testing_input_controls

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:tutorials:testing_input_controls [2018/08/24 11:48 (23 months ago)]
sausage
en:tutorials:testing_input_controls [2018/09/22 15:22 (22 months ago)]
sausage
Line 13: Line 13:
 </​code>​ </​code>​
  
-Create a clock in the Init() function ​that checks ​regularly for input:+Use the core clock in the Init() function ​to check regularly for input:
  
 <code c> <code c>
-orxCLOCK *checkInputsClock = orxClock_Create(orx2F(0.05f)orxCLOCK_TYPE_USER)+orxClock_Register(orxClock_FindFirst(-1.0forxCLOCK_TYPE_CORE), InputCheck, orxNULL, orxMODULE_ID_MAIN,​ orxCLOCK_PRIORITY_NORMAL);​
-orxClock_Register(checkInputsClock, InputCheck, orxNULL, orxMODULE_ID_MAIN,​ orxCLOCK_PRIORITY_NORMAL);​+
 </​code>​ </​code>​
 +
 +<WRAP center round tip 90%>
 +**Note:** ''​orxInput_GetActiveBinding''​ only collects an input for the specific frame. A slow custom clock will miss values especially if they are fast inputs like mouse wheel clicks. Therefore, we use the **core clock**.
 +</​WRAP>​
 +
  
 And finally, the ''​InputCheck''​ function to get and display input: And finally, the ''​InputCheck''​ function to get and display input:
Line 36: Line 40:
  }  }
 } }
 +
 </​code>​ </​code>​
  
Line 49: Line 54:
 [21:16:01] [LOG] Input: KEY_SPACE, Type: 0, ID: 71, Value 1.000000 [21:16:01] [LOG] Input: KEY_SPACE, Type: 0, ID: 71, Value 1.000000
 [21:16:01] [LOG] Input: KEY_SPACE, Type: 0, ID: 71, Value 1.000000 [21:16:01] [LOG] Input: KEY_SPACE, Type: 0, ID: 71, Value 1.000000
-[21:16:02] [LOG] Input: ​JOY_X_1, Type: 4, ID: 0, Value -0.447379 +[21:16:02] [LOG] Input: ​JOY_LX_1, Type: 4, ID: 0, Value -0.447379 
-[21:16:02] [LOG] Input: ​JOY_X_1, Type: 4, ID: 0, Value -0.833341+[21:16:02] [LOG] Input: ​JOY_LX_1, Type: 4, ID: 0, Value -0.833341
 [21:16:04] [LOG] Input: JOY_1_1, Type: 3, ID: 0, Value 1.000000 [21:16:04] [LOG] Input: JOY_1_1, Type: 3, ID: 0, Value 1.000000
 [21:16:05] [LOG] Input: JOY_1_1, Type: 3, ID: 0, Value 1.000000 [21:16:05] [LOG] Input: JOY_1_1, Type: 3, ID: 0, Value 1.000000
-[21:17:01] [LOG] Input: ​JOY_X_1, Type: 4, ID: 0, Value 0.300008 +[21:17:01] [LOG] Input: ​JOY_LX_1, Type: 4, ID: 0, Value 0.300008 
-[21:17:01] [LOG] Input: ​JOY_Y_1, Type: 4, ID: 1, Value -0.454551+[21:17:01] [LOG] Input: ​JOY_LY_1, Type: 4, ID: 1, Value -0.454551
 [21:17:02] [LOG] Input: JOY_16_1, Type: 3, ID: 15, Value 1.000000 [21:17:02] [LOG] Input: JOY_16_1, Type: 3, ID: 15, Value 1.000000
 </​code>​ </​code>​
en/tutorials/testing_input_controls.txt · Last modified: 2018/09/22 18:22 (22 months ago) (external edit)