General Question simple vc help

Thanks. That is what I was hunting for

---------- Post added at 03:47 PM ---------- Previous post was at 12:38 PM ----------

Ok I put a break in the sys button area. When I press the mouse in the SYS area of mfd center i get this:
+ p {data=0x00a7fe18 {0.065676588159412574, 0.45054772130140464, 0.00000000000000000} x=0.065676588159412574 ...} const VECTOR3 &
this is left mfd fn:
+ p {data=0x00a7fe18 {0.035283884338211724, 0.038286942485692421, 0.00000000000000000} x=0.035283884338211724 ...} const VECTOR3 &

---------- Post added 04-28-17 at 05:55 AM ---------- Previous post was 04-27-17 at 03:47 PM ----------

So I placed a break here and no break when I click around the mfd buttons. It does around the lower buttons on the center and other mfd.
C7f5j45.jpg


Code:
	mfdController = new ClassicMfd(3, g_Param.hFont[0], g_Param.col[0], g_Param.hBrush[0], g_Param.hBrush[1], &MFD_BUTTONS_FN_DIM, MFD_BUTTONS_FN_RECT, &MFD_BUTTONS_SYS_DIM, MFD_BUTTONS_SYS_RECT);


Code:
bool TALON::clbkLoadGenericCockpit() {
	return true;
}

bool TALON::clbkLoadVC(int id) { // ID is the Preset Camera Position
	huds.size = 0.3;
	huds.nmesh = 2;

	mfdController->HandleLoadVC(id);
	oapiVCRegisterHUD(&huds);

	
	switch (id) {
	case 0: // commander position
		SetCameraOffset(_V(-0.41, 1.6, 2.21));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.3), 0, 0, _V(-0.3, 0, 0), 75 * RAD, -5 * RAD, _V(0.3, 0, 0), -20 * RAD, -27 * RAD);
		oapiVCSetNeighbours(-1, 1, -1, 2);

		
		break;
	case 1: // pilot position
		SetCameraOffset(_V(0.41, 1.6, 2.21));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.3), 0, 0, _V(-0.3, 0, 0), 20 * RAD, -27 * RAD, _V(0.3, 0, 0), -75 * RAD, -5 * RAD);
		oapiVCSetNeighbours(0, -1, -1, 2);

		
		break;

	}

	return HandleLoadVC(id);

}

bool TALON::HandleLoadVC(UINT const id)
{



	return true;
}

	bool TALON::clbkVCMouseEvent(int id, int event, VECTOR3 &p)
	{
		bool result = false;
		result = result || mfdController->HandleMouseEvent(id, event, p);
		result = result || VCMouseEvent(id, event, p);
		return result;
	}

	bool TALON::VCMouseEvent(int const id, int const event, VECTOR3& const p)
	{



		return false; // We must return false, as we didn't processed the event!
	}



	bool TALON::clbkVCRedrawEvent(int id, int event, SURFHANDLE surf) {
		bool result = false;
		result = result || mfdController->HandleRedrawEvent(id, event, surf);


		result = result || VCRedrawEvent(id, event, surf);
		{}

	
	return result;
}

	bool TALON::VCRedrawEvent(int const id, int const event, SURFHANDLE const surf) {
		return false;
	}

	void TALON::clbkMFDMode(int mfd, int mode)
	{
		mfdController->HandleMFDMode(mfd, mode);
	}

Could another mesh be blocking it?
 
According to your source code, aid=5 means:

Code:
#define AID_PILOT_MFD_CENTER_BTNS_FN 5
 
According to your source code, aid=5 means:

Code:
#define AID_PILOT_MFD_CENTER_BTNS_FN 5
Ok.

Isn't that correct?

