keycodes.h

来自「这是整套横扫千军3D版游戏的源码」· C头文件 代码 · 共 50 行

H
50
字号
#ifndef KEYCODES_H
#define KEYCODES_H
// KeyCodes.h: interface for the CKeyCodes class.
//
//////////////////////////////////////////////////////////////////////

#include <stdio.h>
#include <string>
#include <map>

using namespace std;


class CKeyCodes {
	public:
		CKeyCodes();
		void Reset();

		int GetCode(const string& name) const;

		string GetName(int code) const;
		string GetDefaultName(int code) const;

		bool AddKeySymbol(const string& name, int code);

		bool IsModifier(int code) const;

		void PrintNameToCode() const;
		void PrintCodeToName() const;

		void SaveUserKeySymbols(FILE* file) const;

	public:
		static bool IsValidLabel(const string& label);

	protected:
		void AddPair(const string& name, int code);

	protected:
		map<string, int> nameToCode;
		map<int, string> codeToName;
		map<string, int> defaultNameToCode;
		map<int, string> defaultCodeToName;
};

extern CKeyCodes* keyCodes;


#endif /* KEYCODES_H */

⌨️ 快捷键说明

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