md_text.h
来自「MDEngine2plus游戏开发库! 用来开发游戏超级简单!」· C头文件 代码 · 共 89 行
H
89 行
// MD_Profile.h: interface for the CMD_Profile class.
//
//////////////////////////////////////////////////////////////////////
#ifndef MD_TEXT_H
#define MD_TEXT_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifdef MDENGINE2P_EXPORTS
#define MDENGINE_API __declspec(dllexport)
#else
#define MDENGINE_API __declspec(dllimport)
#endif
#include "common.h"
#include "MD_Surface.h"
#define FONT_BOLD 1
#define FONT_ITALIC 2
#define FONT_UNDERLINE 4
#define FONT_StrikeOut 8
#define FONT_TRANSPARENT 0xFFFFFFFF
class MDENGINE_API CMD_Text
{
public:
CMD_Text();
CMD_Text(char* fontname,DWORD fontcolor,BYTE size=12,int weight=400,DWORD bgcolor=COLORKEY_NO,BYTE style=0);
CMD_Text(char *string,char* fontname,DWORD fontcolor,BYTE size=12,int weight=400,DWORD bgcolor=COLORKEY_NO,BYTE style=0);
virtual ~CMD_Text();
public:
void EnableErrMSG(bool bshowerr); // 允许or禁止弹出错误信息
DWORD GetErrCode(void); // 得到错误代码
bool Create(char *string,char* fontname,DWORD fontcolor,BYTE size=12,int weight=400,DWORD bgcolor=COLORKEY_NO,BYTE style=0);
void DrawFast(CMD_Surface *pDest, BYTE dest, int x, int y);
void DrawGray(CMD_Surface *pDest, BYTE dest, int x, int y);
void DrawAdditive(CMD_Surface *pDest, BYTE dest, int x, int y);
void DrawAttenuation(CMD_Surface *pDest, BYTE dest, int x, int y);
void DrawAlpha(CMD_Surface *pDest, BYTE dest, int iDestX, int iDestY, int iAlpha);
void DrawAlphaMMX(CMD_Surface *pDest, BYTE dest, int iDestX, int iDestY, int iAlpha);
void DrawAlphaFast(CMD_Surface *pDest, BYTE dest, int iDestX, int iDestY);
void DrawAlphaFastMMX(CMD_Surface *pDest, BYTE dest, int iDestX, int iDestY);
void SetText(char *string);
void SetFont(char *fontname);
void SetColor(DWORD color);
void SetSize(BYTE size);
void SetStyle(BYTE style);
void SetWeight(int weight);
void SetBGColor(DWORD color);
void SetProperty(char* fontname,DWORD fontcolor,BYTE size,int weight,DWORD bgcolor,BYTE style);
void Close();
CMD_Surface* GetSurface();
private:
void ShowErrMSG();
bool InitSurface();
private:
char* m_lpString;
char m_FontName[255];
DWORD m_dwFontColor;
int m_iWeight;
int m_Size;
BYTE m_Style;
DWORD m_dwBgColor;
CMD_Surface m_mdSurface;
private:
DWORD m_ErrCode;
bool m_bShowErrMSG;
bool m_bNeedCreate;
bool m_bCreated;
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?