コード例 #1
0
ファイル: ObsDisplay.cs プロジェクト: GoaLitiuM/libobs-sharp
        public ObsDisplay(libobs.gs_init_data graphicsData)
        {
            instance = libobs.obs_display_create(ref graphicsData);

            if (instance == null)
                throw new ApplicationException("obs_display_create failed");
        }
コード例 #2
0
ファイル: ObsDisplay.cs プロジェクト: GoaLitiuM/libobs-sharp
        public unsafe void AddDrawCallback(libobs.draw_callback callback, IntPtr param)
        {
            // store the delegate tuple to prevent delegate getting removed
            // by garbage collector

            delegateTuple tuple = new delegateTuple(callback, param);
            delegateRefs.Add(tuple);
            libobs.obs_display_add_draw_callback(instance, tuple.Item1, tuple.Item2);
        }
コード例 #3
0
ファイル: Vector3.cs プロジェクト: GoaLitiuM/libobs-sharp
 public void Transform(libobs.matrix4 matrix4)
 {
     libobs.vec3_transform(out this, out this, out matrix4);
 }
コード例 #4
0
ファイル: Vector3.cs プロジェクト: GoaLitiuM/libobs-sharp
 public void Transform(Vector3 other, libobs.matrix4 matrix4)
 {
     libobs.vec3_transform(out this, out other, out matrix4);
 }
コード例 #5
0
ファイル: Vector3.cs プロジェクト: GoaLitiuM/libobs-sharp
 public void Rotate(libobs.matrix3 matrix3)
 {
     libobs.vec3_rotate(out this, out this, out matrix3);
 }
コード例 #6
0
        public void PropertyButtonClicked(ObsProperty property, libobs.obs_property_clicked_t clicked)
        {
            if (clicked == null)
                return;

            if (property.ButtonClicked(clicked, properties, context.GetPointer()))
                RefreshProperties(property);
        }
コード例 #7
0
ファイル: LogHandler.cs プロジェクト: GoaLitiuM/libobs-sharp
        /// <summary> Wraps, parses and formats the variable arguments of the real delegate. </summary>
        private static void LogHandlerWrapper(libobs.log_error_level lvl, string format, IntPtr args, IntPtr p)
        {
            using (va_list arglist = new va_list(args))
            {
                object[] objs = arglist.GetObjectsByFormat(format);
                string formattedMsg = Printf.sprintf(format, objs);

                realHandler((LogErrorLevel)lvl, formattedMsg, p);
            }
        }
コード例 #8
0
        private void DrawOutline(libobs.matrix4 matrix, float width, float height, float outlineThickness)
        {
            Vector3 scale = new Vector3(previewScale, previewScale, previewScale);
            libobs.matrix4_scale(out matrix, out matrix, out scale);

            GS.MatrixPush();
            GS.MatrixIdentity();

            GS.MatrixMul(matrix);

            float thickW = outlineThickness/width/previewScale;
            float thickH = outlineThickness/height/previewScale;

            GS.MatrixPush();
            GS.MatrixScale3f(1.0f-thickW, thickH, 1.0f);
            GS.Draw(GSDrawMode.TrisStrip, 0, 0);
            GS.MatrixPop();

            GS.MatrixPush();
            GS.MatrixTranslate(new Vector3(1.0f, 0.0f, 0.0f));
            GS.MatrixScale3f(-thickW, 1.0f-thickH, 1.0f);
            GS.Draw(GSDrawMode.TrisStrip, 0, 0);
            GS.MatrixPop();

            GS.MatrixPush();
            GS.MatrixTranslate(new Vector3(1.0f, 1.0f, 0.0f));
            GS.MatrixScale3f(-1.0f+thickW, -thickH, 1.0f);
            GS.Draw(GSDrawMode.TrisStrip, 0, 0);
            GS.MatrixPop();

            GS.MatrixPush();
            GS.MatrixTranslate(new Vector3(0.0f, 1.0f, 0.0f));
            GS.MatrixScale3f(thickW, -1.0f+thickH, 1.0f);
            GS.Draw(GSDrawMode.TrisStrip, 0, 0);
            GS.MatrixPop();

            GS.MatrixPop();
        }
コード例 #9
0
ファイル: Vector3.cs プロジェクト: GoaLitiuM/libobs-sharp
 public static Vector3 GetTransform(Vector3 other, libobs.matrix4 matrix4)
 {
     Vector3 vec;
     libobs.vec3_transform(out vec, out other, out matrix4);
     return vec;
 }