originally is was:
Code:
#pragma once
#define AID_FIRST_ID 0
#define   AID_PILOT_MFD_LEFT_BTNS_FN 1 
#define AID_PILOT_MFD_LEFT_BTNS_SYS 2 
#define AID_PILOT_MFD_CENTER_BTNS_FN 3 
#define AID_PILOT_MFD_CENTER_BTNS_SYS 4 
#define AID_PILOT_MFD_RIGHT_BTNS_FN 5 
#define AID_PILOT_MFD_RIGHT_BTNS_SYS 6
Then I went to 2
Code:
#pragma once
#define AID_FIRST_ID 0  
#define AID_PILOT_MFD_LEFT_BTNS_FN 1 
#define AID_PILOT_MFD_LEFT_BTNS_SYS 2 
#define AID_PILOT_MFD_RIGHT_BTNS_FN 3 
#define AID_PILOT_MFD_RIGHT_BTNS_SYS 4
aND NOW BACK TO 3
Code:
#pragma once  
#define AID_FIRST_ID 0  
#define AID_PILOT_MFD_LEFT_BTNS_FN  1 
#define AID_PILOT_MFD_LEFT_BTNS_SYS 2 
#define  AID_PILOT_MFD_RIGHT_BTNS_FN 3 
#define AID_PILOT_MFD_RIGHT_BTNS_SYS 4 
#define AID_PILOT_MFD_CENTER_BTNS_FN 5
#define AID_PILOT_MFD_CENTER_BTNS_SYS 6
 
Last edited:
Yes. the SYS (pwr,sel, mnu) work for the Center

I am away from the pc that runs that. But I see your point being the aid=5. But it wouldn't break when I press the mouse in the FN area of the center

---------- Post added at 04:07 PM ---------- Previous post was at 07:32 AM ----------

Code:
#pragma once

#define AID_FIRST_ID 0

#define AID_PILOT_MFD_LEFT_BTNS_FN 1
#define AID_PILOT_MFD_LEFT_BTNS_SYS 2
#define AID_PILOT_MFD_CENTER_BTNS_FN 3
#define AID_PILOT_MFD_CENTER_BTNS_SYS 4
#define AID_PILOT_MFD_RIGHT_BTNS_FN 5
#define AID_PILOT_MFD_RIGHT_BTNS_SYS 6

No break for AID_PILOT_MFD_CENTER_BTNS_SYS
 
Last edited:
Just for clarification - what behavior do you expect now?

Not sure what you mean?

I get a break on everything but on case AID_PILOT_MFD_CENTER_BTNS_FN:


Code:
bool ClassicMfd::HandleMouseEvent(int const aid, int const event, VECTOR3 const &p)
{
	switch (aid) {
	case AID_PILOT_MFD_LEFT_BTNS_FN:
		return ProcessMfdFnButton(PILOT_MFD_LEFT, event, p);
	case AID_PILOT_MFD_LEFT_BTNS_SYS:
		return ProcessMfdSysButton(PILOT_MFD_LEFT, event, p);

	case AID_PILOT_MFD_CENTER_BTNS_FN:
		return ProcessMfdFnButton(PILOT_MFD_CENTER, event, p);
	case AID_PILOT_MFD_CENTER_BTNS_SYS:
		return ProcessMfdSysButton(PILOT_MFD_CENTER, event, p);

	case AID_PILOT_MFD_RIGHT_BTNS_FN:
		return ProcessMfdFnButton(PILOT_MFD_RIGHT, event, p);
	case AID_PILOT_MFD_RIGHT_BTNS_SYS:
		return ProcessMfdSysButton(PILOT_MFD_RIGHT, event, p);

	

	}

	return false;
}

Code:
DefineMfdButtons(
		TEX_TALON_VCNEW_MFD_DYNAMIC_05,
		AID_PILOT_MFD_CENTER_BTNS_FN, GRP_TALON_VCNEW_PILOT_CENTER_MFD_BTNS_FN, buttonFnRect[PILOT_MFD_CENTER],
		AID_PILOT_MFD_CENTER_BTNS_SYS, GRP_TALON_VCNEW_PILOT_CENTER_MFD_BTNS_SYS
		);


