[SOLVED] Problem switching Input Sets

edited April 2011 in Help request
I've got three input sets defined:
[Input]
SetList = TitleScreenInput # MainGameInput # CreditsInput

Each one of these is defined in their separate config files (i.e., TitleScreen.ini, MainGame.ini, and Credits.ini). When I switch to the main game, I call:
orxInput_SelectSet("MainGameInput");

I've tested the return value of this one, and it does return orxSTATUS_SUCCESS. However, I find that only my TitleScreenInput is being processed. If I change the order of input sets in the SetList = ... line, and put MainGameInput first, then the MainGame input gets processed. That is, it seems like Orx is only processing the first (default) input set on the SetList line, regardless of whether I call orxInput_SelectSet() or not.

Any ideas?

Comments

  • edited April 2011
    Right, and I just tested
    orxInput_GetCurrentSet()
    

    ...and it shows that I do have MainGameInput selected. However, if I add a key input to TitleScreenInput that isn't in MainGameInput, the key still gets processed, even though MainGameInput is supposed to be the one selected.
  • edited April 2011
    Mmh, interesting. I haven't experienced any problem with this in the past but I haven't done any extensive testing of input set selection either.

    Which version of orx are you using?

    I'm currently back to France for two weeks as my father passed away at the beginning of the week, so I might not be able to do any testing/debugging right away. Sorry for the delay.
  • edited April 2011
    Freshest version of Orx out of SVN, as near as I can tell.

    Otherwise...ooof, that's terrible news to hear. You have my condolences. Honestly, take whatever time off you need; I know I for one was just posting here to get my question down in print before I forgot about it. You'd mentioned being away for personal reasons, so I didn't expect any immediate answers. Go ahead and take that time with your family; we'll be here when you get back.
  • edited April 2011
    Thanks for the precision. Yes, those are hard time for my family and myself but there's nothing we can do about it, unfortunately.
    I'll try to have a look to the input module in the coming days, at least that will keep my mind from wandering in places I don't want it to go. :)
  • edited April 2011
    I did a quick test yesterday with 2 input sets with both overlapping and distincts inputs. It worked just fine in my case and I could switch as many time as I wanted without encountering any bug.
    Are all your input sets in files that are loaded before init (ie. included from the main config file)? If not, are you loading them with orxInput_Load()? Is there any inheritance between your input sets?
    If you still have the issue, could you send your files for me to try directly? (You can PM me if you want to keep it private.)
  • edited April 2011
    Well, I've temporarily fixed the problem by just making one big input set defined at startup---this actually works fairly well for the game, so it's not a problem.

    However, this might tie into something I've noticed in the past, and had been meaning to ask about. In all my Orx projects thus far, I get a number of warnings about inputs already being bound. For example:
    ...
    [2011-04-10 21:44:56] <SYSTEM> (orxConfig_Load() - c:...coreorxconfig.c:2639) [Game_d.ini]: Ends the processing of included file @../CommonConfig.ini@.
    [2011-04-10 21:44:57] <INPUT> (orxInput_Bind() - c:...ioorxinput.c:1642) Input [AllGameInput::KeyA]: <KEY_A> is already bound to input [AllGameInput::KeyA].
    

    As I say, this happens in every project I make; it seems as though the engine is binding my inputs twice. However, in my current project, I'm only declaring the one set of inputs (which becomes the default set), and not calling orxInput_SelectSet() or orxInput_Load(). So I'm not sure why Orx is giving the warning above, or whether this may be causing my problems with orxInput_SelectSet().
  • edited April 2011
    Glad you found a work around. That being said, I'm still curious to see why in your case you get that weird behavior and that warning. If at some point you could make a zip of one of your project for me to try, that'd help me finding the issue. :)
  • edited April 2011
    iarwain wrote:
    If at some point you could make a zip of one of your project for me to try, that'd help me finding the issue. :)

    Will do. I've got my own OrxToLua.cpp file that (not surprisingly) exports a lot of Orx's functionality to Lua. Perhaps that has something else to do with the problem? Anyway, after I've finished this little game (just a silly project for some friends for Easter), I'll throw together an example project where I get the warnings.
  • edited April 2011
    Thanks, and don't worry, there's no rush!

    As for your LUA wrapper, do you think it's something that would benefit other users? If so, if you want to share it, I'd be happy to give you access to the svn and the wiki. No pressure though! :)
  • edited April 2011
    Yeah, that thought had occurred to me too. Right now I'm only passing along functions from Orx/C++ to Lua as I need them, so it's incomplete. If I have some time though, I think it could indeed be fleshed out and rolled into some sort of plugin.

    Anyway, when I pass along this sample input-problem project, you can have a look at it and tell me what you think.
  • edited April 2011
    I guess I could run a tool such as C++toLUA (or whatever its name is) and provide a wrapper. I didn't take any time to dig into that and it's unlikely to happen in the short term future. But maybe someone else would be interested in doing such a thing. If so, please let me know!
  • edited April 2011
    Righto, so I think I solved this mystery.

    I was calling orxInput_Load(orxSTRING_EMPTY) in my app's Init() function; I think I read somewhere (a tutorial on the wiki?) that this was necessary during startup. Is this perhaps only for Orx plugins, as opposed to stand-along applications?

    Anyway, I removed the orxInput_Load() call, and now I no longer get the "already bound to input" warnings. Case closed.
  • edited April 2011
    Ah good to know.

    So yes, when a project is using the launcher, as the inputs will be initialized just after orx.ini is loaded and before the user's plugin is initialized. One might need to manually load his config file and then reload the inputs.
Sign In or Register to comment.