add icon for game
This commit is contained in:
BIN
assets/icon.ico
Normal file
BIN
assets/icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 126 KiB |
BIN
assets/icon.png
Normal file
BIN
assets/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 867 KiB |
@@ -1,4 +1,5 @@
|
||||
import asyncio
|
||||
import os
|
||||
import random
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
@@ -57,6 +58,12 @@ class Front:
|
||||
height_px = self.world.map.height * tile_size + margin * 2 + STATUS_BAR_HEIGHT
|
||||
self.screen = pygame.display.set_mode((width_px, height_px))
|
||||
pygame.display.set_caption(window_title)
|
||||
|
||||
# 设置窗口图标
|
||||
icon_path = "assets/icon.png"
|
||||
if os.path.exists(icon_path):
|
||||
icon = pygame.image.load(icon_path)
|
||||
pygame.display.set_icon(icon)
|
||||
|
||||
self.font = create_font(self.pygame, 16, self.font_path)
|
||||
self.tooltip_font = create_font(self.pygame, 14, self.font_path)
|
||||
|
||||
@@ -40,6 +40,9 @@ if (-not (Test-Path $EntryPy)) {
|
||||
$AssetsPath = Join-Path $RepoRoot "assets"
|
||||
$StaticPath = Join-Path $RepoRoot "static"
|
||||
|
||||
# Icon path
|
||||
$IconPath = Join-Path $AssetsPath "icon.ico"
|
||||
|
||||
# Runtime hook
|
||||
$RuntimeHookPath = Join-Path $ScriptDir "runtime_hook_setcwd.py"
|
||||
|
||||
@@ -76,6 +79,11 @@ if (Test-Path $RuntimeHookPath) {
|
||||
$argsList += @("--runtime-hook", $RuntimeHookPath)
|
||||
}
|
||||
|
||||
# Add icon if available
|
||||
if (Test-Path $IconPath) {
|
||||
$argsList += @("--icon", $IconPath)
|
||||
}
|
||||
|
||||
# Call PyInstaller
|
||||
Push-Location $RepoRoot
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user