So not sure why when I click the button with the mouse over Center Fn buttons nothing happens.

Both right and left are good

In non vc mode the right mfd works fine;

#define PILOT_MFD_LEFT (MFD_LEFT)
#define PILOT_MFD_RIGHT (MFD_USER1)
#define PILOT_MFD_CENTER (MFD_RIGHT)
:

---------- Post added 04-29-17 at 06:53 AM ---------- Previous post was 04-28-17 at 06:45 PM ----------

Well I went back 2 mfd. Left and Center. And got it to work. I copied the mesh groups for the right one and renamed.

Now all MFd work:) The only issue is the labels of the Center are painted on the right also.
if I use this code. Only the first mfd labels are painted.

But the buttons work.

Code:
void ClassicMfd::RedrawMFDButtons(SURFHANDLE const surf, int const mfd)
{
	int const btnWidth = buttonFnDim->width;
	int const btnHeight = buttonFnDim->height;
//	RECT const draw_area = _R(0, 0, buttonFnRect[mfd].right - buttonFnRect[mfd].left, buttonFnRect[mfd].bottom - buttonFnRect[mfd].top);
	const RECT &draw_area = buttonFnRect[mfd];
	HDC const hDC = oapiGetDC(surf);

	SelectObject(hDC, buttonBrush);
	SetBkMode(hDC, OPAQUE);
	Rectangle(hDC, draw_area.left, draw_area.top, draw_area.right, draw_area.bottom);

	HFONT pFont = (HFONT)SelectObject(hDC, labelFont);
	SetTextColor(hDC, labelColor);
	SetTextAlign(hDC, TA_CENTER);
	int const half_font_height = get_font_height(hDC) / 2;

	char const * label;
	int const label_x_offset = (btnWidth / 2);
	int const label_y_offset = (btnHeight / 2) - buttonFnDim->marginHeight - half_font_height;
	for (int i = 0; i < 12; i++) {
		int const x = i / 6;
		int const y = i % 6;
		if (label = oapiMFDButtonLabel(mfd, i)) {
			int const xwidth = (x * btnWidth);
			int const yheight = (y * btnHeight);

			SelectObject(hDC, buttonLabelBrush);
			SetBkMode(hDC, OPAQUE);
			Rectangle(hDC,
				draw_area.left + xwidth + buttonFnDim->marginWidth,
				draw_area.top + yheight + buttonFnDim->marginHeight,
				draw_area.left + xwidth + btnWidth - buttonFnDim->marginWidth,
				draw_area.top + yheight + btnHeight - buttonFnDim->marginHeight
				);
			SetBkMode(hDC, TRANSPARENT);
			TextOut(hDC, draw_area.left + xwidth + label_x_offset, draw_area.top + yheight + label_y_offset, label, strlen(label));
		}
		else break;
	}

	SelectObject(hDC, pFont);
	oapiReleaseDC(surf, hDC);
}
 
Last edited:
AFGhYfq.jpg


