Added a CGRAPH class

xiaoxiao2021-03-06  42

This class is mainly used for drawing, post, etc. Operation. Some functions are simply packaged with DX API ... I don't know if I have a fever yesterday, dizziness and headache, feel like it. . Haven't completed yet, gradually modified. The class graph.cpp file is as follows:

#include "stdafx.h" #include "./graph.h"#include" ./global.h "

CGRAPH :: CGRAPH (Void): m_winheight (0) {}

CGRAPH :: ~ cgraph (void) {}

// Initialize DirectDrawBool ​​CGRAPH :: Initddraw (Void) {IF (DirectDrawCreate (null, & lpdd, null)! = Dd_ok) {Return false;} Return true;

// Release DirectDraw object void cgraph :: freeddraw (void) {MessageBox (hwnd, "limited ...", "release", mb_ok); if (lpdd! = Null) {// _ Release (lpddsback); // _ Release (LPDDSPRIMARY); _RELEASE (LPDD);}}

// Set the window mode bool CGraph :: SetWindowMode (bool bFullScreen) {DWORD dwFlags; if (bFullScreen) {dwFlags = DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT; this-> bIsWindowMode = false;} else {dwFlags = DDSCL_NORMAL; this-> bIsWindowMode = True;} if (lpdd-> setcooperativeelevel (hwnd, dwflags) == DD_OK) Return true;}

// set the game window size and color depth bool CGraph :: SetWindowSize (int nWidth, int nHeight, int nColorDepth) {m_WinHeight = nHeight; m_WinWidth = nWidth; m_ColorDepth = nColorDepth; if (this-> bIsWindowMode) return true; if (lpDD -> SetDisplayMode (NWidth, NHEIGHT, NCOLORDEPTH)! = DD_OK) Return false; Return True;

转载请注明原文地址:https://www.9cbs.com/read-58917.html

New Post(0)