User Tools

Site Tools


en:tutorials:input:testing_input_controls

Differences

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

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
en:tutorials:testing_input_controls [2018/08/24 04:47 (6 years ago)] – created sausageen:tutorials:input:testing_input_controls [2020/08/31 05:44 (4 years ago)] – ↷ Page moved from en:tutorials:testing_input_controls to en:tutorials:input:testing_input_controls sausage
Line 5: Line 5:
 Good also for keyboard testing to get the names of keypresses which you can use in your config files. Good also for keyboard testing to get the names of keypresses which you can use in your config files.
  
-Start by creating a new [[en:tutorials:creating_your_own_project|Creating your own Orx-based Project using 'init']].+Start by creating a new [[en:tutorials:projects:creating_your_own_project|Creating your own Orx-based Project using 'init']].
  
 Open the project. We don't need an ''Object'' so remove or comment out this line from the Init() function: Open the project. We don't need an ''Object'' so remove or comment out this line from the Init() function:
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><hidden>Hidden section</hidden>+</code>
en/tutorials/input/testing_input_controls.txt · Last modified: 2022/12/06 13:39 (16 months ago) by iarwain