예제 #1
0
bool PMainGimbalDisp::RedrawVC (DEVMESHHANDLE hMesh, SURFHANDLE surf)
{
	Scout *dg = (Scout*)vessel;
	oapiBlt (surf, dg->srf[8], 0, dg->mpgimbalidx[0], 0, 0, 6, 7, SURF_PREDEF_CK);
	oapiBlt (surf, dg->srf[8], 7, dg->mpgimbalidx[1], 6, 0, 6, 7, SURF_PREDEF_CK);
	return true;
}
예제 #2
0
void EventTimer::Render(SURFHANDLE surf, SURFHANDLE digits)

{
	//
	// Digits are 13x18.
	//

	int Curdigit, Curdigit2;

	// Minute display on two digit
	Curdigit = minutes / 10;
	Curdigit2 = minutes / 100;
	oapiBlt(surf, digits, 0, 0, 13 * (Curdigit-(Curdigit2*10)), 0, 13, 18);

	Curdigit = minutes;
	Curdigit2 = minutes / 10;
	oapiBlt(surf, digits, 13, 0, 13 * (Curdigit-(Curdigit2*10)), 0, 13, 18);

	// second display on two digit
	Curdigit = seconds / 10;
	Curdigit2 = seconds / 100;
	oapiBlt(surf, digits, 45, 0, 13 * (Curdigit-(Curdigit2*10)), 0, 13, 18);

	Curdigit = seconds;
	Curdigit2 = seconds/10;
	oapiBlt(surf, digits, 58, 0, 13 * (Curdigit-(Curdigit2*10)), 0, 13, 18);
}
예제 #3
0
void LEMEventTimer::Render(SURFHANDLE surf, SURFHANDLE digits)

{
	// Don't do this if not powered.
	if (!IsPowered())
		return;

	//
	// Digits are 16x19.
	//

	int Curdigit, Curdigit2;

	// Minute display on two digit
	Curdigit = minutes / 10;
	Curdigit2 = minutes / 100;
	oapiBlt(surf, digits, 0, 0, 19 * (Curdigit-(Curdigit2*10)), 0, 19,21);

	Curdigit = minutes;
	Curdigit2 = minutes / 10;
	oapiBlt(surf, digits, 20, 0, 19 * (Curdigit-(Curdigit2*10)), 0, 19,21);

	//oapiBlt(surf, digits, 37,0, 192,0,4,19);

	// second display on two digit
	Curdigit = seconds / 10;
	Curdigit2 = seconds / 100;
	oapiBlt(surf, digits, 43, 0, 19 * (Curdigit-(Curdigit2*10)), 0, 19,21);

	Curdigit = seconds;
	Curdigit2 = seconds/10;
	oapiBlt(surf, digits, 62, 0, 19 * (Curdigit-(Curdigit2*10)), 0, 19,21);
}
예제 #4
0
파일: dsky.cpp 프로젝트: dseagrav/NASSP
void DSKY::DSKYKeyBlt(SURFHANDLE surf, SURFHANDLE keys, int dstx, int dsty, int srcx, int srcy, bool lit, int xOffset, int yOffset) 

{
	if (lit) {
		oapiBlt(surf, keys, dstx + xOffset, dsty + yOffset, srcx, srcy, 38, 37);
	}
	else {
		oapiBlt(surf, keys, dstx + xOffset, dsty + yOffset, srcx, srcy + 120, 38, 37);
	}
}
예제 #5
0
파일: dsky.cpp 프로젝트: dseagrav/NASSP
void DSKY::DSKYLightBlt(SURFHANDLE surf, SURFHANDLE lights, int dstx, int dsty, bool lit, int xOffset, int yOffset)

{
	if (lit) {
		oapiBlt(surf, lights, dstx + xOffset, dsty + yOffset, dstx + 101, dsty + 0, 49, 23);
	}
	else {
		oapiBlt(surf, lights, dstx + xOffset, dsty + yOffset, dstx + 0, dsty + 0, 49, 23);
	}
}
예제 #6
0
void LMCabinCO2Meter::DoDrawSwitch(double v, SURFHANDLE drawSurface)

{
	double cf,sf; // Correction Factor, Scale factor
	int btm;      // Bottom of this segment
	// Determine needle range and scale factor
	if(v <= 5){
		btm = 114;
		sf = 8.0;
		cf = 0;
	}else{
		if(v <= 10){
			btm = 74;
			cf = 5;
			sf = 4.0;
		}else{
			if(v <= 15){
				btm = 54;
				cf = 10;
				sf = 3.0;
			}else{
				if(v <= 20){
					btm = 39;
					cf = 15;
					sf = 2;
				}else{
					btm = 29;
					cf = 20;
					sf = 1.5;
				}
			}
		}
	}
	oapiBlt(drawSurface, NeedleSurface,  267, btm-((int)((v-cf)*sf)), 7, 0, 7, 7, SURF_PREDEF_CK);
}
예제 #7
0
void LEMDCAmMeter::DoDrawSwitch(double v, SURFHANDLE drawSurface){
	// 100A = 90 deg and 20A = 270 deg
	// 180 degress of sweep across 80 amps, for 2.25 degrees per amp
	
	v = 220-(v*2.25);
	DrawNeedle(drawSurface, 49, 49, 25.0, v * RAD);
	oapiBlt(drawSurface, FrameSurface, 0, 0, 0, 0, 99, 98, SURF_PREDEF_CK);
}
예제 #8
0
파일: dsky.cpp 프로젝트: dseagrav/NASSP
void DSKY::RenderData(SURFHANDLE surf, SURFHANDLE digits, SURFHANDLE disp, int xOffset, int yOffset)

{
	if (!IsPowered())
		return;

	oapiBlt(surf, disp, 66 + xOffset,   3 + yOffset, 35,  0, 35, 10, SURF_PREDEF_CK);
	oapiBlt(surf, disp, 66 + xOffset,  38 + yOffset, 35, 10, 35, 10, SURF_PREDEF_CK);
	oapiBlt(surf, disp,  6 + xOffset,  38 + yOffset, 35, 20, 35, 10, SURF_PREDEF_CK);

	oapiBlt(surf, disp,  8 + xOffset,  73 + yOffset,  0, 32, 89,  4, SURF_PREDEF_CK);
	oapiBlt(surf, disp,  8 + xOffset, 107 + yOffset,  0, 32, 89,  4, SURF_PREDEF_CK);
	oapiBlt(surf, disp,  8 + xOffset, 141 + yOffset,  0, 32, 89,  4, SURF_PREDEF_CK);

	if (CompActy) {
		//
		// Do stuff to update Comp Acty light.
		//

		oapiBlt(surf, disp,  6 + xOffset,   4 + yOffset,  0,  0, 35, 31, SURF_PREDEF_CK);
	}

	RenderTwoDigitDisplay(surf, digits, 67 + xOffset, 16 + yOffset, Prog, false);
	RenderTwoDigitDisplay(surf, digits,  8 + xOffset, 51 + yOffset, Verb, VerbFlashing);
	RenderTwoDigitDisplay(surf, digits, 67 + xOffset, 51 + yOffset, Noun, NounFlashing);

	//
	// Register contents.
	//

	RenderSixDigitDisplay(surf, digits, 3 + xOffset, 83 + yOffset, R1);
	RenderSixDigitDisplay(surf, digits, 3 + xOffset, 117 + yOffset, R2);
	RenderSixDigitDisplay(surf, digits, 3 + xOffset, 151 + yOffset, R3);
}
예제 #9
0
void LEMDCVoltMeter::DoDrawSwitch(double v, SURFHANDLE drawSurface){
	// 40V = -35 deg and 20V = 215 deg
	// 250 degrees of sweep across 20 volts, for 12.5 degrees per volt

	// 20V = 180+35	
	v = 240-((v-18)*12.5);
	DrawNeedle(drawSurface, 49, 49, 25.0, v * RAD);
	oapiBlt(drawSurface, FrameSurface, 0, 0, 0, 0, 99, 98, SURF_PREDEF_CK);
}
예제 #10
0
파일: dsky.cpp 프로젝트: dseagrav/NASSP
void DSKY::RenderTwoDigitDisplay(SURFHANDLE surf, SURFHANDLE digits, int dstx, int dsty, char *Str, bool Flash)

{
	int Curdigit;

	if (Flash && !FlashOn)
		return;

	if (Str[0] >= '0' && Str[0] <= '9') {
		Curdigit = Str[0] - '0';
		oapiBlt(surf,digits,dstx,dsty,16*Curdigit,0,16,19);
	}

	if (Str[1] >= '0' && Str[1] <= '9') {
		Curdigit = Str[1] - '0';
		oapiBlt(surf,digits,dstx+16,dsty,16*Curdigit,0,16,19);
	}
}
예제 #11
0
void GUI_ScrollBar::DrawMe(SURFHANDLE _tgt, int xoffset, int yoffset, RECT &drawablerect)
{
	BLITDATA blitdata;
	calculateBlitData(xoffset + rect.left, yoffset + rect.top, drawablerect, blitdata);

	//width or height == 0 indicates that the element is completely outside its
	//parents rect, so no need to draw.
	if (blitdata.width > 0 && blitdata.height > 0)
	{
		oapiBlt(_tgt, src, &blitdata.tgtrect, &blitdata.srcrect, SURF_PREDEF_CK);
	}
}
예제 #12
0
bool MfdButtonCol::Redraw2D (SURFHANDLE surf)
{
	int btn, x, /*y,*/ len, i, w;
	const char *label;

	for (btn = 0; btn < nbtn; btn++)
		oapiBlt (surf, surf, xcnt-14, lbly[btn], 773, 22, 28, CHH); // blank label

	for (btn = 0; btn < 6; btn++) {
		if (label = oapiMFDButtonLabel (subsys->MfdId(), btn+sd*6)) {
			len = strlen(label);
			for (w = i = 0; i < len; i++) w += CHW[label[i]];
			for (i = 0, x = xcnt-w/2; i < len; i++) {
				w = CHW[label[i]];
				if (w) {
					oapiBlt (surf, surf, x, lbly[btn], CHX[label[i]], CHY, w, CHH);
					x += w;
				}
			}
		} else break;
	}
    return false;
}
예제 #13
0
파일: dsky.cpp 프로젝트: dseagrav/NASSP
void DSKY::RenderSixDigitDisplay(SURFHANDLE surf, SURFHANDLE digits, int dstx, int dsty, char *Str)

{
	int	Curdigit;
	int i;

	if (Str[0] == '-') {
		oapiBlt(surf,digits,dstx,dsty,161,0,10,19);
	}
	else if (Str[0] == '+') {
		oapiBlt(surf,digits,dstx,dsty,174,0,12,19);
	}

	for (i = 1; i < 6; i++) {
		if (Str[i] >= '0' && Str[i] <= '9') {
			Curdigit = Str[i] - '0';
			oapiBlt(surf, digits, dstx + (16*i), dsty, 16*Curdigit, 0, 16,19);
		}
		else {
//			oapiBlt(surf, digits, dstx + (10*i), dsty, 440, 6, 10, 15);
		}
	}
}
예제 #14
0
파일: adictrl.cpp 프로젝트: Artoria2e5/obtr
void ADICtrl::DispAngle (SURFHANDLE surf, double angle, int x, int y, char curstr[3])
{
	char cbuf[64];
	int i, w, iangle = (int)(angle * DEG + 0.5);
	sprintf (cbuf, "%03d", iangle);
	x += dsp_x0;
	y += dsp_y0;
	for (i = 0; i < 3; i++) {
		w = small_font_width[cbuf[i]];
		if (!curstr || cbuf[i] != curstr[i]) {
			oapiBlt (surf, surf, x, y, small_font_xpos[cbuf[i]], small_font_ypos[0], w, small_font_height);
			curstr[i] = cbuf[i];
		}
		x += w;
	}
}
예제 #15
0
GUI_ElementResource *GUI_ListBox::createResources()
{
	assert(src == NULL && "Release old resource before creating it again!");

	SURFHANDLE tgt = GUI_Draw::createElementBackground(style, width, height);
	Sketchpad *skp = oapiGetSketchpad(tgt);
	GUI_Draw::DrawRectangle(_R(0, 0, width, height), skp, style);
	oapiReleaseSketchpad(skp);

	//copy scrollbar to this surface
	//oapiBlt(tgt, scrollbar->GetSurface(), width - scrlBarWidth, 0, 0, 0, scrlBarWidth, height);
	RECT tgtrect = _R(width - scrlBarWidth, 0, width, height);
	RECT srcrect = _R(0, 0, scrlBarWidth, height);
	SURFHANDLE test = scrollbar->GetSurface();
	oapiBlt(tgt, test, &tgtrect, &srcrect, SURF_PREDEF_CK);

	return new GUI_ElementResource(tgt);
}
예제 #16
0
void GUI_ListBox::Draw(SURFHANDLE surf, RECT &drawablerect, int xoffset, int yoffset)
{

	BLITDATA blitdata;
	calculateBlitData(xoffset + rect.left, yoffset + rect.top, drawablerect, blitdata);

	//width or height == 0 indicates that the element is completely outside its
	//parents rect, so no need to draw.
	if (blitdata.width > 0 && blitdata.height > 0)
	{
		//draw background and frame
		oapiBlt(surf, src, &blitdata.tgtrect, &blitdata.srcrect, SURF_PREDEF_CK);
	}

	//find printable rect (
	RECT printableRect = _R(rect.left + xoffset + style->MarginLeft(), rect.top + yoffset + style->MarginTop(), rect.right + xoffset - scrlBarWidth - style->MarginLeft(), rect.bottom + yoffset - style->MarginBottom());

	//draw entries

	SetSelected(selected);
	int posInDrawList = 0;						//notes the position in the currently visible list as opposed to the entire list


	auto s = cState();

	for (UINT i = scrollbar->GetScrollPos(); i < s->entries.size() && int(i) < scrollbar->GetScrollPos() + nLines; ++i, ++posInDrawList)
	{
		int tgty = printableRect.top + (posInDrawList * (font->GetfHeight() + lineSpace));	
		
		if (!s->noSelect && !s->selectBox && selected == i || s->selectBox && IsHighlight(i)) 
		{
			font->Print(surf, s->entries[i], printableRect.left, tgty, printableRect, true, listJustification);
		}
		else
		{
			font->Print(surf, s->entries[i], printableRect.left, tgty, printableRect, false, listJustification);
		}
	}

}
예제 #17
0
void BltStr (SURFHANDLE tgt, SURFHANDLE src, int x, int y, const char *newstr, char *oldstr, DWORD style)
{
	if (newstr && oldstr && !strcmp (newstr, oldstr)) return; // nothing to do
	int w;
	bool align_right = ((style & ALIGN_RIGHT) > 0);

	if (oldstr) { // erase the old string
		w = 0;
		for (char *c = oldstr; *c; c++) w += small_font_width[*c];
		if (w) oapiColourFill (tgt, 0, (align_right ? x-w:x), y, w, small_font_height);
	}
	if (newstr) { // write new string
		if (align_right)
			for (const char *c = newstr; *c; c++) x -= small_font_width[*c];
		for (const char *c = newstr; *c; c++) {
			w = small_font_width[*c];
			oapiBlt (tgt, src, x, y, small_font_xpos[*c], small_font_ypos[*c <= 90 ? 0:1], w, small_font_height);
			x += w;
		}
	}
	strcpy (oldstr, newstr);
}
예제 #18
0
void MissionTimer::Render(SURFHANDLE surf, SURFHANDLE digits, bool csm)

{
	if (!IsPowered())
		return;

	int Curdigit, Curdigit2;

	// Hour display on three digit
	Curdigit = hours / 100;
	Curdigit2 = hours / 1000;
	oapiBlt(surf, digits, 0,0, 19*(Curdigit-(Curdigit2*10)),0,19,21);

	Curdigit = hours / 10;
	Curdigit2 = hours / 100;
	oapiBlt(surf, digits, 0+20,0, 19*(Curdigit-(Curdigit2*10)),0,19,21);

	Curdigit = hours;
	Curdigit2 = hours / 10;
	oapiBlt(surf, digits,0+39,0, 19*(Curdigit-(Curdigit2*10)),0,19,21);

	// Minute display on two digit
	Curdigit = minutes / 10;
	Curdigit2 = minutes / 100;
	oapiBlt(surf, digits,0+62,0, 19*(Curdigit-(Curdigit2*10)),0,19,21);

	Curdigit = minutes;
	Curdigit2 = minutes / 10;
	oapiBlt(surf, digits,0+81,0, 19*(Curdigit-(Curdigit2*10)),0,19,21);

	// second display on two digit
	Curdigit = seconds / 10;
	Curdigit2 = seconds / 100;
	oapiBlt(surf, digits,0+104,0, 19*(Curdigit-(Curdigit2*10)),0,19,21);

	Curdigit = seconds;
	Curdigit2 = seconds/10;
	oapiBlt(surf, digits,0+123,0, 19*(Curdigit-(Curdigit2*10)),0,19,21);
}
예제 #19
0
void LMRCSBPressInd::DoDrawSwitch(double v, SURFHANDLE drawSurface)

{
	oapiBlt(drawSurface, NeedleSurface,  149, 101-((int)(v*0.22)), 7, 0, 7, 7, SURF_PREDEF_CK);
}
예제 #20
0
파일: InstrVs.cpp 프로젝트: Artoria2e5/obtr
bool InstrVS::Redraw2D (SURFHANDLE surf)
{
	VECTOR3 V;
	double vspd, avspd;
	if (vessel->GetAirspeedVector (FRAME_HORIZON, V)) {
		vspd = V.y*0.1; // unit is 10m
		avspd = fabs(vspd);
	} else {
		vspd = avspd = 0.0;
	}

	static double texw = PANELEL_TEXW, texh = PANELEL_TEXH;
	static double scalecnt = texh-422.0+152.0;
	static int scaleunit = 15;
	static double viewh = 50.0;
	double ycnt, y0, y1, dy, vvspd, ddy;
	char *c, cbuf[12];
	bool centered = (fabs(vspd) <= 4.0);

	dy = vspd-floor(vspd);
	if (centered) {
		ycnt = scalecnt - vspd*scaleunit;
	} else {
		if (vspd > 0.0) ycnt = scalecnt - (5.0+dy)*scaleunit;
		else            ycnt = scalecnt + (5.0-dy)*scaleunit;
	}
	y0 = ycnt-viewh;
	y1 = ycnt+viewh;
	grp->Vtx[0+vtxofs].tv = grp->Vtx[1+vtxofs].tv = (float)(y0/texh);
	grp->Vtx[2+vtxofs].tv = grp->Vtx[3+vtxofs].tv = (float)(y1/texh);

	// copy labels onto scale
	const int labelx = 2;
	int i, j, n, vmin, vmax, iy, len, ysrc;
	int v0 = (int)floor(vspd);
	vmin = v0-3;
	if (vmin != pvmin) {
		pvmin = vmin;
		vmax = vmin+7;
		for (i = vmin; i <= vmax; i++) {
			sprintf (cbuf, "%03d", abs((i%100)*10));
			len = 3; // strlen(cbuf);
			if (centered) {
				if (!i) continue;
				iy = (int)scalecnt-i*scaleunit-5;
			} else {
				if (i > 0) iy = (int)scalecnt-(2+i-vmin)*scaleunit-5;
				else       iy = (int)scalecnt+(8-i+vmin)*scaleunit-5;
			}
			for (j = 0, c = cbuf; j < 3; c++, j++) {
				n = *c-'0';
				ysrc = (int)texh-265+n*8;
				if (i < 0) ysrc += 88;
				oapiBlt (surf, surf, labelx+j*6, iy, label_srcx, ysrc, 6, 8);
			}
		}
	}

	// max VS indicator
	OBJHANDLE hRef = vessel->GetSurfaceRef();
	if (hRef) {
		const double EPS = 1e-10;
		const double G = 6.67259e-11;
		double mu = G*oapiGetMass(hRef);
		ELEMENTS el;
		vessel->GetElements (hRef, el, 0);
		if (el.e == 1.0) el.e += EPS; // hack; what is the maximum radial velocity of a parabolic orbit?
		double vr_max = (el.e == 1.0 ? 0.0 : el.e * sqrt (mu/(el.a*(1.0-el.e*el.e))));

		vr_max *= 0.1;
		float yofs;
		if (vr_max < vspd+4 && vr_max > vspd-4)
			yofs = (float)((vr_max-vspd)*scaleunit*(48.0/50.0));
		else yofs = -60;
		static const float y0[3] = {vtape_ycnt, vtape_ycnt, vtape_ycnt-11};
		for (i = 0; i < 3; i++)
			grp->Vtx[vtxofs+i+12].y = y0[i]-yofs;

		if (-vr_max < vspd+4 && -vr_max > vspd-4)
			yofs = (float)((-vr_max-vspd)*scaleunit*(48.0/50.0));
		else yofs = -60;
		static const float y1[3] = {vtape_ycnt, vtape_ycnt, vtape_ycnt+11};
		for (i = 0; i < 3; i++)
			grp->Vtx[vtxofs+i+15].y = y1[i]-yofs;
	}

	// km/s indicator wheels
	sprintf (cbuf, "%05d", (((int)avspd)%10000)*10);
	for (i = 0; i < 2; i++) {
		float yofs = (float)(texh-111 - (cbuf[i]-'0')*15);
		if (avspd > 50.0) {
			const double scl[2] = {1e3,1e2};
			vvspd = avspd/scl[i];
			ddy = (vvspd-floor(vvspd))*scl[i];
			// number dials in rotation phase
			if (ddy < 0.5) yofs += (float)((0.5-ddy)*15.0);
			else if (ddy > scl[i]-0.5) yofs += (float)((scl[i]-0.5-ddy)*15.0);
		}
		for (j = 0; j < 4; j++) {
			grp->Vtx[4+i*4+vtxofs].tv = grp->Vtx[5+i*4+vtxofs].tv = yofs/(float)texh;
			grp->Vtx[6+i*4+vtxofs].tv = grp->Vtx[7+i*4+vtxofs].tv = (yofs+17.0f)/(float)texh;
		}
	}

	return false;
}
예제 #21
0
void EngineThrustInd::DoDrawSwitch(double v, SURFHANDLE drawSurface)

{	
	oapiBlt(drawSurface, NeedleSurface,  3, 114-((int)v), 0, 0, 7, 7, SURF_PREDEF_CK);
}
예제 #22
0
void MainOxidizerPressInd::DoDrawSwitch(double v, SURFHANDLE drawSurface)

{	
	oapiBlt(drawSurface, NeedleSurface,  240, 115-((int)(v*0.34)), 7, 0, 7, 7, SURF_PREDEF_CK);
}
예제 #23
0
void MainOxidizerTempInd::DoDrawSwitch(double v, SURFHANDLE drawSurface)

{	
	oapiBlt(drawSurface, NeedleSurface,  149, 115-((int)((v-40)*1.7)), 7, 0, 7, 7, SURF_PREDEF_CK);
}
예제 #24
0
void MainFuelPressInd::DoDrawSwitch(double v, SURFHANDLE drawSurface)

{	
	oapiBlt(drawSurface, NeedleSurface,  185, 115-((int)(v*0.34)), 0, 0, 7, 7, SURF_PREDEF_CK);
}
예제 #25
0
void MainFuelTempInd::DoDrawSwitch(double v, SURFHANDLE drawSurface)

{	
	oapiBlt(drawSurface, NeedleSurface,  94, 115-((int)((v-40)*1.7)), 0, 0, 7, 7, SURF_PREDEF_CK);
}
예제 #26
0
void CommandedThrustInd::DoDrawSwitch(double v, SURFHANDLE drawSurface)

{	
	oapiBlt(drawSurface, NeedleSurface,  58, 114-((int)v), 7, 0, 7, 7, SURF_PREDEF_CK);
}
예제 #27
0
bool MfdButtonCol::RedrawVC (DEVMESHHANDLE hMesh, SURFHANDLE surf)
{
	if (pending_action) { // process button push

		static const int grpid[2][2] = {{GRP_LMFD_LBUTTONS_VC,GRP_LMFD_RBUTTONS_VC},
		                                {GRP_RMFD_LBUTTONS_VC,GRP_RMFD_RBUTTONS_VC}};
		PushButtonVC (hMesh, grpid[subsys->MfdId()][sd], pending_btn, pending_action==1);
		pending_action = 0;
		return false;

	} else { // process label change

		static const int CHX[256] = { // MFD label font: character x-offsets
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,333/*+*/,0,342/*-*/,0,359/* / */,
			492/*0*/,501/*1*/,510/*2*/,520/*3*/,529/*4*/,538/*5*/,547/*6*/,556/*7*/,565/*8*/,575/*9*/,627/*:*/,621/*;*/,373/*<*/,652/*=*/,381/*>*/,0,
			0,81/*A*/,90/*B*/,100/*C*/,110/*D*/,120/*E*/,129/*F*/,138/*G*/,150/*H*/,159/*I*/,164/*J*/,173/*K*/,183/*L*/,192/*M*/,203/*N*/,213/*O*/,
			224/*P*/,233/*Q*/,243/*R*/,253/*S*/,263/*T*/,271/*U*/,281/*V*/,291/*W*/,305/*X*/,314/*Y*/,324/*Z*/,0,0,0,0,0,
			0,273/*a*/,282/*b*/,291/*c*/,299/*d*/,309/*e*/,318/*f*/,324/*g*/,333/*h*/,342/*i*/,347/*j*/,353/*k*/,362/*l*/,367/*m*/,380/*n*/,389/*o*/,
			398/*p*/,407/*q*/,416/*r*/,423/*s*/,431/*t*/,438/*u*/,447/*v*/,456/*w*/,466/*x*/,475/*y*/,483/*z*/,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		};

		const int CHW[256] = { // MFD label font: character widths
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,6/*+*/,0,6/*-*/,0,5/* / */,
			6/*0*/,6/*1*/,6/*2*/,6/*3*/,6/*4*/,6/*5*/,6/*6*/,6/*7*/,6/*8*/,6/*9*/,2/*:*/,2/*;*/,8/*<*/,6/*=*/,8/*>*/,0,
			0,9/*A*/,9/*B*/,9/*C*/,9/*D*/,8/*E*/,8/*F*/,10/*G*/,8/*H*/,4/*I*/,7/*J*/,8/*K*/,7/*L*/,10/*M*/,9/*N*/,10/*O*/,
			8/*P*/,9/*Q*/,9/*R*/,9/*S*/,8/*T*/,9/*U*/,8/*V*/,12/*W*/,8/*X*/,9/*Y*/,8/*Z*/,0,0,0,0,0,
			0,6/*a*/,6/*b*/,6/*c*/,6/*d*/,6/*e*/,4/*f*/,6/*g*/,6/*h*/,2/*i*/,3/*j*/,5/*k*/,2/*l*/,8/*m*/,6/*n*/,6/*o*/,
			6/*p*/,6/*q*/,4/*r*/,6/*s*/,4/*t*/,6/*u*/,6/*v*/,9/*w*/,6/*x*/,6/*y*/,6/*z*/,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		};
		const int CHY = 1012;

		surf = subsys->VcTex();

		const int xcnt0 = 148, dx = 40, wlbl = 32, hlbl = 12;
		const char *label;
		int btn, xcnt, x, y = 14+sd*41+subsys->MfdId()*82, w, len, i;

		for (btn = 0; btn < 6; btn++)
			oapiBlt (surf, surf, xcnt0-wlbl/2+btn*dx, y, 0, 128, wlbl, hlbl); // blank label

		for (btn = 0; btn < 6; btn++) {
			if (label = oapiMFDButtonLabel (subsys->MfdId(), btn+sd*6)) {
				len = strlen(label);
				for (w = i = 0; i < len; i++) w += CHW[label[i]];
				xcnt = xcnt0 + btn*dx;
				for (i = 0, x = xcnt-w/2; i < len; i++) {
					w = CHW[label[i]];
					if (w) {
						oapiBlt (surf, surf, x, y, CHX[label[i]], CHY, w, hlbl);
						x += w;
					}
				}
			} else break;
		}
		return true;
	}
}
예제 #28
0
void LMRCSBQtyInd::DoDrawSwitch(double v, SURFHANDLE drawSurface)

{
	oapiBlt(drawSurface, NeedleSurface,  240, 97-((int)(v*0.8)), 7, 0, 7, 7, SURF_PREDEF_CK);
}
예제 #29
0
파일: InstrVs.cpp 프로젝트: Artoria2e5/obtr
bool InstrSpd::Redraw2D (SURFHANDLE surf)
{
	double spd = vessel->GetGroundspeed()*0.1;
	double vspd, aspd = fabs(spd);

	static double texw = PANELEL_TEXW, texh = PANELEL_TEXH;
	static double scalecnt = texh-422.0+152.0;
	static int scaleunit = 15;
	static double viewh = 50.0;
	double ycnt, y0, y1, dy, ddy;
	char *c, cbuf[12];
	bool centered = (fabs(spd) <= 4.0);

	dy = spd-floor(spd);
	if (centered) {
		ycnt = scalecnt - spd*scaleunit;
	} else {
		if (spd > 0.0) ycnt = scalecnt - (5.0+dy)*scaleunit;
		else           ycnt = scalecnt + (5.0-dy)*scaleunit;
	}
	y0 = ycnt-viewh;
	y1 = ycnt+viewh;
	grp->Vtx[0+vtxofs].tv = grp->Vtx[1+vtxofs].tv = (float)(y0/texh);
	grp->Vtx[2+vtxofs].tv = grp->Vtx[3+vtxofs].tv = (float)(y1/texh);

	// copy labels onto scale
	const int labelx = 70;
	int i, j, n, smin, smax, iy, len, ysrc;
	int s0 = (int)floor(spd);
	smin = s0-3;
	if (smin != psmin) {
		psmin = smin;
		smax = smin+7;
		for (i = smin; i <= smax; i++) {
			sprintf (cbuf, "%03d", abs((i%100)*10));
			len = 3;
			if (centered) {
				if (!i) continue;
				iy = (int)scalecnt-i*scaleunit-5;
			} else {
				if (i > 0) iy = (int)scalecnt-(2+i-smin)*scaleunit-5;
				else       iy = (int)scalecnt+(8-i+smin)*scaleunit-5;
			}
			for (j = 0, c = cbuf; j < 3; c++, j++) {
				n = *c-'0';
				ysrc = (int)texh-265+n*8;
				if (i < 0) ysrc += 88;
				oapiBlt (surf, surf, labelx+j*6, iy, label_srcx, ysrc, 6, 8);
			}
		}
	}

#ifdef UNDEF
	// apoapsis/periapsis altitude indicators
	OBJHANDLE hRef = vessel->GetSurfaceRef();
	if (hRef) {
		double rad = oapiGetSize (hRef);
		double apalt, pealt;
		vessel->GetApDist(apalt); apalt -= rad; apalt *= 1e-3;
		vessel->GetPeDist(pealt); pealt -= rad; pealt *= 1e-3;

		float yofs;
		if (apalt < alt+4 && apalt > alt-4)
			yofs = (float)((apalt-alt)*scaleunit*(48.0/50.0));
		else yofs = -60;
		static const float y0[3] = {atape_ycnt, atape_ycnt, atape_ycnt-11};
		for (i = 0; i < 3; i++)
			grp->Vtx[vtxofs+i+16].y = y0[i]-yofs;

		if (pealt < alt+4 && pealt > alt-4)
			yofs = (float)((pealt-alt)*scaleunit*(48.0/50.0));
		else yofs = -60;
		static const float y1[3] = {atape_ycnt, atape_ycnt, atape_ycnt+11};
		for (i = 0; i < 3; i++)
			grp->Vtx[vtxofs+i+19].y = y1[i]-yofs;
	}
#endif

	// km*1000 indicator wheels
	sprintf (cbuf, "%06d", (((int)aspd)%100000)*10);
	for (i = 0; i < 3; i++) {
		float yofs = (float)(texh-111 - (cbuf[i]-'0')*15);
		if (aspd > 50.0) {
			const double scl[3] = {1e4,1e3,1e2};
			vspd = aspd/scl[i];
			ddy = (vspd-floor(vspd))*scl[i];
			// number dials in rotation phase
			if (ddy < 0.5) yofs += (float)((0.5-ddy)*15.0);
			else if (ddy > scl[i]-0.5) yofs += (float)((scl[i]-0.5-ddy)*15.0);
		}
		for (j = 0; j < 4; j++) {
			grp->Vtx[4+i*4+vtxofs].tv = grp->Vtx[5+i*4+vtxofs].tv = yofs/(float)texh;
			grp->Vtx[6+i*4+vtxofs].tv = grp->Vtx[7+i*4+vtxofs].tv = (yofs+17.0f)/(float)texh;
		}
	}

	return false;
}
예제 #30
0
void TempMonitorInd::DoDrawSwitch(double v, SURFHANDLE drawSurface)

{	
	oapiBlt(drawSurface, NeedleSurface,  35, 112-((int)((v+100)*0.34)), 7, 0, 7, 7, SURF_PREDEF_CK);
}