So only 1 mfd has button labels?
Code:
void ClassicMfd::RedrawMFDButtons(SURFHANDLE const surf, int const mfd)
{
	int const btnWidth = buttonFnDim->width;
	int const btnHeight = buttonFnDim->height;
//	RECT const draw_area = _R(buttonFnRect[mfd].right - buttonFnRect[mfd].left, buttonFnRect[mfd].bottom - buttonFnRect[mfd].top);(SURFHANDLE surf, int mfd, int side)
	const RECT &draw_area = buttonFnRect[mfd];
	HDC const hDC = oapiGetDC(surf);

	SelectObject(hDC, buttonBrush);
	SetBkMode(hDC, OPAQUE);
	Rectangle(hDC, draw_area.left, draw_area.top, draw_area.right, draw_area.bottom);

	HFONT pFont = (HFONT)SelectObject(hDC, labelFont);
	SetTextColor(hDC, labelColor);
	SetTextAlign(hDC, TA_CENTER);
	int const half_font_height = get_font_height(hDC) / 2;

	char const * label;
	int const label_x_offset = (btnWidth / 2);
	int const label_y_offset = (btnHeight / 2) - buttonFnDim->marginHeight - half_font_height;
	for (int i = 0; i < 12; i++) {
		int const x = i / 6;
		int const y = i % 6;
		if (label = oapiMFDButtonLabel(mfd, i)) {
			int const xwidth = (x * btnWidth);
			int const yheight = (y * btnHeight);

			SelectObject(hDC, buttonLabelBrush);
			SetBkMode(hDC, OPAQUE);
			Rectangle(hDC,
				draw_area.left + xwidth + buttonFnDim->marginWidth,
				draw_area.top + yheight + buttonFnDim->marginHeight,
				draw_area.left + xwidth + btnWidth - buttonFnDim->marginWidth,
				draw_area.top + yheight + btnHeight - buttonFnDim->marginHeight
				);
			SetBkMode(hDC, TRANSPARENT);
			TextOut(hDC, draw_area.left + xwidth + label_x_offset, draw_area.top + yheight + label_y_offset, label, strlen(label));
		}
		else break;
	}

	SelectObject(hDC, pFont);
	oapiReleaseDC(surf, hDC);
	
	

}
Code:
static DIMENSION const MFD_BUTTONS_FN_DIM = _D(50, 28, 2, 2);
static RECT const MFD_BUTTONS_FN_RECT[] = { _R(000, 000, 100, 168), _R(100, 000, 200, 168), _R(200, 000, 300, 168) };
 
Well I finally got the 3 mfd working. Thanks for all the help

Now NAv buttons. For me it is easier just to do a mesh group of a lit/unlit button and move the button based on the nav state.

BUT from the VC view how can I tell the mouse where I am and then which button?

I and not sure if just make a texture like the green outline. And then define a rectangle red box and dines that as a vc mouse area divide the x by 7?

ZDCyW50.jpg

0SNSY2L.jpg
 
Thanks. Yes I was looking at that. I think then I need to make a texture maybe just a blank with the background where the nav button mesh groups would go.

Then detect the mouse in that area, right?
 
ok. No CTD but no break either.
Code:
	void TALON::RedrawPanel_Navmode(SURFHANDLE surf)
	{
		for (DWORD i = NAVMODE_KILLROT; i < NAVMODE_HOLDALT; i++)
		if (GetNavmodeState(i))
			oapiBlt(surf, srf[0], (6 - i) * 44, 0, (i - 1) * 42, 0, 42, 31);
	}
	void TALON::InitPanel(int panel)
	{
		int i;

		switch (panel) {

		case 0:

			srf[0] = oapiCreateSurface(LOADBMP(IDB_BITMAP3));


			break;

		}
	}
Code:
bool TALON::clbkVCRedrawEvent(int id, int event, SURFHANDLE surf) {
		bool result = false;
		result = result || mfdController->HandleRedrawEvent(id, event, surf);


		result = result || VCRedrawEvent(id, event, surf);

		//case AID_NAVMODE:
		//	result = result || RedrawPanel_Navmode(surf);
		//	return true;
			{

				switch (id) {
				case AID_NAVMODE:
					RedrawPanel_Navmode(surf);
					//sprintf(oapiDebugString(), "Fuel %f", fuel_percent);
					return true;

				}
				//	return false;



			}
			return result;
	}


Looking at the ShuttleA. I am wondering if I just need a small black panel behind the buttons rather than a bigger texture switch I adjust to fit that area.

Not sure how the mouse to do something if I click on that area.

Looking at all this panel stuff is it the same for 3d/2d.
 
