Setting an input value

edited February 2012 in Help request
I'm not sure how to use the orxInput_SetValue function. What goes in as the value parameter? 0 deactivates it, but what do other values do? Could you give me an example of how it works? And a difference between SetValue and SetPermanentValue?

EDIT: Also, the reason that I'm asking is I'm trying to quit my game. Currently, I have the following code left over from my application's time as a plugin:
orxEvent_SendShort(orxEVENT_TYPE_SYSTEM, orxSYSTEM_EVENT_CLOSE)
The application will still quit, but I don't know if its safe to do that way. I'm instead trying to set the "quit" input as active, causing the code in the run function to return orxFAILURE and terminate the game. If its still OK to use orxEvent_SendShort, it would still be nice to know how to use this function if I ever get around to adding replays.

Comments

  • edited February 2012
    It's always ok to send the system close event, no worries about that.

    As for orxInput_SetValue(), any value works. It all depends on what you expect when you read it.
    If mapped to a physical peripheral, buttons will set the value to 1 and joystick axes will set it to X with -1 <= X <= 1.

    But really, you can set it the way you want, it's only a convention between who's setting the value and who's going to read it.

    As for SetValue() it means the value will be set for one frame whereas SetPermanentValue() will set it for the given value till someone sets it to something different.
  • edited February 2012
    So the system close event will call my Exit function before orx terminates, right?
  • edited February 2012
    Yep, no matter how you quit orx (except by brutally killing the process, of course) your Exit function will get called by orx before it cleans everything else.
  • edited February 2012
    Thanks. Also, is there a way to temporarily disable user input? Is the best way just to make an input set that does nothing and toggle between it and the other ones as necessary?
  • edited February 2012
    Yep, I think so. At least that's the way I'd do it. :)
Sign In or Register to comment.