diff --git a/desmume/src/GPU_osd.cpp b/desmume/src/GPU_osd.cpp index 7806ebb0b..b1964dd6e 100644 --- a/desmume/src/GPU_osd.cpp +++ b/desmume/src/GPU_osd.cpp @@ -30,6 +30,8 @@ #include "debug.h" #include "aggdraw.h" +#include "movie.h" +#include "NDSSystem.h" OSDCLASS *osd = NULL; @@ -207,3 +209,44 @@ void OSDCLASS::border(bool enabled) //render51.setTextBoxBorder(enabled); } +struct TouchInfo{ + u16 X; + u16 Y; +}; +static int touchalpha[8]= {31, 63, 95, 127, 159, 191, 223, 255}; +static TouchInfo temptouch; +bool touchshadow = true; +static std::vector touch (8); + +void OSDCLASS::TouchDisplay(){ + + if(!ShowInputDisplay) return; + + aggDraw.hud->lineWidth(1.0); + + temptouch.X = nds.touchX >> 4; + temptouch.Y = nds.touchY >> 4; + touch.push_back(temptouch); + + if(touch.size() > 8) touch.erase(touch.begin()); + + if(touchshadow) { + for (int i = 0; i < 8; i++) { + temptouch = touch[i]; + if(temptouch.X != 0 || temptouch.Y != 0) { + aggDraw.hud->lineColor(0, 255, 0, touchalpha[i]); + aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz + aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert + aggDraw.hud->fillColor(0, 0, 0, touchalpha[i]); + aggDraw.hud->rectangle(temptouch.X-1, temptouch.Y-1 + 192, temptouch.X+1, temptouch.Y+1 + 192); + } + } + } + else + if(nds.isTouch) { + aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz + aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert + } +} + + diff --git a/desmume/src/GPU_osd.h b/desmume/src/GPU_osd.h index f92acce17..744e44b1e 100644 --- a/desmume/src/GPU_osd.h +++ b/desmume/src/GPU_osd.h @@ -66,6 +66,7 @@ public: void addLine(const char *fmt, ...); void addFixed(u16 x, u16 y, const char *fmt, ...); void border(bool enabled); + void TouchDisplay(); }; extern OSDCLASS *osd; diff --git a/desmume/src/movie.cpp b/desmume/src/movie.cpp index 9a923c3ff..41731ddda 100644 --- a/desmume/src/movie.cpp +++ b/desmume/src/movie.cpp @@ -698,8 +698,8 @@ void _CDECL_ FCEUI_SaveMovie(const char *fname, std::wstring author, int flag, s /*extern uint8 joy[4]; memcpy(&cur_input_display,joy,4);*/ - if (ShowInputDisplay && nds.isTouch) - osd->addFixed(nds.touchX >> 4, (nds.touchY >> 4) + 192 , "%s %d %d", "X", nds.touchX >> 4, nds.touchY >> 4); + osd->TouchDisplay(); + }