oh. I thought so.
I have this:
Code:
bool TALON::clbkLoadVC(int id) { // ID is the Preset Camera Position
	huds.size = 0.3;
	huds.nmesh = 2;

	mfdController->HandleLoadVC(id);
	oapiVCRegisterHUD(&huds);
	SURFHANDLE const tex1 = oapiGetTextureHandle(meshhg_VC, 8);

	
	switch (id) {
	case 0: // commander position
		SetCameraOffset(_V(-0.41, 1.6, 2.241));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.2), 0, 0, _V(-0.3, 0, 0), 75 * RAD, -5 * RAD, _V(0.3, 0, 0), -20 * RAD, -27 * RAD);
		oapiVCSetNeighbours(-1, 1, -1, 2);

		
		break;
	case 1: // pilot position
		SetCameraOffset(_V(0.41, 1.6, 2.241));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.3), 0, 0, _V(-0.3, 0, 0), 20 * RAD, -27 * RAD, _V(0.3, 0, 0), -75 * RAD, -5 * RAD);
		oapiVCSetNeighbours(0, -1, -1, 2);

		
		break;
	case 2: // pilot position
		SetCameraOffset(_V(0, 1.7, 2.21));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.3), 0, 0, _V(-0.3, 0, 0), 20 * RAD, -27 * RAD, _V(0.3, 0, 0), -75 * RAD, -5 * RAD);
		oapiVCSetNeighbours(0, -1, -1, 2);


		break;
		//tex1 = oapiGetTextureHandle(vcmesh_tpl, 12); //navmode tex
		oapiVCRegisterArea(AID_NAVMODE, _R(0, 0, 128, 128), PANEL_REDRAW_MOUSE | PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN, PANEL_MAP_BACKGROUND, tex1);
		oapiVCSetAreaClickmode_Quadrilateral(AID_NAVMODE,
			_V(-.1462004f,  1.51039f, 2.844f),//2.822
			_V(.1471258f,  1.509298f, 2.844f),
			_V(-.1440155f,  1.492364f, 2.844f),
			_V(.1465795f,  1.490726f, 2.844f));

	}

	return HandleLoadVC(id);

}

But I get no break in the
AID_NAVMODE

---------- Post added at 05:11 PM ---------- Previous post was at 04:59 PM ----------

textures in vc:
TEXTURES 9
TALON/alu.dds
TALON/darkgrey.dds
DG/DG_VC1.dds
TALON/Screen.dds
TALON/MFDBLACK.dds
TALON/mfd_dynamic_05.dds
TALON/talonvc.dds
TALON/ENDURANCENAVBUTTONSnew.dds
TALON/TALONNAV.dds

---------- Post added at 05:19 PM ---------- Previous post was at 05:11 PM ----------

Code:
bool TALON::clbkLoadGenericCockpit() {
	return true;
}

bool TALON::clbkLoadVC(int id) { // ID is the Preset Camera Position
	huds.size = 0.3;
	huds.nmesh = 2;

	mfdController->HandleLoadVC(id);
	oapiVCRegisterHUD(&huds);
	SURFHANDLE const tex1 = oapiGetTextureHandle(meshhg_VC, 9);

	
	switch (id) {
	case 0: // commander position
		SetCameraOffset(_V(-0.41, 1.6, 2.241));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.2), 0, 0, _V(-0.3, 0, 0), 75 * RAD, -5 * RAD, _V(0.3, 0, 0), -20 * RAD, -27 * RAD);
		oapiVCSetNeighbours(-1, 1, -1, 2);

		
		break;
	case 1: // pilot position
		SetCameraOffset(_V(0.41, 1.6, 2.241));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.3), 0, 0, _V(-0.3, 0, 0), 20 * RAD, -27 * RAD, _V(0.3, 0, 0), -75 * RAD, -5 * RAD);
		oapiVCSetNeighbours(0, -1, -1, 2);

		
		break;
	case 2: // pilot position
		SetCameraOffset(_V(0, 1.7, 2.21));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.3), 0, 0, _V(-0.3, 0, 0), 20 * RAD, -27 * RAD, _V(0.3, 0, 0), -75 * RAD, -5 * RAD);
		oapiVCSetNeighbours(0, -1, -1, 2);


		break;
		//tex1 = oapiGetTextureHandle(vcmesh_tpl, 12); //navmode tex
		oapiVCRegisterArea(AID_NAVMODE, _R(0, 0, 128, 128), PANEL_REDRAW_MOUSE | PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN, PANEL_MAP_BACKGROUND, tex1);
		oapiVCSetAreaClickmode_Quadrilateral(AID_NAVMODE,
			_V(-.1462004f,  1.51039f, 2.844f),//2.822
			_V(.1471258f,  1.509298f, 2.844f),
			_V(-.1440155f,  1.492364f, 2.844f),
			_V(.1465795f,  1.490726f, 2.844f));

	}

	return HandleLoadVC(id);

}

