16_C++精灵库之stamp.h头文件源代码(2026年1月15日版)

// stamp.h
#ifndef STAMP_H
#define STAMP_H

#include <vector>
#include <SDL2/SDL.h>

struct Stamp {
    int id;
    float x, y;
    float heading;
    int m_rotate_mode;  //继承角色的旋转模式 
    float xscale, yscale;
    SDL_Texture* texture;  // 当前造型纹理
    bool visible;

    Stamp(int id, float x, float y, float heading, int rotate_mode,
          float xscale, float yscale, SDL_Texture* tex);
};

// 图章渲染管理器
class StampRenderer {
private:
    SDL_Renderer* renderer;

public:
    explicit StampRenderer(SDL_Renderer* renderer);
    ~StampRenderer() = default;

    // 绘制一个图章
    void draw(const Stamp& stamp);

    // 批量绘制图章
    void drawAll(const std::vector<Stamp>& stamps);
};

#endif // STAMP_H

关于李兴球

李兴球的博客是Python创意编程原创博客
此条目发表在C++分类目录。将固定链接加入收藏夹。

发表回复