X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fwin32%2FGenaDrive%2FLightCal.cpp;fp=platform%2Fwin32%2FGenaDrive%2FLightCal.cpp;h=0000000000000000000000000000000000000000;hb=1b0ac8adc97d65c686a48c4375c07907de86be24;hp=0d697d941de8aed710aaed7741509866d6345731;hpb=e0978fa87d22f168ea9c039c6e2c5bf1274ba9e0;p=picodrive.git diff --git a/platform/win32/GenaDrive/LightCal.cpp b/platform/win32/GenaDrive/LightCal.cpp deleted file mode 100644 index 0d697d9..0000000 --- a/platform/win32/GenaDrive/LightCal.cpp +++ /dev/null @@ -1,102 +0,0 @@ - -#include "app.h" - -struct Target -{ - int sx,sy; // Onscreen coordinates - int dx,dy; // Device values -}; - -struct Target Targ[2]= -{ - {0,0, 0,0}, - {0,0, 0,0} -}; -static int LightState=0; - -struct Calib -{ - float ax,bx; - float ay,by; -}; -static struct Calib Cal={0.0f,0.0f,0.0f,0.0f}; - -int LightCalReset() -{ - LightState=0; - - memset(Targ,0,sizeof(Targ)); - Targ[0].sx=MainWidth >>1; - Targ[0].sy=MainHeight>>1; - Targ[1].sy=Targ[0].sy-MainHeight*61/160; - Targ[1].sx=Targ[0].sx-MainWidth *61/160; - return 0; -} - -int LightCalUpdate() -{ - int i=0; - struct Target *pt=NULL; - - if (Inp.held[4]==1) LoopMode=3; - - if (Inp.held[8]==1) - { - i=LightState&1; - pt=Targ+i; - - pt->dx=Inp.axis[0]; - pt->dy=Inp.axis[1]; - - if (i==1) - { - int num=0,den=0; - - // rx= a + b*x - work out a and b: - num=Targ[0].sx-Targ[1].sx; - den=Targ[0].dx-Targ[1].dx; - if (den) Cal.bx=(float)num/(float)den; - Cal.ax=(float)Targ[0].sx-Cal.bx*(float)Targ[0].dx; - - num=Targ[0].sy-Targ[1].sy; - den=Targ[0].dy-Targ[1].dy; - if (den) Cal.by=(float)num/(float)den; - Cal.ay=(float)Targ[0].sy-Cal.by*(float)Targ[0].dy; - } - - LightState++; - } - - return 0; -} - -int LightCalRender() -{ - int i=0; - struct Target *pt=NULL; - float fx=0.0f,fy=0.0f; - - DirectClear(0xffffff); - - WCHAR text[80]={0}; - wsprintfW(text,L"LightGun Calibration"); - FontSetColour(0x0000ff); - FontText(text,240,48); - - wsprintfW(text,L"Start to quit, B to call InputLightCal"); - FontSetColour(0x004000); - FontText(text,64,120); - - i=LightState&1; - pt=Targ+i; - FontSetColour(0); - FontText(L"X", pt->sx-8, pt->sy-12); - - fx=Cal.ax+Cal.bx*(float)Inp.axis[0]; - fy=Cal.ay+Cal.by*(float)Inp.axis[1]; - - FontSetColour(0xff0000); - FontText(L"+", (int)fx-8,(int)fy-12); - - return 0; -}