obs-overlay-lua/twitchery.lua

121 lines
2.9 KiB
Lua
Raw Normal View History

obs = obslua
bit = require("bit")
source_def = {}
source_def.id = "lua_twitchery_source"
source_def.type = obs.OBS_SOURCE_TYPE_INPUT
source_def.output_flags = bit.bor(obs.OBS_SOURCE_VIDEO,
obs.OBS_SOURCE_AUDIO,
obs.OBS_SOURCE_CUSTOM_DRAW)
-- source_def.icon_type = obs.OBS_ICON_TYPE_CUSTOM -- not implemented yet
defaultProps = obs.obs_properties_create()
-- TODO: proper names, all events
twitchevents = {"tier 1 sub", "tier 2 sub", "tier 3 sub", "follow", "custom reward"}
print("boy i love languages that ACTIVELY RESIST being debugged vvvvvv")
tableTest = {}
print(tableTest)
print("im already mad ^^^^^^")
source_def.get_name = function()
return "twitchery controller"
end
source_def.get_properties = function(data, type_data)
-- TODO
print("getting properties")
print("data:")
print(data)
print("type_data:")
print(type_data)
end
-- get_defaults: SSSSSets the defaults. >_<
source_def.get_defaults = function(settings)
print("setting (not getting!) defaults")
print(settings)
obs.obs_data_set_default_string(settings, "active event", "")
return settings
end
source_def.create = function(settings, source)
local data = {}
local currentScene = obs.obs_scene_from_source(obs.obs_frontend_get_current_scene())
--data.group = obs.obs_scene_add_group(currentScene, "twitchery stuff")
--put self in
-- obs.obs_sceneitem_group_add_item(data.group, source)
print("who knows if I work, what is debugging?")
--print(data.group)
print("settings:")
print(settings)
print("source:")
print(source)
-- obs.obs_sceneitem_get_sourc
--for all twitch respondable events; add item
--for i = 0, table.getn(twitchevents) do
-- print(twitchevents[i + 1])
-- local anImage = obs.gs_image_file()
-- obs.obs_source_create("image_source", twitchevents[i + 1], nil, nil)
-- image_source_load(anImage, script_path() .. "placeholder.png")
--end
-- text_gdiplus
return data
end
source_def.destroy = function(data)
-- TODO
end
source_def.video_render = function(data, effect)
-- TODO
end
source_def.get_width = function(data)
return 1920
end
source_def.get_height = function(data)
return 1080
end
source_def.update = function(data, settings)
local fff = obs.obs_data_get_string(settings, "active event")
print(fff)
end
function script_description()
return "something to acknowledge twitch stuff."
end
function update(data, settings)
print("updating!")
print(data)
print("settings:")
print(settings)
end
obs.obs_register_source(source_def)
function image_source_load(image, file)
obs.obs_enter_graphics()
obs.gs_image_file_free(image)
obs.obs_leave_graphics()
obs.gs_image_file_init(image, file)
obs.obs_enter_graphics()
obs.gs_image_file_init_texture(image)
obs.obs_leave_graphics()
if not image.loaded then
print("failed to load texture " .. file)
end
end
-- FYI, your path back to built-ins:
-- C:\Program Files\obs-studio\data\obs-plugins\frontend-tools\scripts