Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
68134ad9
宇宙模拟器
项目概览
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看板
提交
68134ad9
编写于
11月 13, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
3d042f44
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
6 deletion
+16
-6
fonts/DroidSansFallback.ttf
fonts/DroidSansFallback.ttf
+0
-0
sim_scenes/func.py
sim_scenes/func.py
+7
-3
sim_scenes/solar_system/halley_comet_sim.py
sim_scenes/solar_system/halley_comet_sim.py
+2
-1
simulators/ursina/ursina_mesh.py
simulators/ursina/ursina_mesh.py
+7
-2
未找到文件。
fonts/DroidSansFallback.ttf
0 → 100644
浏览文件 @
68134ad9
文件已添加
sim_scenes/func.py
浏览文件 @
68134ad9
...
@@ -409,7 +409,7 @@ def create_3d_card(left=-.885, top=0.495, width=0.02, height=0.02):
...
@@ -409,7 +409,7 @@ def create_3d_card(left=-.885, top=0.495, width=0.02, height=0.02):
return
panel
return
panel
def
create_text_panel
(
width
=
0.35
,
height
=
.
5
):
def
create_text_panel
(
width
=
0.35
,
height
=
.
5
,
font
=
None
):
# 创建一个 Panel 组件
# 创建一个 Panel 组件
from
ursina
import
Text
,
Panel
,
color
,
camera
,
Vec3
,
window
from
ursina
import
Text
,
Panel
,
color
,
camera
,
Vec3
,
window
from
simulators.ursina.ursina_config
import
UrsinaConfig
from
simulators.ursina.ursina_config
import
UrsinaConfig
...
@@ -426,14 +426,18 @@ def create_text_panel(width=0.35, height=.5):
...
@@ -426,14 +426,18 @@ def create_text_panel(width=0.35, height=.5):
position
=
(
-
.
49
*
aspect_ratio
,
0.3
,
0
),
position
=
(
-
.
49
*
aspect_ratio
,
0.3
,
0
),
alpha
=
0.5
alpha
=
0.5
)
)
if
font
is
None
:
font
=
UrsinaConfig
.
CN_FONT
else
:
from
common.func
import
find_file
font
=
find_file
(
f
"fonts/
{
font
}
"
,
UrsinaConfig
.
CN_FONT
)
# 创建一个 Text 组件用于显示消息
# 创建一个 Text 组件用于显示消息
text
=
Text
(
text
=
Text
(
parent
=
panel
,
parent
=
panel
,
text
=
''
,
text
=
''
,
origin
=
(
-
.
5
,
.
5
,
-
.
5
),
origin
=
(
-
.
5
,
.
5
,
-
.
5
),
scale
=
(
height
*
5
,
width
*
5
),
scale
=
(
height
*
5
,
width
*
5
),
font
=
UrsinaConfig
.
CN_FONT
,
font
=
font
,
# background=True,
# background=True,
# background_color=color.clear
# background_color=color.clear
)
)
...
...
sim_scenes/solar_system/halley_comet_sim.py
浏览文件 @
68134ad9
...
@@ -136,6 +136,7 @@ class HalleyCometSim(HalleyCometSimBase):
...
@@ -136,6 +136,7 @@ class HalleyCometSim(HalleyCometSimBase):
label
=
create_label
(
trail
,
label
=
year
,
pos
=
_pos
,
label
=
create_label
(
trail
,
label
=
year
,
pos
=
_pos
,
label_color
=
label_color
,
label_color
=
label_color
,
font
=
"DroidSansFallback.ttf"
,
scale
=
scale
,
alpha
=
1.0
,
background
=
background
scale
=
scale
,
alpha
=
1.0
,
background
=
background
)
)
label
.
set_light_off
()
label
.
set_light_off
()
...
@@ -369,7 +370,7 @@ class HalleyCometSim(HalleyCometSimBase):
...
@@ -369,7 +370,7 @@ class HalleyCometSim(HalleyCometSimBase):
# 创建太阳系天体的真实轨迹(太阳和哈雷彗星除外)
# 创建太阳系天体的真实轨迹(太阳和哈雷彗星除外)
self
.
create_orbit_lines
()
self
.
create_orbit_lines
()
# 创建信息显示面板
# 创建信息显示面板
self
.
text_panel
=
create_text_panel
()
self
.
text_panel
=
create_text_panel
(
font
=
"DroidSansFallback.ttf"
)
def
on_timer_changed
(
self
,
time_data
):
def
on_timer_changed
(
self
,
time_data
):
"""
"""
...
...
simulators/ursina/ursina_mesh.py
浏览文件 @
68134ad9
...
@@ -194,14 +194,19 @@ def create_arrow(height=0.5, width=0.1):
...
@@ -194,14 +194,19 @@ def create_arrow(height=0.5, width=0.1):
return
arrow_mesh
return
arrow_mesh
def
create_label
(
parent
,
label
,
pos
,
label_color
,
scale
=
50
,
alpha
=
1.0
,
background
=
False
):
def
create_label
(
parent
,
label
,
pos
,
label_color
,
scale
=
50
,
alpha
=
1.0
,
background
=
False
,
font
=
None
):
if
isinstance
(
label_color
,
tuple
)
or
isinstance
(
label_color
,
list
):
if
isinstance
(
label_color
,
tuple
)
or
isinstance
(
label_color
,
list
):
label_color
=
conv_to_vec4_color
(
label_color
)
label_color
=
conv_to_vec4_color
(
label_color
)
if
alpha
<
1
:
if
alpha
<
1
:
label_color
[
3
]
=
alpha
label_color
[
3
]
=
alpha
if
font
is
None
:
font
=
UrsinaConfig
.
CN_FONT
else
:
from
common.func
import
find_file
font
=
find_file
(
f
"fonts/
{
font
}
"
,
UrsinaConfig
.
CN_FONT
)
text
=
Text
(
label
,
parent
=
parent
,
scale
=
scale
,
billboard
=
True
,
color
=
label_color
,
text
=
Text
(
label
,
parent
=
parent
,
scale
=
scale
,
billboard
=
True
,
color
=
label_color
,
position
=
Vec3
(
pos
)
+
Vec3
(
1
,
1
,
1
),
alpha
=
alpha
,
position
=
Vec3
(
pos
)
+
Vec3
(
1
,
1
,
1
),
alpha
=
alpha
,
font
=
UrsinaConfig
.
CN_FONT
,
background
=
background
)
font
=
font
,
background
=
background
)
return
text
return
text
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录