MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / GetCockpitWindowCoords

Function GetCockpitWindowCoords

Descent3/gauges.cpp:955–987  ·  view source on GitHub ↗

Returns the coordinates of the specified cockpit monitor Parameter: window - 0 means primary monitor, 1 means secondary x0,y0,x1,y1 - these are filled in with the coordinates of the montiro Returns: true if got coords, false if the monitor was animating

Source from the content-addressed store, hash-verified

953// x0,y0,x1,y1 - these are filled in with the coordinates of the montiro
954// Returns: true if got coords, false if the monitor was animating
955bool GetCockpitWindowCoords(int window, int *left, int *top, int *right, int *bot) {
956 if (Render_gauge_moving)
957 return 0;
958
959 tGauge *gauge;
960
961 gauge = &Gauge_list[GAUGE_INDEX(window ? STAT_SECONDARYLOAD : STAT_PRIMARYLOAD)];
962
963 if (gauge->monitor) {
964
965#define HUD_RENDER_ZOOM 0.56f
966
967 StartFrame(false);
968 g3_StartFrame(&Viewer_object->pos, &Viewer_object->orient, HUD_RENDER_ZOOM);
969
970 for (int i = 0; i < 2; i++) {
971 gauge->pts[i * 2].p3_flags &= (~PF_PROJECTED);
972 g3_ProjectPoint(&gauge->pts[i * 2]);
973 }
974
975 *left = gauge->pts[0].p3_sx;
976 *top = gauge->pts[0].p3_sy;
977 *right = gauge->pts[2].p3_sx + 2;
978 *bot = gauge->pts[2].p3_sy + 2;
979
980 g3_EndFrame();
981 EndFrame();
982
983 return 1;
984 }
985
986 return 0;
987}

Callers 1

DrawSmallViewsFunction · 0.85

Calls 6

GAUGE_INDEXFunction · 0.85
StartFrameFunction · 0.85
g3_StartFrameFunction · 0.85
g3_ProjectPointFunction · 0.85
g3_EndFrameFunction · 0.85
EndFrameFunction · 0.85

Tested by

no test coverage detected