public static void DrawDiamond(Rect rect, Color color) { if (diamondTex == null) { CreateDiamondTex(); } // Save the current GUI matrix, since we're going to make changes to it. Matrix4x4 matrix = GUI.matrix; // Store current GUI color, so we can switch it back later, // and set the GUI color to the color parameter Color savedColor = GUI.color; GUI.color = color; // Finally, draw the actual line. // We're really only drawing a 1x1 texture from pointA. // The matrix operations done with ScaleAroundPivot and RotateAroundPivot will make this // render with the proper width, length, and angle. GUI.DrawTexture(rect, diamondTex); // We're done. Restore the GUI matrix and GUI color to whatever they were before. GUI.matrix = matrix; GUI.color = savedColor; }
protected override void OnDraw(Rect bounds) { UpdateTexture(); if (backgroundTexture != null) { GUI.DrawTexture(bounds, backgroundTexture); } GUI.DrawTexture(bounds, texture); }
public static void DrawRect(Rect rect, Color color) { // Generate a single pixel texture if it doesn't exist if (!lineTex) { lineTex = new Texture2D(1, 1); } // Store current GUI color, so we can switch it back later, // and set the GUI color to the color parameter Color savedColor = GUI.color; GUI.color = color; // Finally, draw the actual line. // We're really only drawing a 1x1 texture from pointA. // The matrix operations done with ScaleAroundPivot and RotateAroundPivot will make this // render with the proper width, length, and angle. GUI.DrawTexture(rect, lineTex); GUI.color = savedColor; }
protected override void OnDraw(Rect bounds) => GUI.DrawTexture(bounds, texture);
private void OnWindow(int WindowID) { Log.dbg("NavUtils: NavUtilLibApp.OnWindow()"); Log.dbg("HSI: OnWindow()"); Rect rwyBtn = new Rect(20 * var.Settings.hsiGUIscale, 13 * var.Settings.hsiGUIscale, 200 * var.Settings.hsiGUIscale, 20 * var.Settings.hsiGUIscale); Rect gsBtn = new Rect(20 * var.Settings.hsiGUIscale, 38 * var.Settings.hsiGUIscale, 200 * var.Settings.hsiGUIscale, 20 * var.Settings.hsiGUIscale); Rect closeBtn = new Rect(330 * var.Settings.hsiGUIscale, 580 * var.Settings.hsiGUIscale, 300 * var.Settings.hsiGUIscale, 50 * var.Settings.hsiGUIscale); if (GUI.Button(closeBtn, new GUIContent("CloseBtn", "closeOn"))) { //displayHSI(); Log.dbg("CloseHSI"); appButton.SetFalse(true); //goto CloseWindow; } if (GUI.tooltip == "closeOn") { closeHover = true; } else { closeHover = false; } if (GUI.Button(rwyBtn, new GUIContent("Next Runway", "rwyOn")) && !var.FlightData.isINSMode()) //doesn't let runway to be switched in INS mode { if (Event.current.alt) { RunwayListGUI.show(windowPosition); } else { if (Event.current.button == 0) { var.FlightData.rwyIdx++; } else { var.FlightData.rwyIdx--; } var.FlightData.rwyIdx = NavUtilLib.Utils.indexChecker(var.FlightData.rwyIdx, var.FlightData.currentBodyRunways.Count - 1, 0); } } if (GUI.tooltip == "rwyOn") { rwyHover = true; } else { rwyHover = false; } if (GUI.Button(gsBtn, new GUIContent("Next G/S", "gsOn"))) { if (Event.current.button == 0) { var.FlightData.gsIdx++; } else { var.FlightData.gsIdx--; } var.FlightData.gsIdx = NavUtilLib.Utils.indexChecker(var.FlightData.gsIdx, var.FlightData.gsList.Count - 1, 0); } if (GUI.tooltip == "gsOn") { gsHover = true; } else { gsHover = false; } rt.Create(); DrawGauge(rt); GUI.DrawTexture(new Rect(0, 0, windowPosition.width, windowPosition.height), rt, ScaleMode.ScaleToFit); //GUI.DrawTexture(new Rect(0, 0, windowPosition.width, windowPosition.height), var.Materials.Instance.overlay.mainTexture); GUI.DragWindow(); }