bool TALON::HandleLoadVC(UINT const id)
{



	return true;
}

	bool TALON::clbkVCMouseEvent(int id, int event, VECTOR3 &p)
	{
		bool result = false;
		result = result || mfdController->HandleMouseEvent(id, event, p);
		result = result || VCMouseEvent(id, event, p);
		return result;
	}

	bool TALON::VCMouseEvent(int const id, int const event, VECTOR3& const p)
	{
		static int ctrl = 3;
		switch (id) {
		case AID_NAVMODE:
			ctrl = (int)(p.x*262.0f);
			if ((ctrl % 44) < 42) {
				ToggleNavmode(6 - ctrl / 44);
				//	oapiTriggerPanelRedrawArea (0, AID_NAVMODE);
				return true;
			}
			break;
		}
		return false; // We must return false, as we didn't processed the event!
	}



	bool TALON::clbkVCRedrawEvent(int id, int event, SURFHANDLE surf) {
		bool result = false;
		result = result || mfdController->HandleRedrawEvent(id, event, surf);


		result = result || VCRedrawEvent(id, event, surf);

		//case AID_NAVMODE:
		//	result = result || RedrawPanel_Navmode(surf);
		//	return true;
		//	{

		//		switch (id) {
		//		case AID_NAVMODE:
		//			RedrawPanel_Navmode(surf);
					//sprintf(oapiDebugString(), "Fuel %f", fuel_percent);
		//			return true;

		//		}
				//	return false;



			//}
			return result;
	}

	bool TALON::VCRedrawEvent(int const id, int const event, SURFHANDLE const surf) {
		return false;
	}
 
Maybe you have to move the code?



Code:
bool TALON::clbkLoadVC(int id) { // ID is the Preset Camera Position
	huds.size = 0.3;
	huds.nmesh = 2;

	mfdController->HandleLoadVC(id);
	oapiVCRegisterHUD(&huds);
	SURFHANDLE const tex1 = oapiGetTextureHandle(meshhg_VC, 8);

	
	switch (id) {
	case 0: // commander position
		SetCameraOffset(_V(-0.41, 1.6, 2.241));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.2), 0, 0, _V(-0.3, 0, 0), 75 * RAD, -5 * RAD, _V(0.3, 0, 0), -20 * RAD, -27 * RAD);
		oapiVCSetNeighbours(-1, 1, -1, 2);

        oapiVCRegisterArea(AID_NAVMODE, _R(0, 0, 128, 128), PANEL_REDRAW_MOUSE | PANEL_REDRAW_USER, 
        PANEL_MOUSE_LBDOWN, PANEL_MAP_BACKGROUND, tex1);
		oapiVCSetAreaClickmode_Quadrilateral(AID_NAVMODE,
			_V(-.1462004f,  1.51039f, 2.844f),//2.822
			_V(.1471258f,  1.509298f, 2.844f),
			_V(-.1440155f,  1.492364f, 2.844f),
			_V(.1465795f,  1.490726f, 2.844f));

break;
 
Redid the code.

I get a break when I mouse click on mfd but not in the nav area?
Code:
bool TALON::clbkLoadGenericCockpit() {
	return true;
}

