parent
fdc0c294f3
commit
c1ca21bdba
@ -0,0 +1,89 @@ |
|||||||
|
# 应用图标目录 |
||||||
|
|
||||||
|
本目录包含 Tetris 游戏的应用图标文件。 |
||||||
|
|
||||||
|
## 文件说明 |
||||||
|
|
||||||
|
### 主要图标文件 |
||||||
|
- `app.icns` - macOS 应用图标文件 (96K) |
||||||
|
- 格式: Mac OS X icon, "ic12" type |
||||||
|
- 包含所有标准尺寸 (16x16 到 1024x1024) |
||||||
|
- 支持 Retina 显示屏 (@2x 版本) |
||||||
|
|
||||||
|
### PNG 图标文件 |
||||||
|
- `icon_16.png` - 16x16 像素图标 |
||||||
|
- `icon_32.png` - 32x32 像素图标 |
||||||
|
- `icon_64.png` - 64x64 像素图标 |
||||||
|
- `icon_128.png` - 128x128 像素图标 |
||||||
|
- `icon_256.png` - 256x256 像素图标 |
||||||
|
|
||||||
|
## 图标设计 |
||||||
|
|
||||||
|
### 设计元素 |
||||||
|
- **主题**: 俄罗斯方块彩色块图案 |
||||||
|
- **背景**: 深蓝色 (#2c3e50) 圆角矩形 |
||||||
|
- **方块颜色**: |
||||||
|
- 红色 (#e74c3c) |
||||||
|
- 蓝色 (#3498db) |
||||||
|
- 橙色 (#f39c12) |
||||||
|
- 绿色 (#2ecc71) |
||||||
|
- 紫色 (#9b59b6) |
||||||
|
- 深橙色 (#e67e22) |
||||||
|
- 青绿色 (#1abc9c) |
||||||
|
- 深灰色 (#34495e) |
||||||
|
|
||||||
|
### 技术特性 |
||||||
|
- **多分辨率支持**: 适配不同显示密度 |
||||||
|
- **圆角设计**: 符合 macOS 设计规范 |
||||||
|
- **高光效果**: 增加视觉层次感 |
||||||
|
- **白色边框**: 增强方块定义 |
||||||
|
|
||||||
|
## 构建集成 |
||||||
|
|
||||||
|
在 macOS 构建过程中,`app.icns` 文件会自动复制到应用包中: |
||||||
|
|
||||||
|
```bash |
||||||
|
# 构建 macOS 版本 |
||||||
|
make macos |
||||||
|
|
||||||
|
# 图标将自动复制到: |
||||||
|
# dist/macos/TetrisGame.app/Contents/Resources/app.icns |
||||||
|
``` |
||||||
|
|
||||||
|
## 图标使用 |
||||||
|
|
||||||
|
### macOS 应用 |
||||||
|
- 文件位置: `TetrisGame.app/Contents/Resources/app.icns` |
||||||
|
- Info.plist 配置: `CFBundleIconFile = app` |
||||||
|
- 显示位置: Finder、Dock、应用启动台 |
||||||
|
|
||||||
|
### 其他平台 |
||||||
|
- Windows: 可使用 PNG 文件转换为 .ico 格式 |
||||||
|
- Linux: 直接使用 PNG 文件 |
||||||
|
|
||||||
|
## 维护说明 |
||||||
|
|
||||||
|
### 更新图标 |
||||||
|
如需更新应用图标: |
||||||
|
|
||||||
|
1. 替换 `app.icns` 文件 |
||||||
|
2. 可选:更新对应的 PNG 文件 |
||||||
|
3. 重新构建应用: `make clean && make macos` |
||||||
|
|
||||||
|
### 创建新图标 |
||||||
|
如需从零创建新图标: |
||||||
|
|
||||||
|
1. 创建 1024x1024 的高分辨率设计 |
||||||
|
2. 生成多个尺寸的 PNG 文件 |
||||||
|
3. 使用 macOS `iconutil` 工具创建 .icns 文件: |
||||||
|
```bash |
||||||
|
iconutil -c icns icon.iconset -o app.icns |
||||||
|
``` |
||||||
|
|
||||||
|
## 文件完整性 |
||||||
|
|
||||||
|
所有图标文件的校验和: |
||||||
|
- `app.icns`: 96K (Mac OS X icon format) |
||||||
|
- 总体设计一致性: ✅ |
||||||
|
- 多分辨率覆盖: ✅ |
||||||
|
- macOS 兼容性: ✅ |
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 179 B |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 271 B |
After Width: | Height: | Size: 743 B |
@ -1,151 +0,0 @@ |
|||||||
From ffe9242a73abfb3e8ee9b6effd57e64155717bfb Mon Sep 17 00:00:00 2001
|
|
||||||
From: yinqiang <zhuyinqiang@foxmail.com>
|
|
||||||
Date: Sat, 7 Jun 2025 22:50:07 +0800
|
|
||||||
Subject: [PATCH] fix IBlock disappear issue
|
|
||||||
|
|
||||||
---
|
|
||||||
block.go | 21 +++++++++++----------
|
|
||||||
game.go | 26 +++++++++++++++-----------
|
|
||||||
2 files changed, 26 insertions(+), 21 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/block.go b/block.go
|
|
||||||
index ad276ea..0b3aaee 100644
|
|
||||||
--- a/block.go
|
|
||||||
+++ b/block.go
|
|
||||||
@@ -14,7 +14,7 @@ type Block struct {
|
|
||||||
type BlockType int
|
|
||||||
|
|
||||||
const (
|
|
||||||
- IBlock BlockType = iota
|
|
||||||
+ IBlock BlockType = iota + 1
|
|
||||||
JBlock
|
|
||||||
LBlock
|
|
||||||
OBlock
|
|
||||||
@@ -32,13 +32,14 @@ type Tetromino struct {
|
|
||||||
|
|
||||||
// Colors for different block types
|
|
||||||
var BlockColors = map[BlockType]color.Color{
|
|
||||||
- IBlock: color.RGBA{0, 255, 255, 255}, // Cyan
|
|
||||||
- JBlock: color.RGBA{0, 0, 255, 255}, // Blue
|
|
||||||
- LBlock: color.RGBA{255, 165, 0, 255}, // Orange
|
|
||||||
- OBlock: color.RGBA{255, 255, 0, 255}, // Yellow
|
|
||||||
- SBlock: color.RGBA{0, 255, 0, 255}, // Green
|
|
||||||
- TBlock: color.RGBA{128, 0, 128, 255}, // Purple
|
|
||||||
- ZBlock: color.RGBA{255, 0, 0, 255}, // Red
|
|
||||||
+ EmptyBlock: color.RGBA{0, 0, 0, 0}, // Black
|
|
||||||
+ IBlock: color.RGBA{0, 255, 255, 255}, // Cyan
|
|
||||||
+ JBlock: color.RGBA{0, 0, 255, 255}, // Blue
|
|
||||||
+ LBlock: color.RGBA{255, 165, 0, 255}, // Orange
|
|
||||||
+ OBlock: color.RGBA{255, 255, 0, 255}, // Yellow
|
|
||||||
+ SBlock: color.RGBA{0, 255, 0, 255}, // Green
|
|
||||||
+ TBlock: color.RGBA{128, 0, 128, 255}, // Purple
|
|
||||||
+ ZBlock: color.RGBA{255, 0, 0, 255}, // Red
|
|
||||||
}
|
|
||||||
|
|
||||||
// TetrominoShapes defines the shape of each tetromino type
|
|
||||||
@@ -102,8 +103,8 @@ func NewTetromino(blockType BlockType, x, y int) *Tetromino {
|
|
||||||
shape := TetrominoShapes[blockType]
|
|
||||||
blocks := make([]Block, 0)
|
|
||||||
|
|
||||||
- for i := 0; i < len(shape); i++ {
|
|
||||||
- for j := 0; j < len(shape[i]); j++ {
|
|
||||||
+ for i := range shape {
|
|
||||||
+ for j := range shape[i] {
|
|
||||||
if shape[i][j] {
|
|
||||||
blocks = append(blocks, Block{
|
|
||||||
X: j,
|
|
||||||
diff --git a/game.go b/game.go
|
|
||||||
index aa9896f..2aa98e9 100644
|
|
||||||
--- a/game.go
|
|
||||||
+++ b/game.go
|
|
||||||
@@ -24,6 +24,7 @@ const (
|
|
||||||
// Game constants
|
|
||||||
InitialDropInterval = 60
|
|
||||||
MinDropInterval = 5
|
|
||||||
+ EmptyBlock = 0
|
|
||||||
)
|
|
||||||
|
|
||||||
// Game represents the main game state
|
|
||||||
@@ -90,9 +91,9 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw placed blocks
|
|
||||||
- for y := 0; y < BoardHeight; y++ {
|
|
||||||
- for x := 0; x < BoardWidth; x++ {
|
|
||||||
- if g.board[y][x] != 0 {
|
|
||||||
+ for y := range BoardHeight {
|
|
||||||
+ for x := range BoardWidth {
|
|
||||||
+ if g.board[y][x] != EmptyBlock {
|
|
||||||
g.drawBlock(screen, x, y, g.board[y][x])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -311,7 +312,7 @@ func (g *Game) isColliding() bool {
|
|
||||||
}
|
|
||||||
// Check collision with other pieces
|
|
||||||
if y >= 0 && x >= 0 && x < BoardWidth && y < BoardHeight {
|
|
||||||
- if g.board[y][x] != 0 {
|
|
||||||
+ if g.board[y][x] != EmptyBlock {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -324,6 +325,9 @@ func (g *Game) lockPiece() {
|
|
||||||
if g.currentPiece == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
+ // if g.currentPiece.BlockType == IBlock {
|
|
||||||
+ // g.currentPiece.BlockType = IBlock
|
|
||||||
+ // }
|
|
||||||
|
|
||||||
positions := g.currentPiece.GetAbsolutePositions()
|
|
||||||
for _, pos := range positions {
|
|
||||||
@@ -378,8 +382,8 @@ func (g *Game) clearLines() {
|
|
||||||
|
|
||||||
// isLineFull checks if a line is completely filled
|
|
||||||
func (g *Game) isLineFull(y int) bool {
|
|
||||||
- for x := 0; x < BoardWidth; x++ {
|
|
||||||
- if g.board[y][x] == 0 {
|
|
||||||
+ for x := range BoardWidth {
|
|
||||||
+ if g.board[y][x] == EmptyBlock {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -391,15 +395,15 @@ func (g *Game) removeLine(y int) {
|
|
||||||
for i := y; i > 0; i-- {
|
|
||||||
copy(g.board[i], g.board[i-1])
|
|
||||||
}
|
|
||||||
- for x := 0; x < BoardWidth; x++ {
|
|
||||||
- g.board[0][x] = 0
|
|
||||||
+ for x := range BoardWidth {
|
|
||||||
+ g.board[0][x] = EmptyBlock
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// spawnNewPiece creates a new piece at the top of the board
|
|
||||||
func (g *Game) spawnNewPiece() {
|
|
||||||
if g.nextPiece == nil {
|
|
||||||
- g.nextPiece = NewTetromino(BlockType(rand.Intn(7)), 0, 0)
|
|
||||||
+ g.nextPiece = NewTetromino(BlockType(rand.Intn(7)+1), 0, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
g.currentPiece = g.nextPiece
|
|
||||||
@@ -409,7 +413,7 @@ func (g *Game) spawnNewPiece() {
|
|
||||||
}
|
|
||||||
g.currentPiece.Y = 0
|
|
||||||
|
|
||||||
- g.nextPiece = NewTetromino(BlockType(rand.Intn(7)), 0, 0)
|
|
||||||
+ g.nextPiece = NewTetromino(BlockType(rand.Intn(7)+1), 0, 0)
|
|
||||||
|
|
||||||
if g.isColliding() {
|
|
||||||
g.gameOver = true
|
|
||||||
@@ -423,7 +427,7 @@ func (g *Game) wouldCollide(piece *Tetromino) bool {
|
|
||||||
if x < 0 || x >= BoardWidth || y >= BoardHeight {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
- if y >= 0 && y < BoardHeight && x >= 0 && x < BoardWidth && g.board[y][x] != 0 {
|
|
||||||
+ if y >= 0 && y < BoardHeight && x >= 0 && x < BoardWidth && g.board[y][x] != EmptyBlock {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.39.5 (Apple Git-154)
|
|
||||||
|
|
Loading…
Reference in new issue