mousecursor.h
来自「这是整套横扫千军3D版游戏的源码」· C头文件 代码 · 共 73 行
H
73 行
#ifndef MOUSECURSOR_H
#define MOUSECURSOR_H
#include <string>
#include <vector>
#include "Rendering/GL/myGL.h"
using namespace std;
class CBitmap;
class CMouseCursor {
public:
enum HotSpot {TopLeft, Center};
static CMouseCursor* New(const string &name, HotSpot hs);
~CMouseCursor(void);
void Update();
void Draw(int x, int y, float scale);
void DrawQuad(int x, int y);
void BindTexture();
int GetMaxSizeX() const { return xmaxsize; }
int GetMaxSizeY() const { return ymaxsize; }
protected:
struct ImageData {
GLuint texture;
int xOrigSize;
int yOrigSize;
int xAlignedSize;
int yAlignedSize;
};
struct FrameData {
FrameData(const ImageData& _image, float time)
: image(_image), length(time) {}
ImageData image;
float length;
float startTime;
float endTime;
};
protected:
CMouseCursor(const string &name, HotSpot hs);
bool LoadCursorImage(const string& name, struct ImageData& image);
bool BuildFromSpecFile(const string& name);
bool BuildFromFileNames(const string& name, int lastFrame);
CBitmap* getAlignedBitmap(const CBitmap &orig);
void setBitmapTransparency(CBitmap &bm, int r, int g, int b);
protected:
HotSpot hotSpot;
vector<ImageData> images;
vector<FrameData> frames;
float animTime;
float animPeriod;
int currentFrame;
int xmaxsize;
int ymaxsize;
int xofs; // describes where the center of the cursor is,
int yofs; // based on xmaxsize, ymaxsize, and the hotspot
};
#endif /* MOUSECURSOR_H */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?