-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
283 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
#include "Monster_Model.h" | ||
|
||
void Destroy_Monster_Model(MonsterModel* model){ | ||
SDL_DestroyTexture(model->texture); | ||
SDL_FreeSurface(model->surface); | ||
/** | ||
* 释放怪物模型的内存 | ||
* @param model 怪物模型的指针 | ||
* @param n 该模型怪物的类型数量 | ||
*/ | ||
void Destroy_Monster_Model(MonsterModel* model, int n){ | ||
int i; | ||
for(i = 0; i < n; i++){ | ||
SDL_DestroyTexture(model->texture[i]); | ||
SDL_FreeSurface(model->surface[i]); | ||
} | ||
free(model); | ||
} | ||
|
||
/** | ||
* 绘制怪物 | ||
* @param renderer 窗口的渲染器 | ||
* @param model 怪物模型的数组 | ||
* @param node 怪物的位置信息 | ||
*/ | ||
void Draw_Monster_Model(SDL_Renderer* renderer, MonsterModel* model[], RectNode* node){ | ||
int monster_type = node->rect_type; | ||
|
||
int monster_type = node->rect_type, monster = node->monster; | ||
SDL_Rect rect = node->rect; | ||
SDL_RenderCopy(renderer, model[monster_type]->texture, NULL, &rect); | ||
SDL_RenderCopy(renderer, model[monster_type]->texture[monster], NULL, &rect); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.