Skip to content

Commit 29b20f7

Browse files
authored
feat: 新增「猫咪设置 > 模型设置 > 最大帧率」配置项 (#934)
1 parent 3338ff3 commit 29b20f7

9 files changed

Lines changed: 40 additions & 13 deletions

File tree

src/locales/en-US.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"motionSound": "Motion Sound",
2525
"behavior": "Motions and Expressions",
2626
"autoReleaseDelay": "Auto Release Delay",
27-
"hideOnHover": "Hide on Hover"
27+
"hideOnHover": "Hide on Hover",
28+
"maxFPS": "Max Frame Rate"
2829
},
2930
"hints": {
3031
"mirrorMode": "When enabled, the model will be mirrored horizontally.",
@@ -36,7 +37,8 @@
3637
"keepInScreen": "When enabled, the window automatically stays within the screen boundaries.",
3738
"windowSize": "Move mouse to window edge, or hold Shift and right-drag to resize.",
3839
"autoReleaseDelay": "On Windows, some system keys cannot capture release events and will auto-release after timeout.",
39-
"hideOnHover": "When enabled, the window hides when mouse hovers over it."
40+
"hideOnHover": "When enabled, the window hides when mouse hovers over it.",
41+
"maxFPS": "Limit the maximum frame rate for model rendering. Lowering the frame rate can reduce CPU/GPU usage."
4042
}
4143
},
4244
"general": {

src/locales/pt-BR.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"motionSound": "Som de Ação",
2525
"behavior": "Movimentos e Expressões",
2626
"autoReleaseDelay": "Atraso de Liberação Automática",
27-
"hideOnHover": "Ocultar ao Passar o Mouse"
27+
"hideOnHover": "Ocultar ao Passar o Mouse",
28+
"maxFPS": "Taxa Máxima de Quadros"
2829
},
2930
"hints": {
3031
"mirrorMode": "Quando ativado, o modelo será invertido horizontalmente.",
@@ -36,7 +37,8 @@
3637
"keepInScreen": "Quando ativado, a janela permanece automaticamente dentro dos limites da tela.",
3738
"windowSize": "Mova o mouse para a borda da janela ou segure Shift e arraste com o botão direito para redimensionar.",
3839
"autoReleaseDelay": "Devido ao Windows não capturar eventos de liberação de certas teclas de nível do sistema, elas serão automaticamente tratadas como liberadas após um tempo limite.",
39-
"hideOnHover": "Quando ativado, a janela será ocultada quando o mouse passar sobre ela."
40+
"hideOnHover": "Quando ativado, a janela será ocultada quando o mouse passar sobre ela.",
41+
"maxFPS": "Limitar a taxa máxima de quadros para renderização do modelo. Reduzir a taxa de quadros pode diminuir o uso de CPU/GPU."
4042
}
4143
},
4244
"general": {

src/locales/vi-VN.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"motionSound": "Âm thanh hành động",
2525
"behavior": "Hành động và Biểu cảm",
2626
"autoReleaseDelay": "Độ trễ tự động nhả phím",
27-
"hideOnHover": "Ẩn khi di chuột"
27+
"hideOnHover": "Ẩn khi di chuột",
28+
"maxFPS": "Tốc độ khung hình tối đa"
2829
},
2930
"hints": {
3031
"mirrorMode": "Bật để lật ngang mô hình.",
@@ -36,7 +37,8 @@
3637
"keepInScreen": "Khi bật, cửa sổ sẽ tự động giữ trong ranh giới màn hình.",
3738
"windowSize": "Di chuyển chuột đến mép cửa sổ hoặc giữ Shift và kéo chuột phải để thay đổi kích thước.",
3839
"autoReleaseDelay": "Do Windows không bắt được sự kiện nhả của một số phím hệ thống, các phím đó sẽ được tự động xem như đã nhả sau khi hết thời gian chờ.",
39-
"hideOnHover": "Khi bật, cửa sổ sẽ ẩn khi chuột di chuyển vào."
40+
"hideOnHover": "Khi bật, cửa sổ sẽ ẩn khi chuột di chuyển vào.",
41+
"maxFPS": "Giới hạn tốc độ khung hình tối đa cho việc render mô hình. Giảm tốc độ khung hình có thể giảm mức sử dụng CPU/GPU."
4042
}
4143
},
4244
"general": {

src/locales/zh-CN.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"motionSound": "动作音效",
2525
"behavior": "动作与表情",
2626
"autoReleaseDelay": "按键自动释放延迟",
27-
"hideOnHover": "鼠标移入隐藏"
27+
"hideOnHover": "鼠标移入隐藏",
28+
"maxFPS": "最大帧率"
2829
},
2930
"hints": {
3031
"mirrorMode": "启用后,模型将水平镜像翻转。",
@@ -36,7 +37,8 @@
3637
"keepInScreen": "启用后,窗口会自动调整位置,防止超出屏幕边界。",
3738
"windowSize": "将鼠标移至窗口边缘,或按住 Shift 并右键拖动,也可以调整窗口大小。",
3839
"autoReleaseDelay": "由于 Windows 下部分系统级按键无法捕获释放事件,超时后将自动视为已释放。",
39-
"hideOnHover": "启用后,鼠标悬停在窗口上时,窗口会隐藏。"
40+
"hideOnHover": "启用后,鼠标悬停在窗口上时,窗口会隐藏。",
41+
"maxFPS": "限制模型渲染的最大帧率,降低帧率可以减少 CPU/GPU 占用。"
4042
}
4143
},
4244
"general": {

src/locales/zh-TW.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"motionSound": "動作音效",
2525
"behavior": "動作與表情",
2626
"autoReleaseDelay": "按鍵自動釋放延遲",
27-
"hideOnHover": "滑鼠游標移入隱藏"
27+
"hideOnHover": "滑鼠游標移入隱藏",
28+
"maxFPS": "最大幀率"
2829
},
2930
"hints": {
3031
"mirrorMode": "啟用後,模型將水平鏡像翻轉。",
@@ -36,7 +37,8 @@
3637
"keepInScreen": "啟用後,視窗會自動調整位置,防止超出螢幕邊界。",
3738
"windowSize": "將滑鼠游標移至視窗邊緣,或按住 Shift 並右鍵拖曳,也可以調整視窗大小。",
3839
"autoReleaseDelay": "由於 Windows 下部份系統級按鍵無法擷取釋放事件,超時後將自動視為已釋放。",
39-
"hideOnHover": "啟用後,滑鼠游標懸停在視窗上時,視窗會隱藏。"
40+
"hideOnHover": "啟用後,滑鼠游標懸停在視窗上時,視窗會隱藏。",
41+
"maxFPS": "限制模型渲染的最大幀率,降低幀率可以減少 CPU/GPU 佔用。"
4042
}
4143
},
4244
"general": {

src/pages/main/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ watch(() => catStore.window.alwaysOnTop, setAlwaysOnTop, { immediate: true })
123123
124124
watch(() => generalStore.app.taskbarVisible, setTaskbarVisibility, { immediate: true })
125125
126-
watch(() => catStore.model.motionSound, (value) => {
127-
live2d.setMotionSoundEnabled(value)
128-
}, { immediate: true })
126+
watch(() => catStore.model.motionSound, live2d.setMotionSoundEnabled, { immediate: true })
127+
128+
watch(() => catStore.model.maxFPS, live2d.setMaxFPS, { immediate: true })
129129
130130
useTauriListen<MotionInfo>(LISTEN_KEY.START_MOTION, ({ payload }) => {
131131
live2d.startMotion(payload)

src/pages/preference/components/cat/index.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ const catStore = useCatStore()
5050
class="w-28"
5151
/>
5252
</ProListItem>
53+
54+
<ProListItem
55+
:description="$t('pages.preference.cat.hints.maxFPS')"
56+
:title="$t('pages.preference.cat.labels.maxFPS')"
57+
>
58+
<InputNumber
59+
v-model:value="catStore.model.maxFPS"
60+
class="w-20"
61+
:min="0"
62+
/>
63+
</ProListItem>
5364
</ProList>
5465

5566
<ProList :title="$t('pages.preference.cat.labels.windowSettings')">

src/stores/cat.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface CatStore {
88
motionSound: boolean
99
behavior: boolean
1010
autoReleaseDelay: number
11+
maxFPS: number
1112
}
1213
window: {
1314
visible: boolean
@@ -51,6 +52,7 @@ export const useCatStore = defineStore('cat', () => {
5152
motionSound: true,
5253
behavior: true,
5354
autoReleaseDelay: 3,
55+
maxFPS: 60,
5456
})
5557

5658
const window = reactive<CatStore['window']>({

src/utils/live2d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ class Live2d {
129129
public setMotionSoundEnabled(enabled: boolean) {
130130
Config.MotionSound = enabled
131131
}
132+
133+
public setMaxFPS(fps: number) {
134+
Ticker.shared.maxFPS = fps
135+
}
132136
}
133137

134138
const live2d = new Live2d()

0 commit comments

Comments
 (0)