diff --git a/desmume/src/GPU_osd.cpp b/desmume/src/GPU_osd.cpp index 9a366eac9..a328a913a 100644 --- a/desmume/src/GPU_osd.cpp +++ b/desmume/src/GPU_osd.cpp @@ -123,6 +123,11 @@ void HudStruct::reset() InputDisplay.xsize=120; InputDisplay.ysize=10; + GraphicalInputDisplay.x=8; + GraphicalInputDisplay.y=328; + GraphicalInputDisplay.xsize=100; + GraphicalInputDisplay.ysize=40; + LagFrameCounter.x=0; LagFrameCounter.y=65; LagFrameCounter.xsize=30; @@ -141,6 +146,78 @@ void HudStruct::reset() SetHudDummy(&Dummy); } +void joyFill(int n) { + + if(nds.pad & (1 << n)) + aggDraw.hud->fillColor(0,0,0,255); + else + aggDraw.hud->fillColor(255,255,255,255); +} + +void joyEllipse(double ex, double ey, int xc, int yc, int x, int y, double ratio, double rad, int button) { + + joyFill(button); + aggDraw.hud->ellipse(x+((xc*ex)*ratio), y+((yc*ey)*ratio), rad*ratio, rad*ratio); +} + +void gradientFill(double x1,double y1,double x2,double y2,AggColor c1,AggColor c2, int n) { + + if(nds.pad & (1 << n)) + aggDraw.hud->fillLinearGradient(x1,y1,x2,y2,c1,c2); + else + aggDraw.hud->fillColor(255,255,255,255); +} + +void drawPad(int x, int y, double ratio) { + + int xc = 41; + int yc = 20; + + aggDraw.hud->lineColor(128,128,128,255); + + aggDraw.hud->fillLinearGradient(x, y, x+(xc*ratio), y+(yc*ratio), agg::rgba8(222,222,222,128), agg::rgba8(255,255,255,255)); + + if(nds.pad & (1 << 2)) + aggDraw.hud->fillLinearGradient(x, y, x+(xc*ratio), y+(yc*ratio), agg::rgba8(0,0,0,128), agg::rgba8(255,255,255,255)); + + if(nds.pad & (1 << 1)) + aggDraw.hud->fillLinearGradient(x+(xc*ratio), y+(yc*ratio), x, y, agg::rgba8(0,0,0,128), agg::rgba8(255,255,255,255)); + + aggDraw.hud->roundedRect (x, y, x+(xc*ratio), y+(yc*ratio), 1); + + aggDraw.hud->fillLinearGradient(x+(xc*.25*ratio), y+(yc*.1*ratio), x+(xc*.75*ratio), y+(yc*.85*ratio), agg::rgba8(128,128,128,128), agg::rgba8(255,255,255,255)); + + aggDraw.hud->roundedRect (x+(xc*.25*ratio), y+(yc*.1*ratio), x+(xc*.75*ratio),y+(yc*.85*ratio), 1); + + joyEllipse(.89,.45,xc,yc,x,y,ratio,1,6);//B + joyEllipse(.89,.22,xc,yc,x,y,ratio,1,3);//X + joyEllipse(.83,.34,xc,yc,x,y,ratio,1,4);//Y + joyEllipse(.95,.34,xc,yc,x,y,ratio,1,5);//A + joyEllipse(.82,.72,xc,yc,x,y,ratio,.5,7);//Start + joyEllipse(.82,.85,xc,yc,x,y,ratio,.5,8);//Select + + aggDraw.hud->noLine(); + aggDraw.hud->fillColor(255,255,255,200); + + //left + gradientFill(x+(xc*.04*ratio), y+(yc*.33*ratio), x+(xc*.17*ratio), y+(yc*.43*ratio), agg::rgba8(0,0,0,255), agg::rgba8(255,255,255,255),11); + + //right + if(nds.pad & (1 << 12)) + aggDraw.hud->fillLinearGradient(x+(xc*.17*ratio), y+(yc*.43*ratio), x+(xc*.04*ratio), y+(yc*.33*ratio), agg::rgba8(0,0,0,255), agg::rgba8(255,255,255,255)); + + aggDraw.hud->roundedRect (x+(xc*.04*ratio), y+(yc*.33*ratio), x+(xc*.17*ratio), y+(yc*.43*ratio), 1); + + //down + gradientFill(x+(xc*.13*ratio), y+(yc*.52*ratio), x+(xc*.08*ratio), y+(yc*.23*ratio), agg::rgba8(0,0,0,255), agg::rgba8(255,255,255,255),10); + + //up + if(nds.pad & (1<< 9)) + aggDraw.hud->fillLinearGradient(x+(xc*.08*ratio), y+(yc*.23*ratio), x+(xc*.13*ratio), y+(yc*.52*ratio), agg::rgba8(0,0,0,255), agg::rgba8(255,255,255,255)); + + aggDraw.hud->roundedRect (x+(xc*.08*ratio), y+(yc*.23*ratio), x+(xc*.13*ratio), y+(yc*.52*ratio), 1); +} + struct TouchInfo{ u16 X; @@ -263,6 +340,9 @@ void DrawHUD() osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames); } + if (CommonSettings.hud.ShowGraphicalInputDisplay) + drawPad(Hud.GraphicalInputDisplay.x, Hud.GraphicalInputDisplay.y, 2.5); + #ifdef WIN32 if (CommonSettings.hud.ShowMicrophone) { diff --git a/desmume/src/GPU_osd.h b/desmume/src/GPU_osd.h index def104de7..a97343a83 100644 --- a/desmume/src/GPU_osd.h +++ b/desmume/src/GPU_osd.h @@ -56,6 +56,7 @@ public: HudCoordinates FpsDisplay; HudCoordinates FrameCounter; HudCoordinates InputDisplay; + HudCoordinates GraphicalInputDisplay; HudCoordinates LagFrameCounter; HudCoordinates Microphone; HudCoordinates Dummy; diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index aff930b41..3e1d90500 100644 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -463,12 +463,13 @@ extern struct TCommonSettings { struct _Hud { _Hud() : ShowInputDisplay(false) + , ShowGraphicalInputDisplay(false) , FpsDisplay(false) , FrameCounterDisplay(false) , ShowLagFrameCounter(false) , ShowMicrophone(false) {} - bool ShowInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone; + bool ShowInputDisplay, ShowGraphicalInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone; } hud; } CommonSettings; diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index e220ea648..b49f5ab22 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -1571,6 +1571,7 @@ int _main() CommonSettings.hud.FpsDisplay = GetPrivateProfileBool("Display","Display Fps", false, IniName); CommonSettings.hud.FrameCounterDisplay = GetPrivateProfileBool("Display","FrameCounter", false, IniName); CommonSettings.hud.ShowInputDisplay = GetPrivateProfileBool("Display","Display Input", false, IniName); + CommonSettings.hud.ShowGraphicalInputDisplay = GetPrivateProfileBool("Display","Display Graphical Input", false, IniName); CommonSettings.hud.ShowLagFrameCounter = GetPrivateProfileBool("Display","Display Lag Counter", false, IniName); CommonSettings.hud.ShowMicrophone = GetPrivateProfileBool("Display","Display Microphone", false, IniName); @@ -3633,6 +3634,12 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM osd->clear(); return 0; + case ID_VIEW_DISPLAYGRAPHICALINPUT: + CommonSettings.hud.ShowGraphicalInputDisplay ^= true; + WritePrivateProfileBool("Display", "Display Graphical Input", CommonSettings.hud.ShowGraphicalInputDisplay, IniName); + osd->clear(); + return 0; + case ID_VIEW_DISPLAYLAG: CommonSettings.hud.ShowLagFrameCounter ^= true; WritePrivateProfileBool("Display", "Display Lag Counter", CommonSettings.hud.ShowLagFrameCounter, IniName); diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index b48f1d717..f45064860 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -245,6 +245,7 @@ #define IDR_ACCELERATOR1 968 #define IDD_PROMPT 969 #define IDD_IOREG_VIEW_MEM_IRQ 970 +#define ID_VIEW_DISPLAYGRAPHICALINPUT 971 #define IDD_IOREG_VIEW_SPI 973 #define IDD_IOREG_VIEW_CP15 975 #define IDD_SOUND_VIEW 977 diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index fbae4c7e6..9fa633f14 100644 Binary files a/desmume/src/windows/resources.rc and b/desmume/src/windows/resources.rc differ