public ObsDisplay(libobs.gs_init_data graphicsData) { instance = libobs.obs_display_create(ref graphicsData); if (instance == null) throw new ApplicationException("obs_display_create failed"); }
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); }
public void Transform(libobs.matrix4 matrix4) { libobs.vec3_transform(out this, out this, out matrix4); }
public void Transform(Vector3 other, libobs.matrix4 matrix4) { libobs.vec3_transform(out this, out other, out matrix4); }
public void Rotate(libobs.matrix3 matrix3) { libobs.vec3_rotate(out this, out this, out matrix3); }
public void PropertyButtonClicked(ObsProperty property, libobs.obs_property_clicked_t clicked) { if (clicked == null) return; if (property.ButtonClicked(clicked, properties, context.GetPointer())) RefreshProperties(property); }
/// <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); } }
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(); }
public static Vector3 GetTransform(Vector3 other, libobs.matrix4 matrix4) { Vector3 vec; libobs.vec3_transform(out vec, out other, out matrix4); return vec; }
public unsafe void RemoveDrawCallback(libobs.draw_callback callback) { RemoveDrawCallback(callback, IntPtr.Zero); }
public unsafe void AddDrawCallback(libobs.draw_callback callback) { AddDrawCallback(callback, IntPtr.Zero); }
public static bool ResetVideo(libobs.obs_video_info ovi) { return (libobs.obs_reset_video(ref ovi) == (int)ObsVideoErrorCode.Success); }
public static bool ResetAudio(libobs.obs_audio_info ai) { return libobs.obs_reset_audio(ref ai); }
public void Transform(Vector3 other, libobs.matrix3 matrix3) { libobs.vec3_transform3x4(out this, out other, out matrix3); }
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); }
public void Transform(libobs.matrix3 matrix3) { libobs.vec3_transform3x4(out this, out this, out matrix3); }
public void Mirror(Vector3 other, libobs.plane plane) { libobs.vec3_mirror(out this, out other, out plane); }
public float DistanceTo(libobs.plane plane) { return libobs.vec3_plane_dist(out this, out plane); }
public void Mirror(libobs.plane plane) { libobs.vec3_mirror(out this, out this, out plane); }
/// <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); }
public void Rotate(Vector3 other, libobs.matrix3 matrix3) { libobs.vec3_rotate(out this, out other, out matrix3); }
/// <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); }
public unsafe bool ButtonClicked(libobs.obs_property_clicked_t clicked, ObsProperties properties, IntPtr obj) { return clicked(properties.GetPointer(), instance, obj); }