/// <summary> /// The one and only OnGUI method that invokes all the RenderGUI methods of all registered KGFIGui2D objects /// </summary> protected void OnGUI() { float aScaleFactor = KGFScreen.GetScaleFactor2D(); GUIUtility.ScaleAroundPivot(new Vector2(aScaleFactor, aScaleFactor), Vector2.zero); foreach (KGFIGui2D aGui2D in itsGUIs) { aGui2D.RenderGUI(); } GUI.matrix = Matrix4x4.identity; }
public static Vector3 GetMousePositionDisplay() { CheckInstance(); if (itsInstance == null) { return(Vector3.zero); } float anX = Input.mousePosition.x * KGFScreen.GetScaleFactor3D(); float anY = Screen.height - (Input.mousePosition.y * KGFScreen.GetScaleFactor3D()); Vector3 aMousePosition = new Vector3(anX, anY, Input.mousePosition.z); return(aMousePosition); }
/// <summary> /// This method is called from Unity3D Engine when the script instance is being loaded. /// </summary> protected void Awake() { if (itsInstance == null) { itsInstance = this; itsInstance.Init(); } else { if (itsInstance != this) { UnityEngine.Debug.Log("there is more than one KFGDebug instance in this scene. please ensure there is always exactly one instance in this scene"); Destroy(gameObject); } return; } }
private static void CheckInstance() { // check if the cheat module is already activated if (itsInstance == null) { UnityEngine.Object theObject = UnityEngine.Object.FindObjectOfType(typeof(KGFScreen)); if (theObject != null) { itsInstance = theObject as KGFScreen; itsInstance.Init(); } else { if (!itsAlreadyChecked) { UnityEngine.Debug.LogError("KGFScreen is not running. Make sure that there is an instance of the KGFScreen prefab in the current scene."); itsAlreadyChecked = true; } } } }
public static Vector3 GetMousePosition2D() { CheckInstance(); if (itsInstance == null) { return(Vector3.zero); } if (GetResolutionMode3D() == GetResolutionMode2D()) //both modes are the same { return(Input.mousePosition); } else if (GetResolutionMode2D() == eResolutionMode.eNative && GetResolutionMode3D() == eResolutionMode.eAutoAdjust) { return(Input.mousePosition * KGFScreen.GetScaleFactor3D()); } else if (GetResolutionMode2D() == eResolutionMode.eAutoAdjust && GetResolutionMode3D() == eResolutionMode.eNative) { return(Input.mousePosition / KGFScreen.GetScaleFactor2D()); } return(Input.mousePosition); }
private void OnPostRender() { KGFScreen.BlitToScreen(); }
private static void CheckInstance() { // check if the cheat module is already activated if(itsInstance == null) { UnityEngine.Object theObject = UnityEngine.Object.FindObjectOfType(typeof(KGFScreen)); if(theObject != null) { itsInstance = theObject as KGFScreen; itsInstance.Init(); } else { if(!itsAlreadyChecked) { UnityEngine.Debug.LogError("KGFScreen is not running. Make sure that there is an instance of the KGFScreen prefab in the current scene."); itsAlreadyChecked = true; } } } }
/// <summary> /// This method is called from Unity3D Engine when the script instance is being loaded. /// </summary> protected void Awake() { if (itsInstance == null) { itsInstance = this; itsInstance.Init(); } else { if(itsInstance != this) { UnityEngine.Debug.Log("there is more than one KFGDebug instance in this scene. please ensure there is always exactly one instance in this scene"); Destroy(gameObject); } return; } }