Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
1c3f18a7
O
obs-studio
项目概览
尘离序散
/
obs-studio
与 Fork 源项目一致
从无法访问的项目Fork
通知
30
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obs-studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1c3f18a7
编写于
1月 18, 2018
作者:
C
Colin Edwards
提交者:
jp9000
1月 19, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
frontend-tools: Add a lua script that draws an analog clock
Closes jp9000/obs-studio#1159
上级
53d936c5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
114 addition
and
0 deletion
+114
-0
UI/frontend-plugins/frontend-tools/data/scripts/clock-source.lua
...tend-plugins/frontend-tools/data/scripts/clock-source.lua
+114
-0
UI/frontend-plugins/frontend-tools/data/scripts/clock-source/dial.png
...plugins/frontend-tools/data/scripts/clock-source/dial.png
+0
-0
UI/frontend-plugins/frontend-tools/data/scripts/clock-source/hour.png
...plugins/frontend-tools/data/scripts/clock-source/hour.png
+0
-0
UI/frontend-plugins/frontend-tools/data/scripts/clock-source/minute.png
...ugins/frontend-tools/data/scripts/clock-source/minute.png
+0
-0
UI/frontend-plugins/frontend-tools/data/scripts/clock-source/second.png
...ugins/frontend-tools/data/scripts/clock-source/second.png
+0
-0
未找到文件。
UI/frontend-plugins/frontend-tools/data/scripts/clock-source.lua
0 → 100644
浏览文件 @
1c3f18a7
obs
=
obslua
bit
=
require
(
"bit"
)
source_def
=
{}
source_def
.
id
=
"lua_clock_source"
source_def
.
output_flags
=
bit
.
bor
(
obs
.
OBS_SOURCE_VIDEO
,
obs
.
OBS_SOURCE_CUSTOM_DRAW
)
source_def
.
get_name
=
function
()
return
"Lua Clock"
end
source_def
.
create
=
function
(
source
,
settings
)
local
data
=
{}
data
.
image
=
obs
.
gs_image_file
()
data
.
hour_image
=
obs
.
gs_image_file
()
data
.
minute_image
=
obs
.
gs_image_file
()
data
.
second_image
=
obs
.
gs_image_file
()
image_source_load
(
data
.
image
,
script_path
()
..
"clock-source/dial.png"
)
image_source_load
(
data
.
hour_image
,
script_path
()
..
"clock-source/hour.png"
)
image_source_load
(
data
.
minute_image
,
script_path
()
..
"clock-source/minute.png"
)
image_source_load
(
data
.
second_image
,
script_path
()
..
"clock-source/second.png"
)
return
data
end
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
source_def
.
update
=
function
(
data
,
settings
)
image_source_load
(
data
)
end
source_def
.
video_render
=
function
(
data
,
effect
)
if
not
data
.
image
.
texture
then
return
;
end
local
time
=
os.date
(
"*t"
)
local
seconds
=
time
.
sec
local
mins
=
time
.
min
+
seconds
/
60
.
0
;
local
hours
=
time
.
hour
+
(
mins
*
60
.
0
)
/
3600
.
0
;
effect
=
obs
.
obs_get_base_effect
(
obs
.
OBS_EFFECT_DEFAULT
)
obs
.
gs_blend_state_push
()
obs
.
gs_reset_blend_state
()
while
obs
.
gs_effect_loop
(
effect
,
"Draw"
)
do
obs
.
obs_source_draw
(
data
.
image
.
texture
,
0
,
0
,
data
.
image
.
cx
,
data
.
image
.
cy
,
false
);
end
obs
.
gs_matrix_push
()
obs
.
gs_matrix_translate3f
(
250
,
250
,
0
)
obs
.
gs_matrix_rotaa4f
(
0
.
0
,
0
.
0
,
1
.
0
,
2
*
math.pi
/
60
*
mins
);
obs
.
gs_matrix_translate3f
(
-
250
,
-
250
,
0
)
while
obs
.
gs_effect_loop
(
effect
,
"Draw"
)
do
obs
.
obs_source_draw
(
data
.
minute_image
.
texture
,
0
,
0
,
data
.
image
.
cx
,
data
.
image
.
cy
,
false
);
end
obs
.
gs_matrix_pop
()
obs
.
gs_matrix_push
()
obs
.
gs_matrix_translate3f
(
250
,
250
,
0
)
obs
.
gs_matrix_rotaa4f
(
0
.
0
,
0
.
0
,
1
.
0
,
2
.
0
*
math.pi
/
12
*
hours
);
obs
.
gs_matrix_translate3f
(
-
250
,
-
250
,
0
)
while
obs
.
gs_effect_loop
(
effect
,
"Draw"
)
do
obs
.
obs_source_draw
(
data
.
hour_image
.
texture
,
0
,
0
,
data
.
image
.
cx
,
data
.
image
.
cy
,
false
);
end
obs
.
gs_matrix_pop
()
obs
.
gs_matrix_push
()
obs
.
gs_matrix_translate3f
(
250
,
250
,
0
)
obs
.
gs_matrix_rotaa4f
(
0
.
0
,
0
.
0
,
1
.
0
,
2
*
math.pi
/
60
*
seconds
);
obs
.
gs_matrix_translate3f
(
-
250
,
-
250
,
0
)
while
obs
.
gs_effect_loop
(
effect
,
"Draw"
)
do
obs
.
obs_source_draw
(
data
.
second_image
.
texture
,
0
,
0
,
data
.
image
.
cx
,
data
.
image
.
cy
,
false
);
end
obs
.
gs_matrix_pop
()
obs
.
gs_blend_state_pop
()
end
source_def
.
get_width
=
function
(
data
)
return
500
end
source_def
.
get_height
=
function
(
data
)
return
500
end
function
script_description
()
return
"Adds a \"
Lua
Clock
\
" source which draws an animated analog clock."
end
obs
.
obs_register_source
(
source_def
)
UI/frontend-plugins/frontend-tools/data/scripts/clock-source/dial.png
0 → 100644
浏览文件 @
1c3f18a7
26.4 KB
UI/frontend-plugins/frontend-tools/data/scripts/clock-source/hour.png
0 → 100644
浏览文件 @
1c3f18a7
1.6 KB
UI/frontend-plugins/frontend-tools/data/scripts/clock-source/minute.png
0 → 100644
浏览文件 @
1c3f18a7
1.7 KB
UI/frontend-plugins/frontend-tools/data/scripts/clock-source/second.png
0 → 100644
浏览文件 @
1c3f18a7
2.0 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录