Added a lots of the file to write the pixel game but due to some problem ,i dicide to change sdl3 to sfml,a more modern lib

This commit is contained in:
2025-12-21 14:58:33 +08:00
parent 96b005e2ef
commit 86dce63e74
15 changed files with 443 additions and 51 deletions

View File

@@ -3,11 +3,22 @@
// 统一管理配置
struct GameConfig {
int windowWidth = 1600;
int windowHeight = 900;
/*
tileSize: 16x16 每个格子的逻辑大小(像素)
屏幕 = 20 × 11 tiles = 320x176 逻辑分辨率
*/
int logicalWidth = 320;
int logicalHeight = 180;
std::string windowTitle = "孢子棋";
bool vsync = true;
int uiScale = 2;
int scale = 2;
/*
1280x720 scale 4
1920x1080 scale 6
2560x1440 scale 8
3840x2160 scale 12
*/
} ;
// 获取棋盘渲染区域信息(用于坐标转换)
@@ -15,4 +26,22 @@ struct BoardArea {
int x, y; // 左上角像素坐标
int cellSize; // 每格像素大小
int rows, cols; // 行列数
};
};
// ui 相关常量
namespace UI
{
constexpr int TopBarHeight = 16;
constexpr int HotbarHeight = 32;
constexpr int ButtonSize = 16;
constexpr int SlotSize = 16;
constexpr int PanelPadding = 4;
constexpr int FontHeight = 8;
constexpr int StartWindowWidth = 320 * 4; // 初始窗口宽度(像素)
constexpr int StartWindowHeight = 180 * 4; // 初始窗口高度(像素)
// 字体大小(逻辑像素)
constexpr int DIALOG_FONT_SIZE = 14;
constexpr int UI_SMALL_FONT_SIZE = 8;
constexpr int UI_NORMAL_FONT_SIZE = 12;
constexpr int UI_LARGE_FONT_SIZE = 16;
}