1 个不稳定版本
0.1.0 | 2023年10月19日 |
---|
2 in #图片
475KB
3.5K SLoC
Anipwatch (あにっぷウォッチ)
索引
描述
非常可爱的时钟和计时器。它始终位于桌面顶部并显示动画图片。
LICENSE
- 软件:MIT 协议
- 标志和图标: CC BY 4.0
- 示例中的图片: CC BY-SA 4.0
标志和图标
- 标志:
logo.png
- 图标:
src/icon.png
用法
运行 Anipwatch。
anipwatch /path/to/settings_file.yaml
显示帮助。
anipwatch --help
# or
anipwatch -h
设置文件
查看 示例。
定义主窗口大小
window_size:
width: 480
height: 270
指定保存数据文件的路径。
路径的根是放置设置文件的目录。
save_data_file: "save_file.data"
定义纹理名称并指定它们的文件路径。
路径的根是放置设置文件的目录。
textures:
-
name: "display"
path: "display.png"
-
name: "body_texture_white"
path: "body_texture_white.png"
-
name: "eyes_texture_white"
path: "eyes_texture_white.png"
-
name: "body_texture_red"
path: "body_texture_red.png"
-
name: "eyes_texture_red"
path: "eyes_texture_red.png"
-
name: "body_texture_blue"
path: "body_texture_blue.png"
-
name: "eyes_texture_blue"
path: "eyes_texture_blue.png"
-
name: "numbers"
path: "numbers.png"
-
name: "switch_btn"
path: "switch_btn.png"
-
name: "start_stop_btn"
path: "start_stop_btn.png"
-
name: "reset_btn"
path: "reset_btn.png"
-
name: "quit_btn"
path: "quit_btn.png"
定义皮肤。
skins: []
: 皮肤数组。name: "skin name"
: 定义皮肤名称。display:
: 指定数字放置的位置。texture_name: "texture_name"
: 数字纹理的名称。depth: 0
:0
表示纹理的前端。这个数字越大,纹理越深。regions:
: 指定每个数字放置的位置。centiseconds:
: 指定百分之一秒。d1:
: 第1位数字。x: 440.0
: 此数字的 X 坐标。y: 0.0
: 此数字的 Y 坐标。width: 40.0
: 这个数字的宽度。height: 60.0
: 这个数字的高度。
d2:
: 第二位数字。
seconds:
: 指定秒数。minutes:
: 指定分钟数。hours:
: 指定小时数。
switch_button:
: 时钟/秒表切换按钮。texture_name: "texture_name"
: 此按钮的纹理名称。depth: 0
:0
表示纹理的前端。这个数字越大,纹理越深。regions:
: 指定按钮放置的位置。x: 440.0
: 此按钮的X坐标。y: 0.0
: 此按钮的Y坐标。width: 40.0
: 此按钮的宽度。height: 60.0
: 此按钮的高度。
start_stop_button:
: 秒表的开始/停止按钮。reset_button:
: 秒表的复位按钮。quit_button:
: Anipwatch的退出按钮。animations: []
: 动画图片数组。texture_name: "texture_name"
: 此图片的纹理名称。depth: 0
:0
表示纹理的前端。这个数字越大,纹理越深。
regions:
: 指定此图片放置的位置。x: 440.0
: 此按钮的X坐标。y: 0.0
: 此按钮的Y坐标。width: 40.0
: 此按钮的宽度。height: 60.0
: 此按钮的高度。
frames: 1
: 帧数。fps: 1.0
: 每秒帧数。probability: 0.5
: 执行动画的概率。当动画停止时,每秒绘制一次。 (可选)
skins:
-
name: "skin_white"
display:
texture_name: "numbers"
depth: 0
regions:
centiseconds:
d1:
x: 440.0
y: 0.0
width: 40.0
height: 60.0
d2:
x: 400.0
y: 0.0
width: 40.0
height: 60.0
seconds:
d1:
x: 340.0
y: 0.0
width: 40.0
height: 60.0
d2:
x: 300.0
y: 0.0
width: 40.0
height: 60.0
minutes:
d1:
x: 240.0
y: 0.0
width: 40.0
height: 60.0
d2:
x: 200.0
y: 0.0
width: 40.0
height: 60.0
hours:
d1:
x: 140.0
y: 0.0
width: 40.0
height: 60.0
d2:
x: 100.0
y: 0.0
width: 40.0
height: 60.0
switch_button:
texture_name: "switch_btn"
depth: 2
region:
x: 100.0
y: 60.0
width: 95.0
height: 20.0
start_stop_button:
texture_name: "start_stop_btn"
depth: 3
region:
x: 195.0
y: 60.0
width: 95.0
height: 20.0
reset_button:
texture_name: "reset_btn"
depth: 4
region:
x: 290.0
y: 60.0
width: 95.0
height: 20.0
quit_button:
texture_name: "quit_btn"
depth: 5
region:
x: 385.0
y: 60.0
width: 95.0
height: 20.0
animations:
-
texture_name: "display"
depth: 1
region:
x: 100.0
y: 0.0
width: 380.0
height: 60.0
frames: 1
fps: 1.0
-
texture_name: "body_texture_white"
depth: 7
region:
x: 0.0
y: 0.0
width: 480.0
height: 270.0
frames: 6
fps: 2.0
-
texture_name: "eyes_texture_white"
depth: 6
region:
x: 0.0
y: 0.0
width: 480.0
height: 270.0
frames: 2
fps: 2.0
probability: 0.5
-
name: "skin_red"
display:
texture_name: "numbers"
depth: 0
regions:
centiseconds:
d1:
x: 440.0
y: 0.0
width: 40.0
height: 60.0
d2:
x: 400.0
y: 0.0
width: 40.0
height: 60.0
seconds:
d1:
x: 340.0
y: 0.0
width: 40.0
height: 60.0
d2:
x: 300.0
y: 0.0
width: 40.0
height: 60.0
minutes:
d1:
x: 240.0
y: 0.0
width: 40.0
height: 60.0
d2:
x: 200.0
y: 0.0
width: 40.0
height: 60.0
hours:
d1:
x: 140.0
y: 0.0
width: 40.0
height: 60.0
d2:
x: 100.0
y: 0.0
width: 40.0
height: 60.0
switch_button:
texture_name: "switch_btn"
depth: 2
region:
x: 100.0
y: 60.0
width: 95.0
height: 20.0
start_stop_button:
texture_name: "start_stop_btn"
depth: 3
region:
x: 195.0
y: 60.0
width: 95.0
height: 20.0
reset_button:
texture_name: "reset_btn"
depth: 4
region:
x: 290.0
y: 60.0
width: 95.0
height: 20.0
quit_button:
texture_name: "quit_btn"
depth: 5
region:
x: 385.0
y: 60.0
width: 95.0
height: 20.0
animations:
-
texture_name: "display"
depth: 1
region:
x: 100.0
y: 0.0
width: 380.0
height: 60.0
frames: 1
fps: 1.0
-
texture_name: "body_texture_red"
depth: 7
region:
x: 0.0
y: 0.0
width: 480.0
height: 270.0
frames: 6
fps: 2.0
-
texture_name: "eyes_texture_red"
depth: 6
region:
x: 0.0
y: 0.0
width: 480.0
height: 270.0
frames: 2
fps: 2.0
probability: 0.5
-
name: "skin_blue"
display:
texture_name: "numbers"
depth: 0
regions:
centiseconds:
d1:
x: 440.0
y: 0.0
width: 40.0
height: 60.0
d2:
x: 400.0
y: 0.0
width: 40.0
height: 60.0
seconds:
d1:
x: 340.0
y: 0.0
width: 40.0
height: 60.0
d2:
x: 300.0
y: 0.0
width: 40.0
height: 60.0
minutes:
d1:
x: 240.0
y: 0.0
width: 40.0
height: 60.0
d2:
x: 200.0
y: 0.0
width: 40.0
height: 60.0
hours:
d1:
x: 140.0
y: 0.0
width: 40.0
height: 60.0
d2:
x: 100.0
y: 0.0
width: 40.0
height: 60.0
switch_button:
texture_name: "switch_btn"
depth: 2
region:
x: 100.0
y: 60.0
width: 95.0
height: 20.0
start_stop_button:
texture_name: "start_stop_btn"
depth: 3
region:
x: 195.0
y: 60.0
width: 95.0
height: 20.0
reset_button:
texture_name: "reset_btn"
depth: 4
region:
x: 290.0
y: 60.0
width: 95.0
height: 20.0
quit_button:
texture_name: "quit_btn"
depth: 5
region:
x: 385.0
y: 60.0
width: 95.0
height: 20.0
animations:
-
texture_name: "display"
depth: 1
region:
x: 100.0
y: 0.0
width: 380.0
height: 60.0
frames: 1
fps: 1.0
-
texture_name: "body_texture_blue"
depth: 7
region:
x: 0.0
y: 0.0
width: 480.0
height: 270.0
frames: 6
fps: 2.0
-
texture_name: "eyes_texture_blue"
depth: 6
region:
x: 0.0
y: 0.0
width: 480.0
height: 270.0
frames: 2
fps: 2.0
probability: 0.5
指定默认模式。
clock
: 时钟模式。stopwatch
: 秒表模式。
default_mode: "clock"
指定秒表模式的默认皮肤名称。
default_stopwatch_skin_name: "skin_white"
指定时钟模式的默认皮肤名称。
default_clock_skin_name: "skin_white"
定义在秒表模式下更改皮肤的事件。
stopwatch_events: []
: 事件数组。skin_name: "skin_name"
: 皮肤名称。from:
: 指定更改皮肤的时间。centiseconds: 0
: 百分之一秒。 [0, 99]seconds: 30
: 秒。 [0, 59]minutes: 0
: 分钟。 [0, 59]hours: 0
: 小时。 [0, 99]
stopwatch_events:
-
skin_name: "skin_red"
from:
centiseconds: 0
seconds: 30
minutes: 0
hours: 0
-
skin_name: "skin_blue"
from:
centiseconds: 0
seconds: 0
minutes: 1
hours: 0
-
skin_name: "skin_white"
from:
centiseconds: 0
seconds: 30
minutes: 1
hours: 0
定义在时钟模式下更改皮肤的事件。
clock_events: []
: 事件数组。skin_name: "skin_name"
: 皮肤名称。from:
: 指定更改皮肤的时间。centiseconds: 0
: 百分之一秒。 [0, 99]seconds: 0
: 秒数。[0, 59]minutes: 0
: 分钟。 [0, 59]hours: 8
: 小时。[0, 23]
clock_events:
-
skin_name: "skin_red"
from:
centiseconds: 0
seconds: 0
minutes: 0
hours: 8
-
skin_name: "skin_blue"
from:
centiseconds: 0
seconds: 0
minutes: 1
hours: 16
纹理
至少支持PNG和JPEG。
数字
从左到右排列0到9同样大小的图片。
开关按钮
‘计时器模式转为时钟模式’按钮位于左侧。(显示在计时器模式)
‘时钟模式转为计时器模式’按钮位于左侧。(显示在时钟模式)
其他按钮
每个其他按钮都是简单的图片。
开始和停止按钮,
重置按钮,
退出按钮,
动画图片
从第一帧到最后一帧,从左到右排列同样大小的图片。
运行示例
将当前工作目录更改为examples
并执行以下命令。
cargo run --release -- example_settings.yaml
依赖项
~26–47MB
~553K SLoC