Files
Frostbite2D/Game/include/map/GameDataLoader.h
Lenheart b5c432e77a feat: 添加游戏核心模块,包括地图、角色、场景和世界管理
实现游戏基础架构,包含以下主要功能:
- 地图系统:支持地图加载、图层管理和相机控制
- 角色系统:实现角色装备、动画和行为管理
- 场景系统:提供测试场景和世界场景切换
- 世界管理:处理城镇和区域切换逻辑
- 数据加载:添加角色和装备配置加载器

这些改动为游戏开发奠定了基础框架,支持后续功能扩展
2026-04-02 23:32:44 +08:00

77 lines
1.7 KiB
C++

#pragma once
#include <frostbite2D/types/type_math.h>
#include <map>
#include <string>
#include <vector>
namespace frostbite2D::game {
struct AreaConfig {
std::string mapPath;
std::string mapType;
Vec2 generatePos = Vec2(-1.0f, -1.0f);
};
struct TownConfig {
std::string townName;
std::string enteringTitle;
std::string enteringCutscene;
int needQuestId = -1;
int needLevel = -1;
std::map<int, AreaConfig> areas;
};
struct BackgroundAnimationConfig {
std::string filename;
std::string layer;
std::string order;
};
struct MapAnimationConfig {
std::string filename;
std::string layer;
int xPos = 0;
int yPos = 0;
int zPos = 0;
};
struct MoveAreaTarget {
int town = -2;
int area = -2;
};
struct TileInfo {
std::string spritePath;
int spriteIndex = 0;
};
struct MapConfig {
std::string name;
std::string mapPath;
std::string mapDir;
int backgroundPos = 0;
Vec2 tilePos = Vec2::Zero();
int farSightScroll = 100;
bool hasCameraLimit = false;
int cameraLimitMinX = -1;
int cameraLimitMaxX = -1;
int cameraLimitMinY = -1;
int cameraLimitMaxY = -1;
std::vector<std::string> tilePaths;
std::vector<std::string> extendedTilePaths;
std::vector<BackgroundAnimationConfig> backgroundAnimations;
std::vector<MapAnimationConfig> mapAnimations;
std::vector<std::string> soundIds;
std::vector<Rect> virtualMovableAreas;
std::vector<Rect> townMovableAreas;
std::vector<MoveAreaTarget> townMovableAreaTargets;
};
std::map<int, std::string> loadTownList();
bool loadTownConfig(const std::string& townPath, TownConfig& outConfig);
bool loadMapConfig(const std::string& mapPath, MapConfig& outConfig);
bool loadTileInfo(const std::string& path, TileInfo& outInfo);
} // namespace frostbite2D::game