So almost got her to work. Haven't got the brightness to work yet. HAven't got the CRT switches to animate either
not sure about the code to animate the switch?
I have if MFD_left is Not equal to MFD_none so the MFD_left is on then move the switch?
not sure about the code to animate the switch?
Code:
bool Atlantis::clbkVCMouseEvent (int id, int event, VECTOR3 &p)
{
static bool counting = false;
static double t0 = 0.0;
switch (id) {
// handle MFD selection buttons
case AID_CDR1_BUTTONS:
case AID_PLT1_BUTTONS:
case AID_MFD1_BUTTONS:
//case AID_MFDA_BUTTONS:
{
int mfd = id-AID_CDR1_BUTTONS+MFD_LEFT;
int bt = (int)(p.x*5.99);
if (bt < 5) oapiProcessMFDButton (mfd, bt, event);
else {
if (event & PANEL_MOUSE_LBDOWN) {
t0 = oapiGetSysTime();
counting = true;
} else if ((event & PANEL_MOUSE_LBUP) && counting) {
oapiSendMFDKey (mfd, OAPI_KEY_F2);
counting = false;
} else if ((event & PANEL_MOUSE_LBPRESSED) && counting && (oapiGetSysTime()-t0 >= 1.0)) {
oapiSendMFDKey (mfd, OAPI_KEY_F1);
counting = false;
}
}
} return true;
// D. Beachy: handle power buttons
case AID_CDR1_PWR:
case AID_PLT1_PWR:
case AID_MFD1_PWR:
//case AID_MFDA_PWR:
{
int mfd = id - AID_CDR1_PWR+MFD_LEFT;
oapiSendMFDKey(mfd, OAPI_KEY_ESCAPE);
} return true;
if (oapiGetMFDMode(MFD_LEFT) != MFD_NONE){
SetAnimation(anim_mfd1,1);// mfd1 is on
}
// handle MFD brightness buttons
case AID_CDR1_BRT:
case AID_PLT1_BRT:
case AID_MFD1_BRT:
//case AID_MFDA_BRT:
{
static double t0, brt0;
static bool up;
int mfd = id-AID_CDR1_BRT;
if (event & PANEL_MOUSE_LBDOWN) {
up = (p.x >= 0.5);
t0 = oapiGetSysTime();
brt0 = mfdbright[mfd];
} else if (event & PANEL_MOUSE_LBPRESSED) {
double dt = oapiGetSysTime()-t0;
double brt, dbrt = dt * 0.2;
if (up) brt = min (1.0, brt0 + dbrt);
else brt = max (0.25, brt0 - dbrt);
mfdbright[mfd] = brt;
if (vis) {
MATERIAL mat;
memset (&mat, 0, sizeof(MATERIAL));
mat.emissive.r = mat.emissive.g = mat.emissive.b = (float)brt;
mat.emissive.a = 1.0f;
DEVMESHHANDLE hMesh = GetDevMesh (vis, mesh_vc);
oapiSetMaterial (hMesh, 24+mfd, &mat);
}
}
} return false;
// handle panel R13L events (payload bay operations)
case AID_R13L:
return plop->VCMouseEvent (id, event, p);
}
return false;
}
I have if MFD_left is Not equal to MFD_none so the MFD_left is on then move the switch?