This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:orx:tutorials:community:grey:tutorial4 [2012/05/22 23:04 (12 years ago)] – [StandAlone.cpp] grey | en:tutorials:physics:interaction-physics [2020/08/31 06:38 (4 years ago)] (current) – ↷ Page moved from en:tutorials:community:grey:interaction-physics to en:tutorials:physics:interaction-physics sausage | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | + | ====== Interaction, | |
- | <code c> | + | |
- | "DO NOT FOLLOW THESE TUTORIALS OUT OF ORDER UNLESS YOU KNOW WHAT YOU ARE DOING!" | + | |
- | + | ||
- | Each tutorial assumes you have the COMPLETED code from the previous tutorial. | + | |
- | This is intentional, | + | |
- | </ | + | |
- | + | ||
- | ====== | + | |
For this tutorial, we'll first add some keyboard controls, then later some physics. | For this tutorial, we'll first add some keyboard controls, then later some physics. | ||
- | **You will need some new files [[http:// | ||
These, are added to our //data// folder, along with everything from tutorial 3. | These, are added to our //data// folder, along with everything from tutorial 3. | ||
Line 395: | Line 386: | ||
<code c> | <code c> | ||
// Here we add event handling for tutorial 4, Input! | // Here we add event handling for tutorial 4, Input! | ||
- | case orxEVENT_TYPE_INPUT: | + | case orxEVENT_TYPE_INPUT: |
- | { | + | { |
- | orxINPUT_EVENT_PAYLOAD* EventPayload = (orxINPUT_EVENT_PAYLOAD*)currentEvent-> | + | orxINPUT_EVENT_PAYLOAD* EventPayload = (orxINPUT_EVENT_PAYLOAD*)currentEvent-> |
- | + | const orxCHAR* EventAct; | |
- | const orxCHAR* EventAct; | + | |
- | + | ||
- | switch( currentEvent-> | + | |
- | { | + | |
- | // We don't want this any more, lets comment it out | + | |
- | //case orxINPUT_EVENT_ON: | + | |
+ | switch( currentEvent-> | ||
+ | { | ||
+ | // We don't want this any more, lets comment it out | ||
+ | //case orxINPUT_EVENT_ON: | ||
- | // NEW STUFF BELOW | + | // NEW STUFF BELOW |
- | + | case orxINPUT_EVENT_ON: | |
- | case orxINPUT_EVENT_ON: | + | { |
- | { | + | if( orxInput_IsActive( " |
- | if( orxInput_IsActive( " | + | orxObject_CreateFromConfig( " |
- | orxObject_CreateFromConfig( " | + | |
- | EventAct = " | + | EventAct = " |
- | break; | + | break; |
- | } | + | } |
+ | // NEW STUFF ABOVE | ||
- | // NEW STUFF ABOVE | + | case orxINPUT_EVENT_OFF: |
- | + | default: return orxSTATUS_SUCCESS; | |
- | case orxINPUT_EVENT_OFF: | + | } |
- | default: return orxSTATUS_SUCCESS; | + | |
- | } | + | |
- | orxLOG(" | + | orxLOG(" |
- | break; | + | break; |
- | } | + | } |
</ | </ | ||
Line 488: | Line 475: | ||
' | ' | ||
+ | |||
+ | < | ||
Next we'll make a little change to our EventHandler. | Next we'll make a little change to our EventHandler. | ||
Line 537: | Line 526: | ||
Compile, and try it out, and hopefully get distracted for the next 5 minutes like I was, so you don't notice that this tutorial is over! :D | Compile, and try it out, and hopefully get distracted for the next 5 minutes like I was, so you don't notice that this tutorial is over! :D | ||
- | |||
- | |||
- | |||
- | ====== See Also ====== | ||
- | This article is part of a series!\\ | ||
- | Series: [[en: | ||
- | Prev: [[en: | ||
- | Next: (none)\\ | ||