Пример #1
0
    void Awake()
    {
        instance = this;

        if (guiCamera == null)
        {
            guiCamera = gameObject.GetComponent <Camera>();
        }
        guiCamera.gameObject.transform.position = new Vector3(0, 0, -10);

        if (enableVRInput)
        {
            renderTexture           = new RenderTexture(vrGuiResolution.x, vrGuiResolution.y, 0);
            guiCamera.targetTexture = renderTexture;

            objectMaterial.mainTexture = renderTexture;
            MeshRenderer meshRenderer = GetComponent <MeshRenderer>();
            meshRenderer.material = objectMaterial;

            vrCollider = GetComponent <MeshCollider>();
        }

        textures    = new Dictionary <IntPtr, Texture>(new IntPtrComparer());
        mpb         = new MaterialPropertyBlock();
        main_tex_id = Shader.PropertyToID("_MainTex");

        context = ImGui.CreateContext();
        ImGui.SetCurrentContext(context);

        ImGuiIOPtr io = ImGui.GetIO();

        io.SetIniFile(string.Format("{0}/dear_imgui.ini", Application.persistentDataPath));

        ImGui.GetStyle().ScaleAllSizes(uiScale);

        RebuildFonts();

        SetKeyMappings();

        io.ConfigFlags  |= ImGuiConfigFlags.NavEnableGamepad;
        io.BackendFlags |= ImGuiBackendFlags.HasGamepad;
    }
Пример #2
0
 void Start()
 {
     imGui = GameObject.Find("ImGuiUnity").GetComponent <ImGuiUnity>();
 }
Пример #3
0
 public void AddImage(Texture texture, Vector2 a, Vector2 b, Vector2 uv_a, Vector2 uv_b, uint col)
 {
     ImGuiUnity.AddDrawListImage(NativePtr, texture, a, b, uv_a, uv_b, col);
 }
Пример #4
0
 public void AddImageRounded(Texture texture, Vector2 a, Vector2 b, Vector2 uv_a, Vector2 uv_b, uint col, float rounding, int rounding_corners)
 {
     ImGuiUnity.AddDrawListImageRounded(NativePtr, texture, a, b, uv_a, uv_b, col, rounding, rounding_corners);
 }
Пример #5
0
 public void AddImageQuad(Texture texture, Vector2 a, Vector2 b, Vector2 c, Vector2 d, Vector2 uv_a, Vector2 uv_b, Vector2 uv_c, Vector2 uv_d, uint col)
 {
     ImGuiUnity.AddDrawListImageQuad(NativePtr, texture, a, b, c, d, uv_a, uv_b, uv_c, uv_d, col);
 }