compinfo.h

来自「小型的3D游戏引擎」· C头文件 代码 · 共 55 行

H
55 行
字号
//////////////////////////////////////////////////
//												//
//	Get info on the computer. Orginal CPU       //
//	    recongnision code (GetCPUSpeed(),		//
//			GetCPUCaps() and HasMMX())			//
//            by Matthias Hofmann				//
//												//
//	All orginal CPU stat code copyright (C)		//
//			  Matthias Hofmann					//
//												//
//////////////////////////////////////////////////


#ifndef _CPU_H_
#define _CPU_H_

#include <windows.h>
#include <winbase.h>

#define CPU_FEATURE_MMX		0x00800000
#define CPU_FEATURE_RDTSC	0x00000010
#define CPU_FEATURE_3DNOW	0x80000000

class GcCompchar
{
public:
	
	// Constructor / Destructor
	GcCompchar();
	~GcCompchar();

	// The get speed of the users CPU
	int GetCPUSpeed(void);

	// Get the capabilities of the users CPU
	DWORD GetCPUCaps(void);

	// Log the users CPU charactestic
	void LogCompCharac();

	// Does the computer have MMX
	bool HasMMX() { return hasMMX; }

	// Get the current windows version
	void GetWindowsVersion();

private:
	DWORD			cpuCaps;		// The capabilities of the CPU
	int				cpuSpeed;		// The speed of the cpu
	bool			hasMMX;			// Does the CPU have MMX instructions
	OSVERSIONINFO	osinfo;			// The OS info
	MEMORYSTATUS	meminfo;		// The memory info
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?