bool TALON::clbkLoadVC(int id) { // ID is the Preset Camera Position
	huds.size = 0.3;
	huds.nmesh = 2;

	mfdController->HandleLoadVC(id);
	oapiVCRegisterHUD(&huds);
	SURFHANDLE const tex1 = oapiGetTextureHandle(meshhg_VC, 5);

	
//	switch (id) {
//	case 0: // commander position
		SetCameraOffset(_V(-0.41, 1.6, 2.241));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.2), 0, 0, _V(-0.3, 0, 0), 75 * RAD, -5 * RAD, _V(0.3, 0, 0), -20 * RAD, -27 * RAD);
		oapiVCSetNeighbours(-1, 1, -1, 2);

		

		//tex1 = oapiGetTextureHandle(vcmesh_tpl, 12); //navmode tex
		oapiVCRegisterArea(AID_NAVMODE, _R(0, 0, 128, 128), PANEL_REDRAW_MOUSE | PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN, PANEL_MAP_BACKGROUND, tex1);
		oapiVCSetAreaClickmode_Quadrilateral(AID_NAVMODE,
			_V(-.1462004f,  1.51039f, 2.844f),//2.822
			_V(.1471258f,  1.509298f, 2.844f),
			_V(-.1440155f,  1.492364f, 2.844f),
			_V(.1465795f,  1.490726f, 2.844f));

	//}

	return HandleLoadVC(id);

}

bool TALON::HandleLoadVC(UINT const id)
{



	return true;
}

bool TALON::clbkVCMouseEvent(int id, int event, VECTOR3 &p)
	{
//bool TALON::VCMouseEvent(int const id, int const event, VECTOR3& const p)
//{
		bool result = false;
		result = result || mfdController->HandleMouseEvent(id, event, p);
		result = result || VCMouseEvent(id, event, p);
		return result;
	}

	bool TALON::VCMouseEvent(int const id, int const event, VECTOR3& const p)
	{
		static int ctrl = 3;
		switch (id) {
		case AID_NAVMODE:
			ctrl = (int)(p.x*262.0f);
			if ((ctrl % 44) < 42) {
				ToggleNavmode(6 - ctrl / 44);
				//	oapiTriggerPanelRedrawArea (0, AID_NAVMODE);
				return true;
			}
			break;
		}
		return false; // We must return false, as we didn't processed the event!
	}



	bool TALON::clbkVCRedrawEvent(int id, int event, SURFHANDLE surf) {
		bool result = false;
		result = result || mfdController->HandleRedrawEvent(id, event, surf);


		result = result || VCRedrawEvent(id, event, surf);

	
			return result;
	}

	bool TALON::VCRedrawEvent(int const id, int const event, SURFHANDLE const surf) {
		return false;
	}

	void TALON::clbkMFDMode(int mfd, int mode)
	{
		mfdController->HandleMFDMode(mfd, mode);
	}
Code:
TALON/alu.dds
TALON/darkgrey.dds
DG/DG_VC1.dds
TALON/Screen.dds
TALON/MFDBLACK.dds  // background for nav buttons
TALON/mfd_dynamic_05.dds
TALON/talonvc.dds
TALON/ENDURANCENAVBUTTONSnew.dds

W5GCW2I.jpg


---------- Post added at 03:54 PM ---------- Previous post was at 05:44 AM ----------

