📄 gc.h
字号:
// GC.h: interface for the CGC class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_GC_H__554B9A78_65E8_4938_9C50_9F79352AF355__INCLUDED_)
#define AFX_GC_H__554B9A78_65E8_4938_9C50_9F79352AF355__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <gx.h>
class CGC
{
public:
CGC();
virtual ~CGC();
int Open(HWND hWnd);
int Close();
BOOL IsOpen() {return m_bOpen; }
BOOL BeginDraw()
{
m_pBuf = (WORD*)GXBeginDraw();
return m_pBuf != NULL;
}
int EndDraw()
{
m_pBuf = NULL;
return GXEndDraw();
}
int Suspend() {return GXSuspend(); }
int Resume() {return GXResume(); }
void SetPixel(int x, int y, WORD cr)
{
*PixelAddr(x, y) = cr;
}
void SetPixel(POINT pt, WORD cr)
{
SetPixel(pt.x, pt.y, cr);
}
WORD GetPixel(int x, int y)
{
return *PixelAddr(x, y);
}
WORD GetPixel(POINT pt)
{
return GetPixel(pt.x, pt.y);
}
WORD ConvertRGB(COLORREF cr);
long GetBitsPerPixel()
{
return m_dp.cBPP;
}
DWORD GetDisplayFormat()
{
return m_dp.ffFormat;
}
private:
WORD* m_pBuf;
BOOL m_bOpen;
GXDisplayProperties m_dp;
WORD* PixelAddr(int x, int y)
{
// ASSERT(x >= 0 && x < 240);
// ASSERT(y >= 0 && x < 320);
ASSERT(m_pBuf);
return m_pBuf + x * (m_dp.cbxPitch >> 1) + y * (m_dp.cbyPitch >> 1);
}
};
#endif // !defined(AFX_GC_H__554B9A78_65E8_4938_9C50_9F79352AF355__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -