- Joined
- Feb 6, 2008
- Messages
- 37,664
- Reaction score
- 2,386
- Points
- 203
- Location
- Wolfsburg
- Preferred Pronouns
- Sire
Ok. Any ideas about the gear up/down text area?
Nothing helpful right now, I am too much in awe because of Iceland.
Ok. Any ideas about the gear up/down text area?
double level2 = GetPropellantMass(tank1);
double level4 = GetPropellantMass(tank2);//hover
double level5 = GetPropellantMass(tank3);//rcs
//double level = GetThrusterLevel(th_main[0]);
// double level2 = GetPropellantMass(tank);
//double level3 = GetThrusterLevel(th_hover[0]);
SelectObject(hDC, g_Param.hBrush[4]);//green box
//Rectangle(hDC, 150, 144, (int)(150 + level * (351 - 150)), 187);//thrust
//Rectangle(hDC, 150, 217, (int)(150 + level3 * (350 - 150)), 260);//thrust
fuel1rate1 = ((455 - 325) / FUELMASS1);
fuel1rate2 = ((455 - 325) / FUELMASS2);
fuel1rate3 = ((455 - 325) / FUELMASS3);
Rectangle(hDC, 131, 325, 174, (int)(455 - (level2)*fuel1rate1)); //fuel
Rectangle(hDC, 241, 325, 284, (int)(455 - (level4)*fuel1rate2)); //fuel
Rectangle(hDC, 350, 325, 394, (int)(455 - (level5)*fuel1rate3)); //rscfuel
SetTextColor(hDC, RGB(0, 153, 0));
SetTextAlign(hDC, TA_LEFT);
SetBkMode(hDC, TRANSPARENT);
SelectObject(hDC, g_Param.hFont[1]);
sprintf(cbuf, "%0.1f", level2 );
TextOut(hDC, 130, 474, cbuf, strlen(cbuf));
sprintf(cbuf, "%0.1f", level4);
TextOut(hDC, 244,474, cbuf, strlen(cbuf));
sprintf(cbuf, "%0.1f", level5);
TextOut(hDC, 352, 474, cbuf, strlen(cbuf));
const double FUELMASS1 = 4000;
const double FUELMASS2 = 4000;
const double FUELMASS3 = 2000;
double fuelrate1,fuelrate2,fuelrate3.
when I run the debugger :
fuel1rate1 0.032500000000000001 double
fuel1rate2 0.032500000000000001 double
fuel1rate3 0.065000000000000002 double
What is odd is in the debugger I don't see level2,4 just level 5
void RANGER::RedrawPanel_CENTERFuelstatus(SURFHANDLE surf, int part)
{
char cbuf[20];
HDC hDC = oapiGetDC(surf);
double level6 = GetPropellantMass(tank1);
double level4 = GetPropellantMass(tank2);//hover
double level5 = GetPropellantMass(tank3);//rcs
//double level = GetThrusterLevel(th_main[0]);
// double level2 = GetPropellantMass(tank);
//double level3 = GetThrusterLevel(th_hover[0]);
SelectObject(hDC, g_Param.hBrush[4]);//green box
//Rectangle(hDC, 150, 144, (int)(150 + level * (351 - 150)), 187);//thrust
//Rectangle(hDC, 150, 217, (int)(150 + level3 * (350 - 150)), 260);//thrust
fuel1rate1 = ((455 - 325) / FUELMASS1);
fuel1rate2 = ((455 - 325) / FUELMASS2);
fuel1rate3 = ((455 - 325) / FUELMASS3);
Rectangle(hDC, 131, 325, 174, (int)(455 - (level6)*fuel1rate1)); //fuel
Rectangle(hDC, 241, 325, 284, (int)(455 - (level4)*fuel1rate2)); //fuel
Rectangle(hDC, 350, 325, 394, (int)(455 - (level5)*fuel1rate3)); //rscfuel
SetTextColor(hDC, RGB(0, 153, 0));
SetTextAlign(hDC, TA_LEFT);
SetBkMode(hDC, TRANSPARENT);
SelectObject(hDC, g_Param.hFont[1]);
sprintf(cbuf, "%0.1f", level6 );
TextOut(hDC, 130, 474, cbuf, strlen(cbuf));
sprintf(cbuf, "%0.1f", level4);
TextOut(hDC, 244,474, cbuf, strlen(cbuf));
sprintf(cbuf, "%0.1f", level5);
TextOut(hDC, 352, 474, cbuf, strlen(cbuf));
SelectObject(hDC, g_Param.hFont[3]);
if (GEAR_status == GEAR_UP) {
sprintf(cbuf, "GEAR UP", 7);
TextOut(hDC, 250, 100, cbuf, strlen(cbuf));
//TextOut(hDC, 400, 100, cbuf, strlen(cbuf));
TextOut(hDC, 10, 100, cbuf, strlen(cbuf));
}
if (GEAR_status == GEAR_DOWN) {
sprintf(cbuf, "GEAR DOWN", 9);
TextOut(hDC, 50, 172, cbuf, strlen(cbuf));
}
oapiReleaseDC(surf, hDC);
}
fuelboxy = (455 - (level6)*fuel1rate1);
Rectangle(hDC, 131, 325, 174, (int)(fuelboxy)); //fuel
But then when you paint it on the mesh wouldn't the points move as you stretch/shrink it?
Rectangle(hDC, 131, 325, 174, 455); //fuel
Ok I am trying to think of why the bars are not drawing correctly. the math seems good. But what if the points were off due to mapping on the mesh?
---------- Post added at 06:02 AM ---------- Previous post was at 05:35 AM ----------
Well its not the points. I had it just the bar and it was good.
Code:Rectangle(hDC, 131, 325, 174, 455); //fuel
I believe yes. That is how I did it on the others that work.What I wonder is: Does Sketchpad like drawing rectangles from bottom to top? Usually the first coordinate is the upper left corner and the second the lower right corner.
So what would the math look like if it draw from top to bottom. We know the coordinates are ok. Just that it draws upside down
Rectangle(hDC, 131, 455 - (int)(level6*fuel1rate1), 174, 455);
Well the values seem right.On Sketchpad, for the rectangle you must have x1 <= x2 and y1 <= y2, i.e. top-left and bottom-right coordinates, or nothing will show. On GDI it works with any 2 opposed corners of the rectangle.
SetMeshVisibilityMode(MeshMain = AddMesh(METNUMBERS = oapiLoadMeshGlobal("mettimer1")), MESHVIS_EXTERNAL|| MESHVIS_VC);
SetCameraOffset(_V(0, 0, -.165));
bool METMETER::clbkLoadVC(int id)
{
// Register Camera (view) properties
switch (id)
{
case 0: // Left Seat
SetCameraOffset(_V(0, .0, -.165)); // Set camera position (x,y,z)
SetCameraDefaultDirection(_V(0, 0, 1));
oapiVCSetNeighbours(0, 1, -1, -1); // Set adjacent cameras (Left, Right, Top, Bottom)
break;
} // end "switc
SURFHANDLE const tex3 = oapiGetTextureHandle(METNUMBERS, 1);
oapiVCRegisterArea(AID_METTIME, _R(0, 0, 256, 256), PANEL_REDRAW_USER, PANEL_MOUSE_IGNORE, PANEL_MAP_BACKGROUND, tex3);
return true;
}