Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
f6aa7c8b
宇宙模拟器
项目概览
Python_超人
/
宇宙模拟器
通知
19
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
宇宙模拟器
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
f6aa7c8b
编写于
12月 30, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
e4f1cd27
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
8 deletion
+18
-8
sim_scenes/featured/jupiter_moon_protects_earth.py
sim_scenes/featured/jupiter_moon_protects_earth.py
+4
-1
sim_scenes/universe_sim_scenes.py
sim_scenes/universe_sim_scenes.py
+4
-1
simulators/ursina_simulator.py
simulators/ursina_simulator.py
+2
-1
tools/sim_video_cap.bat
tools/sim_video_cap.bat
+1
-1
tools/sim_video_cap.py
tools/sim_video_cap.py
+7
-4
未找到文件。
sim_scenes/featured/jupiter_moon_protects_earth.py
浏览文件 @
f6aa7c8b
...
...
@@ -241,7 +241,10 @@ class JupiterMoonProtectsEarthSim(UniverseSimScenes):
camera_look_at
(
self
.
sun
)
def
on_ready
(
self
):
from
ursina
import
application
from
ursina
import
application
,
window
# window.title = '宇宙模拟器(universe sim)'
# 运行前触发
self
.
text_panel
=
create_text_panel
(
font
=
"fonts/DroidSansFallback.ttf"
,
font_scale
=
1.3
)
self
.
text_panel
.
text
=
self
.
colliding_info
%
(
0
,
"0.0%"
,
...
...
sim_scenes/universe_sim_scenes.py
浏览文件 @
f6aa7c8b
...
...
@@ -8,7 +8,7 @@
# ==============================================================================
from
objs
import
CoreValagaClas
import
sys
from
ursina
import
application
from
ursina
import
application
,
window
class
UniverseSimScenes
:
...
...
@@ -30,6 +30,9 @@ class UniverseSimScenes:
cls
.
record_rate
=
2
UniverseSimScenes
.
screen_record
=
True
application
.
time_scale
=
0.00001
# from ursina import application, window
window
.
title
=
"rec_"
+
sys
.
argv
[
1
]
instance
=
super
().
__new__
(
cls
)
return
instance
...
...
simulators/ursina_simulator.py
浏览文件 @
f6aa7c8b
...
...
@@ -39,7 +39,8 @@ class UrsinaSimulator(Simulator):
def
__init__
(
self
,
bodies_sys
:
System
):
# window.borderless = False
window
.
title
=
'宇宙模拟器(universe sim)'
# 'universe_sim' # '宇宙模拟器'
if
not
str
(
window
.
title
).
startswith
(
"rec_"
):
window
.
title
=
'宇宙模拟器(universe sim)'
# 'universe_sim' # '宇宙模拟器'
icon
=
find_file
(
"images/icon.ico"
)
window
.
icon
=
icon
self
.
app
=
Ursina
()
...
...
tools/sim_video_cap.bat
浏览文件 @
f6aa7c8b
...
...
@@ -21,6 +21,6 @@ cd %SimFilePath%
start
python
-m
%SimFileName%
%
3
cd
%SimDir%
\tools
python
-m
sim_video_cap
--save
_name
=
%param3
%
--wait
=
%param4
%
python
-m
sim_video_cap
--save
_name
=
%param3
%
--wait
=
%param4
%
--window
_name
=
rec_
%param3
%
tools/sim_video_cap.py
浏览文件 @
f6aa7c8b
...
...
@@ -11,7 +11,7 @@ import win32api
import
traceback
def
get_window_handle
(
window_name
=
"宇宙模拟器(universe sim)"
):
def
get_window_handle
(
window_name
):
"""
获取模拟器窗口句柄
@param window_name:
...
...
@@ -35,6 +35,7 @@ def get_args():
parser
.
add_argument
(
'--total_time'
,
type
=
int
,
default
=
10000000
,
help
=
'video total time'
)
parser
.
add_argument
(
'--save_name'
,
type
=
str
,
default
=
'jupiter_moon_protects_earth7.mp4'
,
help
=
'save file name'
)
parser
.
add_argument
(
'--wait'
,
type
=
int
,
default
=
0
,
help
=
'wait for recoding'
)
parser
.
add_argument
(
'--window_name'
,
type
=
str
,
default
=
"宇宙模拟器(universe sim)"
,
help
=
'宇宙模拟器(universe sim)'
)
# parser.add_argument('--screen_type', default=0, type=int, choices=[0, 1], help='1: full screen, 0: region screen')
args
=
parser
.
parse_args
()
...
...
@@ -44,7 +45,8 @@ def get_args():
args
.
save_name
=
rename_exists
(
args
.
save_name
)
print
(
"save_name:"
,
args
.
save_name
)
print
(
"wait:"
,
args
.
wait
)
print
(
"save_name:"
,
args
.
save_name
)
print
(
"window_name:"
,
args
.
window_name
)
if
args
.
save_name
==
''
:
args
.
save_name
=
'video.mp4'
return
args
...
...
@@ -107,10 +109,11 @@ def wait_sec(sec=0):
def
sim_window_screen_shot
(
wait_ses
=-
1
,
retry_times
=
3
):
global
args
times
=
wait_ses
*
100
while
True
:
handle
,
desktop_dc
,
img_dc
,
img
=
None
,
None
,
None
,
None
handle
=
get_window_handle
()
handle
=
get_window_handle
(
args
.
window_name
)
if
handle
>
0
:
desktop_dc
=
win32gui
.
GetWindowDC
(
handle
)
width
,
height
=
get_window_size
(
handle
)
...
...
@@ -170,7 +173,7 @@ def check_img(img):
if
__name__
==
'__main__'
:
args
=
get_args
()
handle
=
get_window_handle
()
handle
=
get_window_handle
(
args
.
window_name
)
# print(get_args())
print
(
"请在10秒内打开模拟器"
)
img
=
sim_window_screen_shot
(
10
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录