Config.scaler = 0;
Config.hacksFile = 0;
Config.touchscreenInput = false;
+ Config.touchscreenShow = false;
Settings.JoystickEnabled = FALSE;
Settings.SoundPlaybackRate = 22050;
break;
case 17:
Config.touchscreenInput = true;
- // TODO Touchscreen grid
+ Config.touchscreenShow = true;
break;
case 18:
Settings.HacksEnabled = TRUE;
char * hacksFile;
/** Enable touchscreen controls */
bool touchscreenInput;
+ /** Display touchscreen controls grid */
+ bool touchscreenShow;
/** Current scancode->joypad mapping */
unsigned short joypad1Mapping[256];
unsigned char action[256];
EXTERN_C void S9xInitInputDevices();
void S9xDeinitInputDevices();
void S9xInputScreenChanged();
+void S9xInputScreenDraw(int pixelSize, void * buffer, int pitch);
// Input actions
#define kActionNone 0
if (action & kActionToggleFullscreen) {
S9xVideoToggleFullscreen();
- S9xInputScreenChanged();
}
if (action & kActionQuickLoad1) {
}
}
+template <typename T>
+static void drawControls(T * buffer, const int pitch)
+{
+ unsigned int i = 0;
+ int x, y;
+ T* temp;
+
+ for (i = 0; i < sizeof(touchbuttons)/sizeof(TouchButton); i++) {
+ temp = buffer + touchbuttons[i].y * pitch + touchbuttons[i].x;
+ for (x = touchbuttons[i].x; x < touchbuttons[i].x2; x++) {
+ *temp = -1UL; // Black
+ temp++;
+ }
+ temp = buffer + touchbuttons[i].y2 * pitch + touchbuttons[i].x;
+ for (x = touchbuttons[i].x; x < touchbuttons[i].x2; x++) {
+ *temp = -1UL; // Black
+ temp++;
+ }
+ temp = buffer + touchbuttons[i].y * pitch + touchbuttons[i].x;
+ for (y = touchbuttons[i].y; y < touchbuttons[i].y2; y++) {
+ *temp = -1UL; // Black
+ temp+=pitch;
+ }
+ temp = buffer + touchbuttons[i].y * pitch + touchbuttons[i].x2;
+ for (y = touchbuttons[i].y; y < touchbuttons[i].y2; y++) {
+ *temp = -1UL; // Black
+ temp+=pitch;
+ }
+ }
+}
+
+void S9xInputScreenDraw(int pixelSize, void * buffer, int pitch)
+{
+ switch (pixelSize)
+ {
+ case 1:
+ drawControls(reinterpret_cast<uint8*>(buffer), pitch);
+ break;
+ case 2:
+ drawControls(reinterpret_cast<uint16*>(buffer), pitch / 2);
+ break;
+ }
+}
+
scaler->getName());
}
+static void drawOnscreenControls()
+{
+ if (Config.touchscreenInput) {
+ S9xInputScreenChanged();
+ if (Config.touchscreenShow) {
+ S9xInputScreenDraw(Settings.SixteenBit ? 2 : 1,
+ screen->pixels, screen->pitch);
+ SDL_Flip(screen);
+ }
+ }
+}
+
void S9xInitDisplay(int argc, const char ** argv)
{
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
DIE("SDL_InitSubSystem(VIDEO): %s", SDL_GetError());
setupVideoSurface();
+ drawOnscreenControls();
}
void S9xDeinitDisplay()
Config.fullscreen = !Config.fullscreen;
freeVideoSurface();
setupVideoSurface();
+ drawOnscreenControls();
}
void S9xVideoOutputFocus(bool hasFocus)