feat: 瓦片地图渲染功能实现
This commit is contained in:
@@ -120,6 +120,7 @@
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>..\ThirdParty\cJSON\include;..\ThirdParty\SDL2\include;..\ThirdParty\SDL2_gfx\include;..\ThirdParty\SDL2_image\include;..\ThirdParty\SDL2_mixer\include;..\ThirdParty\SDL2_ttf\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -131,6 +132,7 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\ThirdParty\cJSON\cJSON.c" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@@ -19,11 +19,17 @@
|
||||
<Filter Include="头文件\enemy">
|
||||
<UniqueIdentifier>{d16b420a-6329-4705-af2a-57caf4eee0e9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="源文件\cJSON">
|
||||
<UniqueIdentifier>{26456ec2-6d40-4a7f-9935-8248edc2bef2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ThirdParty\cJSON\cJSON.c">
|
||||
<Filter>源文件\cJSON</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="game_manager.h">
|
||||
|
@@ -90,6 +90,7 @@ public:
|
||||
bool load_level_config(const std::string& path)
|
||||
{
|
||||
std::ifstream file(path);
|
||||
|
||||
if (!file.good())return false;
|
||||
|
||||
std::stringstream str_stream;
|
||||
@@ -97,8 +98,8 @@ public:
|
||||
file.close();
|
||||
|
||||
cJSON* json_root = cJSON_Parse(str_stream.str().c_str());
|
||||
|
||||
if (!json_root) return false;//<2F><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
|
||||
if (json_root->type != cJSON_Array)//<2F><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
cJSON_Delete(json_root);
|
||||
@@ -108,7 +109,7 @@ public:
|
||||
cJSON* json_wave = nullptr;
|
||||
cJSON_ArrayForEach(json_wave, json_root)
|
||||
{
|
||||
if (json_wave->type != cJSON_Array)
|
||||
if (json_wave->type != cJSON_Object)
|
||||
continue;
|
||||
|
||||
wave_list.emplace_back();//<2F><><EFBFBD><EFBFBD>ĩβ<C4A9><CEB2><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3A3ACB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>õ<EFBFBD><C3B5>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>Ĭ<EFBFBD>Ϲ<EFBFBD><CFB9>캯<EFBFBD><ECBAAF>
|
||||
@@ -128,7 +129,7 @@ public:
|
||||
cJSON* json_spawn_event = nullptr;
|
||||
cJSON_ArrayForEach(json_spawn_event, json_wave_spawn_list)
|
||||
{
|
||||
if (json_spawn_event->type != cJSON_Array)
|
||||
if (json_spawn_event->type != cJSON_Object)
|
||||
continue;
|
||||
|
||||
wave.spawn_event_list.emplace_back();
|
||||
@@ -144,10 +145,10 @@ public:
|
||||
if (json_spawn_event_enemy_type && json_spawn_event_enemy_type->type == cJSON_String)
|
||||
{
|
||||
const std::string str_enemy_type = json_spawn_event_enemy_type->valuestring;
|
||||
if (str_enemy_type == "Slim")
|
||||
spawn_event.enemy_type = EnemyType::Slim;
|
||||
else if(str_enemy_type == "KingSlim")
|
||||
spawn_event.enemy_type = EnemyType::KingSlim;
|
||||
if (str_enemy_type == "Slime")
|
||||
spawn_event.enemy_type = EnemyType::Slime;
|
||||
else if(str_enemy_type == "KingSlime")
|
||||
spawn_event.enemy_type = EnemyType::KingSlime;
|
||||
else if (str_enemy_type == "Skeleton")
|
||||
spawn_event.enemy_type = EnemyType::Skeleton;
|
||||
else if (str_enemy_type == "Goblin")
|
||||
@@ -163,6 +164,7 @@ public:
|
||||
}
|
||||
|
||||
cJSON_Delete(json_root);
|
||||
|
||||
if (wave_list.empty())
|
||||
return false;
|
||||
|
||||
@@ -174,7 +176,7 @@ public:
|
||||
bool load_game_config(const std::string& path)
|
||||
{
|
||||
std::ifstream file(path);
|
||||
if (file.good()) return false;
|
||||
if (!file.good()) return false;
|
||||
|
||||
std::stringstream str_stream;
|
||||
str_stream << file.rdbuf();
|
||||
|
@@ -4,8 +4,8 @@
|
||||
|
||||
enum class EnemyType
|
||||
{
|
||||
Slim,
|
||||
KingSlim,
|
||||
Slime,
|
||||
KingSlime,
|
||||
Skeleton,
|
||||
Goblin,
|
||||
GoblinPriest
|
||||
|
@@ -3,6 +3,8 @@
|
||||
#define _GAME_MANAGER_H_
|
||||
|
||||
#include "manager.h"
|
||||
#include "config_manager.h"
|
||||
#include "resources_manager.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_ttf.h>
|
||||
@@ -61,13 +63,25 @@ protected:
|
||||
|
||||
SDL_SetHint(SDL_HINT_IME_SHOW_UI,"1");
|
||||
|
||||
window = SDL_CreateWindow(u8"<EFBFBD><EFBFBD>ׯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_SHOWN);
|
||||
ConfigManager* config = ConfigManager::instance();
|
||||
|
||||
init_assert(config->map.load("map.csv"), u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD>ͼʧ<EFBFBD>ܣ<EFBFBD>");
|
||||
init_assert(config->load_level_config("level.json"), u8"<EFBFBD><EFBFBD><EFBFBD>عؿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
|
||||
init_assert(config->load_game_config("config.json"), u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
|
||||
|
||||
window = SDL_CreateWindow(config->basic_template.window_title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
config->basic_template.window_width, config->basic_template.window_height, SDL_WINDOW_SHOWN);
|
||||
init_assert(window, u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
|
||||
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE);
|
||||
init_assert(renderer, u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱦ<EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
|
||||
|
||||
init_assert(ResourcesManager::instance()->load_from_file(renderer), u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD>Դʧ<EFBFBD>ܣ<EFBFBD>");
|
||||
|
||||
init_assert(generate_tile_map_texture(),u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
|
||||
|
||||
}
|
||||
|
||||
~GameManager()
|
||||
{
|
||||
SDL_DestroyRenderer(renderer);
|
||||
@@ -86,6 +100,8 @@ private:
|
||||
SDL_Window* window = nullptr;
|
||||
SDL_Renderer* renderer = nullptr;
|
||||
|
||||
SDL_Texture* tex_tile_map = nullptr;
|
||||
|
||||
private:
|
||||
void init_assert(bool flag, const char* err_msg)
|
||||
{
|
||||
@@ -107,7 +123,94 @@ private:
|
||||
|
||||
void on_render()
|
||||
{
|
||||
static ConfigManager* instance = ConfigManager::instance();
|
||||
static SDL_Rect& rect_dst = instance->rect_tile_map;
|
||||
SDL_RenderCopy(renderer, tex_tile_map, nullptr, &rect_dst);
|
||||
}
|
||||
|
||||
bool generate_tile_map_texture()
|
||||
{
|
||||
const Map& map = ConfigManager::instance()->map;
|
||||
const TileMap& tile_map = map.get_tile_map();
|
||||
SDL_Rect& rect_tile_map = ConfigManager::instance()->rect_tile_map;
|
||||
SDL_Texture* tex_tile_set = ResourcesManager::instance()->get_texture_pool().find(ResID::Tex_Tileset)->second;
|
||||
|
||||
int width_tex_tile_set, height_tex_tile_set;
|
||||
SDL_QueryTexture(tex_tile_set, nullptr, nullptr, &width_tex_tile_set, &height_tex_tile_set);//<2F><><EFBFBD>Ⱥ߶ȴ洢<C8B4><E6B4A2>ȥ
|
||||
int num_tile_single_line = (int)std::ceil((double)width_tex_tile_set / SIZE_TILE);//<2F><>ȡһ<C8A1><D2BB><EFBFBD>ж<EFBFBD><D0B6>ٵ<EFBFBD>Ԫ<EFBFBD><D4AA>
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int width_tex_tile_map, height_tex_tile_map;
|
||||
width_tex_tile_map = (int)map.get_width() * SIZE_TILE;
|
||||
height_tex_tile_map = (int)map.get_height() * SIZE_TILE;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>renderer<65><72><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD>Ҹ<EFBFBD>ʽ<EFBFBD>ǵڶ<C7B5><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
tex_tile_map = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ABGR8888,
|
||||
SDL_TEXTUREACCESS_TARGET, width_tex_tile_map, height_tex_tile_map);
|
||||
if (!tex_tile_map)return false;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>rect_tile_map
|
||||
ConfigManager* config = ConfigManager::instance();
|
||||
rect_tile_map.x = (config->basic_template.window_width - width_tex_tile_map) / 2;//<2F><><EFBFBD>ϽǶ<CFBD><C7B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>꣬<EFBFBD><EAA3AC>Ϊϣ<CEAA><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>м䣡<D0BC><E4A3A1>
|
||||
rect_tile_map.y = (config->basic_template.window_height - height_tex_tile_map) / 2;
|
||||
rect_tile_map.w = width_tex_tile_map;
|
||||
rect_tile_map.h = height_tex_tile_map;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȾĿ<C8BE><C4BF>react<63><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD>ģʽ
|
||||
SDL_SetTextureBlendMode(tex_tile_map, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetRenderTarget(renderer, tex_tile_map);
|
||||
|
||||
for (int y = 0; y < map.get_height(); y++)
|
||||
{
|
||||
for (int x = 0; x < map.get_width(); x++)
|
||||
{
|
||||
//Դ<>زľ<D8B2><C4BE><EFBFBD>
|
||||
SDL_Rect rect_src;
|
||||
const Tile& tile = tile_map[y][x];
|
||||
|
||||
//Ŀ<><C4BF>λ<EFBFBD>þ<EFBFBD><C3BE><EFBFBD>
|
||||
const SDL_Rect& rect_dst =
|
||||
{
|
||||
x * SIZE_TILE,y * SIZE_TILE, //x,y<><79><EFBFBD><EFBFBD>
|
||||
SIZE_TILE,SIZE_TILE //<2F><><EFBFBD><EFBFBD>
|
||||
};
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD>زĿ<D8B2>
|
||||
rect_src =
|
||||
{
|
||||
(tile.terrian % num_tile_single_line) * SIZE_TILE,//<2F><><EFBFBD>ƹ<EFBFBD><C6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
(tile.terrian / num_tile_single_line) * SIZE_TILE,
|
||||
SIZE_TILE,SIZE_TILE
|
||||
};
|
||||
SDL_RenderCopy(renderer, tex_tile_set, &rect_src, &rect_dst);//<2F><><EFBFBD>β<EFBFBD><CEB2><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
//<2F>ж<EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>
|
||||
if (tile.decoration >= 0)
|
||||
{
|
||||
rect_src =
|
||||
{
|
||||
(tile.decoration % num_tile_single_line) * SIZE_TILE,
|
||||
(tile.decoration / num_tile_single_line) * SIZE_TILE,
|
||||
SIZE_TILE,SIZE_TILE
|
||||
};
|
||||
SDL_RenderCopy(renderer, tex_tile_set, &rect_src, &rect_dst);//װ<><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Ŀ<EFBFBD>꣨<EFBFBD><EAA3A8><EFBFBD>ӣ<EFBFBD>
|
||||
const SDL_Point& idx_home = map.get_idx_home();
|
||||
const SDL_Rect& rect_dst =
|
||||
{
|
||||
idx_home.x * SIZE_TILE, idx_home.y * SIZE_TILE,
|
||||
SIZE_TILE,SIZE_TILE
|
||||
};
|
||||
SDL_RenderCopy(renderer, ResourcesManager::instance()->get_texture_pool().find(ResID::Tex_Home)->second, nullptr, &rect_dst);
|
||||
|
||||
//һ<><D2BB>Ҫ<EFBFBD><D2AA><EFBFBD>ûؿ<C3BB>
|
||||
SDL_SetRenderTarget(renderer, nullptr);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -4,11 +4,11 @@
|
||||
"spawn_list": [{
|
||||
"interval": 1,
|
||||
"point": 1,
|
||||
"enemy": "Slim"
|
||||
"enemy": "Slime"
|
||||
}, {
|
||||
"interval": 1,
|
||||
"point": 2,
|
||||
"enemy": "KingSlim"
|
||||
"enemy": "KingSlime"
|
||||
}, {
|
||||
"interval": 1,
|
||||
"point": 1,
|
||||
@@ -28,7 +28,7 @@
|
||||
"spawn_list": [{
|
||||
"interval": 3,
|
||||
"point": 2,
|
||||
"enemy": "KingSlim"
|
||||
"enemy": "KingSlime"
|
||||
}]
|
||||
}]
|
||||
|
||||
|
10
TdGame/map.h
10
TdGame/map.h
@@ -32,7 +32,7 @@ public:
|
||||
std::string str_line;
|
||||
while (std::getline(file, str_line))
|
||||
{
|
||||
str_line = trim_str(str_line);
|
||||
str_line = trim_str(str_line);//ȥ<><C8A5><EFBFBD><EFBFBD><EFBFBD>˿հ<CBBF><D5B0>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6>庯<EFBFBD><E5BAAF>
|
||||
if (str_line.empty())
|
||||
continue;
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>У<EFBFBD><D0A3><EFBFBD>idx_x<5F><78>-1
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
{
|
||||
idx_x++;//<2F><>idx_x++ȥ<>ұ<EFBFBD><D2B1><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC>
|
||||
tile_map_temp[idx_y].emplace_back();//<2F><>idx_y<5F><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ
|
||||
Tile& tile = tile_map_temp[idx_y].back();//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Tile& tile = tile_map_temp[idx_y].back() <EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Tile& tile = tile_map_temp[idx_y].back();//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
load_tile_from_string(tile,str_tile);
|
||||
}
|
||||
@@ -162,12 +162,12 @@ private:
|
||||
|
||||
if (tile.special_flag == 0)//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD>1234<33><34>ˢ<EFBFBD>ֵ<EFBFBD>
|
||||
{
|
||||
idx_home.x == x;
|
||||
idx_home.y == y;
|
||||
idx_home.x = x;
|
||||
idx_home.y = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
spawner_route_pool[tile.special_flag] = Route(tile_map, { x, y });
|
||||
spawner_route_pool[tile.special_flag] = Route(tile_map, { x,y });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _RESOURCES_MANAGER_H_
|
||||
#define _RESOURCES_MANAGER_H_
|
||||
|
||||
@@ -116,13 +117,13 @@ public:
|
||||
texture_pool[ResID::Tex_Slime] = IMG_LoadTexture(renderer, "resources/enemy_slime.png");
|
||||
texture_pool[ResID::Tex_KingSlime] = IMG_LoadTexture(renderer, "resources/enemy_king_slime.png");
|
||||
texture_pool[ResID::Tex_Skeleton] = IMG_LoadTexture(renderer, "resources/enemy_skeleton.png");
|
||||
texture_pool[ResID::Tex_Goblin] = IMG_LoadTexture(renderer, "resources/enenmy_goblin.png");
|
||||
texture_pool[ResID::Tex_GoblinPriest] = IMG_LoadTexture(renderer, "resources/enenmy_goblin_priest.png");
|
||||
texture_pool[ResID::Tex_SlimeSketch] = IMG_LoadTexture(renderer, "resources/enenmy_slime_sketch.png");
|
||||
texture_pool[ResID::Tex_KingSlimeSketch] = IMG_LoadTexture(renderer, "resources/enenmy_king_slime_sketch.png");
|
||||
texture_pool[ResID::Tex_SkeletonSketch] = IMG_LoadTexture(renderer, "resources/enenmy_skeleton_sketch.png");
|
||||
texture_pool[ResID::Tex_GoblinSketch] = IMG_LoadTexture(renderer, "resources/enenmy_goblin_sketch.png");
|
||||
texture_pool[ResID::Tex_GoblinPriestSketch] = IMG_LoadTexture(renderer, "resources/enenmy_goblin_priest_sketch.png");
|
||||
texture_pool[ResID::Tex_Goblin] = IMG_LoadTexture(renderer, "resources/enemy_goblin.png");
|
||||
texture_pool[ResID::Tex_GoblinPriest] = IMG_LoadTexture(renderer, "resources/enemy_goblin_priest.png");
|
||||
texture_pool[ResID::Tex_SlimeSketch] = IMG_LoadTexture(renderer, "resources/enemy_slime_sketch.png");
|
||||
texture_pool[ResID::Tex_KingSlimeSketch] = IMG_LoadTexture(renderer, "resources/enemy_king_slime_sketch.png");
|
||||
texture_pool[ResID::Tex_SkeletonSketch] = IMG_LoadTexture(renderer, "resources/enemy_skeleton_sketch.png");
|
||||
texture_pool[ResID::Tex_GoblinSketch] = IMG_LoadTexture(renderer, "resources/enemy_goblin_sketch.png");
|
||||
texture_pool[ResID::Tex_GoblinPriestSketch] = IMG_LoadTexture(renderer, "resources/enemy_goblin_priest_sketch.png");
|
||||
|
||||
texture_pool[ResID::Tex_BulletArrow] = IMG_LoadTexture(renderer, "resources/bullet_arrow.png");
|
||||
texture_pool[ResID::Tex_BulletAxe] = IMG_LoadTexture(renderer, "resources/bullet_axe.png");
|
||||
@@ -198,7 +199,6 @@ public:
|
||||
if (!pair.second) return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
const FontPool& get_font_pool()
|
||||
|
@@ -16,7 +16,7 @@ public:
|
||||
Route() = default;
|
||||
|
||||
//<2F>вι<D0B2><CEB9>캯<EFBFBD><ECBAAF>
|
||||
Route(const TileMap& map,SDL_Point& idx_origin)
|
||||
Route(const TileMap& map,const SDL_Point& idx_origin)
|
||||
{
|
||||
size_t width_map = map[0].size();
|
||||
size_t height_map = map.size();
|
||||
@@ -83,4 +83,5 @@ private:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define SIZE_TILE = 48
|
||||
#define SIZE_TILE 48
|
||||
|
||||
//ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD>ȽϺ<C8BD>
|
||||
struct Tile
|
||||
|
@@ -13,7 +13,7 @@ struct Wave
|
||||
{
|
||||
double interval = 0;
|
||||
int spawn_point = 1;
|
||||
EnemyType enemy_type = EnemyType::Slim;//<2F><>level.json<6F>ļ<EFBFBD><C4BC>м<EFBFBD><D0BC><EFBFBD>ʽ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
EnemyType enemy_type = EnemyType::Slime;//<2F><>level.json<6F>ļ<EFBFBD><C4BC>м<EFBFBD><D0BC><EFBFBD>ʽ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
};
|
||||
|
||||
double rewards = 0;
|
||||
|
Reference in New Issue
Block a user