1 Star 0 Fork 2

gite-hub / libhge9

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Sprite1.h 1.77 KB
一键复制 编辑 原始数据 按行查看 历史
ulxy 提交于 2020-05-29 14:13 . .
#pragma once
#include "Texture.h"
/*
** HGE Sprite class
*/
class Sprite1
{
public:
Sprite1(Texture tex, float x, float y, float w, float h);
Sprite1(const Sprite1 &spr);
~Sprite1();
void Render(float x, float y);
void RenderEx(float x, float y, float rot, float hscale = 1.0f, float vscale = 0.0f);
void RenderStretch(float x1, float y1, float x2, float y2);
void Render4V(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3);
void SetTexture(Texture tex);
void SetTextureRect(float x, float y, float w, float h, bool adjSize = true);
void SetColor(DWORD col, int i = -1);
void SetZ(float z, int i = -1);
void SetBlendMode(int blend) { quad.blend = blend; }
void SetHotSpot(float x, float y) { hotX = x; hotY = y; }
void SetFlip(bool bX, bool bY, bool bHotSpot = false);
TEXTURE GetTexture() const { return quad.tex; }
void GetTextureRect(float *x, float *y, float *w, float *h) const { *x = tx; *y = ty; *w = width; *h = height; }
DWORD GetColor(int i = 0) const { return quad.v[i].color; }
float GetZ(int i = 0) const { return quad.v[i].z; }
int GetBlendMode() const { return quad.blend; }
void GetHotSpot(float *x, float *y) const { *x = hotX; *y = hotY; }
void GetFlip(bool *bX, bool *bY) const { *bX = bXFlip; *bY = bYFlip; }
float GetWidth() const { return width; }
float GetHeight() const { return height; }
// hgeRect* GetBoundingBox(float x, float y, hgeRect *rect) const { rect->Set(x - hotX, y - hotY, x - hotX + width, y - hotY + height); return rect; }
// hgeRect* GetBoundingBoxEx(float x, float y, float rot, float hscale, float vscale, hgeRect *rect) const;
protected:
Sprite1();
Quad quad;
float tx, ty, width, height;
float tex_width, tex_height;
float hotX, hotY;
bool bXFlip, bYFlip, bHSFlip;
};
C++
1
https://gitee.com/gite-hub/libhge9.git
git@gitee.com:gite-hub/libhge9.git
gite-hub
libhge9
libhge9
master

搜索帮助