static void MicrophoneToggle(void) { if (NDS_getFinalUserInput().mic.micButtonPressed) NDS_setMic(false); else NDS_setMic(true); }
static void joyFill(int n) { bool pressedForGame = NDS_getFinalUserInput().buttons.array[n]; bool physicallyPressed = NDS_getRawUserInput().buttons.array[n]; if(pressedForGame && physicallyPressed) aggDraw.hud->fillColor(0,0,0,255); else if(pressedForGame) aggDraw.hud->fillColor(255,0,0,255); else if(physicallyPressed) aggDraw.hud->fillColor(0,255,0,255); else aggDraw.hud->fillColor(255,255,255,255); }
static void joyRoundedRect(double x1, double y1, int x2, int y2, int alpha1, int alpha2, int button) { bool pressedForGame = NDS_getFinalUserInput().buttons.array[button]; bool physicallyPressed = NDS_getRawUserInput().buttons.array[button]; if(pressedForGame && physicallyPressed) aggDraw.hud->fillLinearGradient(x1,y1,x2,y2,agg::rgba8(0,0,0,alpha1), agg::rgba8(0,0,0,alpha2)); else if(pressedForGame) aggDraw.hud->fillLinearGradient(x1,y1,x2,y2,agg::rgba8(255,0,0,alpha1), agg::rgba8(255,0,0,alpha2)); else if(physicallyPressed) aggDraw.hud->fillLinearGradient(x1,y1,x2,y2,agg::rgba8(0,255,0,alpha1), agg::rgba8(0,255,0,alpha2)); else return; //aggDraw.hud->fillLinearGradient(x1,y1,x2,y2,agg::rgba8(255,255,255,alpha1), agg::rgba8(255,255,255,alpha2)); aggDraw.hud->roundedRect(x1,y1,x2,y2,1); }
static bool Mic_GetActivate(void) { return NDS_getFinalUserInput().mic.micButtonPressed; }
static void TextualInputDisplay() { // drawing the whole string at once looks ugly // (because of variable width font and the "shadow" appearing over blank space) // and can't give us the color-coded effects we want anyway (see drawPad for info) const UserButtons& gameButtons = NDS_getFinalUserInput().buttons; const UserButtons& physicalButtons = NDS_getRawUserInput().buttons; double x = Hud.InputDisplay.x; // from order FRLDUTSBAYXWEG where G is 0 static const char* buttonChars = "<^>vABXYLRSsgf"; static const int buttonIndex [14] = {11,9,12,10,5,6,3,4,2,1,7,8,0,13}; for(int i = 0; i < 14; i++, x+=11.0) { bool pressedForGame = gameButtons.array[buttonIndex[i]]; bool physicallyPressed = physicalButtons.array[buttonIndex[i]]; if(pressedForGame && physicallyPressed) aggDraw.hud->lineColor(255,255,255,255); else if(pressedForGame) aggDraw.hud->lineColor(255,48,48,255); else if(physicallyPressed) aggDraw.hud->lineColor(0,192,0,255); else continue; // cast from char to std::string is a bit awkward std::string str(buttonChars+i, 2); str[1] = '\0'; aggDraw.hud->renderTextDropshadowed(x, calcY(Hud.InputDisplay.y), str); } // touch pad { char str [32]; BOOL gameTouchOn = nds.isTouch; int gameTouchX = nds.touchX >> 4; int gameTouchY = nds.touchY >> 4; bool physicalTouchOn = NDS_getRawUserInput().touch.isTouch; int physicalTouchX = NDS_getRawUserInput().touch.touchX >> 4; int physicalTouchY = NDS_getRawUserInput().touch.touchY >> 4; if(gameTouchOn && physicalTouchOn && gameTouchX == physicalTouchX && gameTouchY == physicalTouchY) { sprintf(str, "%d,%d", gameTouchX, gameTouchY); aggDraw.hud->lineColor(255,255,255,255); aggDraw.hud->renderTextDropshadowed(x, calcY(Hud.InputDisplay.y), str); } else { if(gameTouchOn) { sprintf(str, "%d,%d", gameTouchX, gameTouchY); aggDraw.hud->lineColor(255,48,48,255); aggDraw.hud->renderTextDropshadowed(x, calcY(Hud.InputDisplay.y)-(physicalTouchOn?8:0), str); } if(physicalTouchOn) { sprintf(str, "%d,%d", physicalTouchX, physicalTouchY); aggDraw.hud->lineColor(0,192,0,255); aggDraw.hud->renderTextDropshadowed(x, calcY(Hud.InputDisplay.y)+(gameTouchOn?8:0), str); } } } }