Not sure why mouse click is not being detected.
Code:
bool TALON::clbkLoadVC(int id) { // ID is the Preset Camera Position
	huds.size = 0.3;
	huds.nmesh = 2;

	mfdController->HandleLoadVC(id);
	oapiVCRegisterHUD(&huds);
	SURFHANDLE const tex1 = oapiGetTextureHandle(meshhg_VC, 5);

	
//	switch (id) {
//	case 0: // commander position
		SetCameraOffset(_V(-0.41, 1.6, 2.241));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.2), 0, 0, _V(-0.3, 0, 0), 75 * RAD, -5 * RAD, _V(0.3, 0, 0), -20 * RAD, -27 * RAD);
		oapiVCSetNeighbours(-1, 1, -1, 2);

		

		//tex1 = oapiGetTextureHandle(vcmesh_tpl, 12); //navmode tex
		oapiVCRegisterArea(AID_NAVMODE, _R(0, 0, 128, 128), PANEL_REDRAW_MOUSE | PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN, PANEL_MAP_BACKGROUND, tex1);
		oapiVCSetAreaClickmode_Quadrilateral(AID_NAVMODE,
			_V(-.1462004f,  1.51039f, 2.844f),//2.822
			_V(.1471258f,  1.509298f, 2.844f),
			_V(-.1440155f,  1.492364f, 2.844f),
			_V(.1465795f,  1.490726f, 2.844f));

	//}

	return HandleLoadVC(id);

}

The coordinates are the corners of the mesh that is the background for the buttons

Code:
bool ClassicMfd::HandleMouseEvent(int const aid, int const event, VECTOR3 const &p)
{
	switch (aid) {
	case AID_PILOT_MFD_LEFT_BTNS_FN:
		return ProcessMfdFnButton(PILOT_MFD_LEFT, event, p);
	case AID_PILOT_MFD_LEFT_BTNS_SYS:
		return ProcessMfdSysButton(PILOT_MFD_LEFT, event, p);

	case AID_PILOT_MFD_CENTER_BTNS_FN:
		return ProcessMfdFnButton(PILOT_MFD_CENTER, event, p);
	case AID_PILOT_MFD_CENTER_BTNS_SYS:
		return ProcessMfdSysButton(PILOT_MFD_CENTER, event, p);

//	case AID_PILOT_MFD_CENTER_BTNS_FN:
//	    return ProcessMfdFnButton(PILOT_MFD_RIGHT, event, p);
//	case AID_PILOT_MFD_RIGHT_BTNS_SYS:
//		return ProcessMfdSysButton(PILOT_MFD_RIGHT, event, p);

	case AID_PILOT_MFD_RIGHT_BTNS_FN:
		return ProcessMfdFnButton(PILOT_MFD_RIGHT, event, p);
	case AID_PILOT_MFD_RIGHT_BTNS_SYS:
		return ProcessMfdSysButton(PILOT_MFD_RIGHT, event, p);
	case AID_NAVMODE:
		return ProcessMfdSysButton(PILOT_MFD_RIGHT, event, p);
	}

	return false;
}
 
Try it like this, just KILLROT...

Code:
bool TALON::clbkLoadVC(int id) { // ID is the Preset Camera Position
	huds.size = 0.3;
	huds.nmesh = 2;

	mfdController->HandleLoadVC(id);
	oapiVCRegisterHUD(&huds);
	SURFHANDLE const tex1 = oapiGetTextureHandle(meshhg_VC, 5);

	
//	switch (id) {
//	case 0: // commander position
		SetCameraOffset(_V(-0.41, 1.6, 2.241));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.2), 0, 0, _V(-0.3, 0, 0), 75 * RAD, -5 * RAD, _V(0.3, 0, 0), -20 * RAD, -27 * RAD);
		oapiVCSetNeighbours(-1, 1, -1, 2);

		

		oapiVCRegisterArea (AID_NAVMODE, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN);
		oapiVCSetAreaClickmode_Quadrilateral (AID_NAVMODE,
			_V(-.1462004f,  1.51039f, 2.844f),//2.822
			_V(.1471258f,  1.509298f, 2.844f),
			_V(-.1440155f,  1.492364f, 2.844f),
			_V(.1465795f,  1.490726f, 2.844f));

	//}

	//return HandleLoadVC(id);

          }
	
		return true;

}

Code:
bool TALON::clbkVCMouseEvent (int id, int event, VECTOR3 &p)
{
	
	switch (id) {


case AID_NAVMODE:
		ToggleNavmode (NAVMODE_KILLROT);
		return true;

       }
	return false;
}
 
Back
Top