コード例 #10
0
ファイル: ObsDisplay.cs プロジェクト: GoaLitiuM/libobs-sharp
 public unsafe void RemoveDrawCallback(libobs.draw_callback callback)
 {
     RemoveDrawCallback(callback, IntPtr.Zero);
 }
コード例 #11
0
ファイル: ObsDisplay.cs プロジェクト: GoaLitiuM/libobs-sharp
 public unsafe void AddDrawCallback(libobs.draw_callback callback)
 {
     AddDrawCallback(callback, IntPtr.Zero);
 }
コード例 #12
0
ファイル: Obs.cs プロジェクト: GoaLitiuM/libobs-sharp
 public static bool ResetVideo(libobs.obs_video_info ovi)
 {
     return (libobs.obs_reset_video(ref ovi) == (int)ObsVideoErrorCode.Success);
 }
コード例 #13
0
ファイル: Obs.cs プロジェクト: GoaLitiuM/libobs-sharp
 public static bool ResetAudio(libobs.obs_audio_info ai)
 {
     return libobs.obs_reset_audio(ref ai);
 }
コード例 #14
0
ファイル: Vector3.cs プロジェクト: GoaLitiuM/libobs-sharp
 public void Transform(Vector3 other, libobs.matrix3 matrix3)
 {
     libobs.vec3_transform3x4(out this, out other, out matrix3);
 }
コード例 #15
0
ファイル: ObsDisplay.cs プロジェクト: GoaLitiuM/libobs-sharp
        public unsafe void RemoveDrawCallback(libobs.draw_callback callback, IntPtr param)
        {
            // use the reference of the archived delegate.

            // if delegate was created as the method were called (user passed
            // function as a first parameter instead of the actual delegate),
            // it would not match with the callback stored in libobs.

            delegateTuple tuple = new delegateTuple(callback, param);
            int index = delegateRefs.IndexOf(tuple);
            if (index != -1)
            {
                tuple = delegateRefs[index];
                delegateRefs.RemoveAt(index);
            }

            libobs.obs_display_remove_draw_callback(instance, tuple.Item1, tuple.Item2);
        }
コード例 #16
0
ファイル: Vector3.cs プロジェクト: GoaLitiuM/libobs-sharp
 public void Transform(libobs.matrix3 matrix3)
 {
     libobs.vec3_transform3x4(out this, out this, out matrix3);
 }
コード例 #17
0
ファイル: Vector3.cs プロジェクト: GoaLitiuM/libobs-sharp
 public void Mirror(Vector3 other, libobs.plane plane)
 {
     libobs.vec3_mirror(out this, out other, out plane);
 }
コード例 #18
0
ファイル: Vector3.cs プロジェクト: GoaLitiuM/libobs-sharp
 public float DistanceTo(libobs.plane plane)
 {
     return libobs.vec3_plane_dist(out this, out plane);
 }
コード例 #19
0
ファイル: Vector3.cs プロジェクト: GoaLitiuM/libobs-sharp
 public void Mirror(libobs.plane plane)
 {
     libobs.vec3_mirror(out this, out this, out plane);
 }
コード例 #20
0
ファイル: LogHandler.cs プロジェクト: GoaLitiuM/libobs-sharp
 /// <summary> Sets OBS current log handler. </summary>
 public static void SetLogHandler(libobs.log_handler_t handler, IntPtr param)
 {
     realHandler = null;
     libobs.base_set_log_handler(handler, param);
 }
コード例 #21
0
ファイル: Vector3.cs プロジェクト: GoaLitiuM/libobs-sharp
 public void Rotate(Vector3 other, libobs.matrix3 matrix3)
 {
     libobs.vec3_rotate(out this, out other, out matrix3);
 }
コード例 #22
0
ファイル: LogHandler.cs プロジェクト: GoaLitiuM/libobs-sharp
 /// <summary> Get current OBS log handler. </summary>
 public static void GetLogHandler(out libobs.log_handler_t handler, out IntPtr param)
 {
     libobs.base_get_log_handler(out handler, out param);
 }
コード例 #23
0
ファイル: ObsProperty.cs プロジェクト: GoaLitiuM/libobs-sharp
 public unsafe bool ButtonClicked(libobs.obs_property_clicked_t clicked, ObsProperties properties, IntPtr obj)
 {
     return clicked(properties.GetPointer(), instance, obj);
 }