So here' something I've been wondering. Like most programmers I shy and shy away from global variables and haven't a function needs defined within itself.
But.. in my current code base, I have:
"gameControl()" (that controls gameplay when moving around)
"menuControl()" (controls navigation in the status menu)
"battleControl()" (controls controls within a battle)
Within each of these, I'm defining:
... or some equivalent. I can't help but wonder if it's papd for me to be initializing the pad EVERY TIME I need it.. Would there be a better way to code it where the pad was only defined once? Or am I doing it the "proper" way by initializing the controller buttons within each function that requires them.Code:sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG); SceCtrlData pad; sceCtrlReadBufferPositive(&pad, 1);