about summary refs log tree commit diff
path: root/src/game/client/components/binds.h
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2010-05-29 07:25:38 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2010-05-29 07:25:38 +0000
commit72c06a258940696093f255fb1061beb58e1cdd0b (patch)
tree36b9a7712eec2d4f07837eab9c38ef1c5af85319 /src/game/client/components/binds.h
parente56feb597bc743677633432f77513b02907fd169 (diff)
downloadzcatch-72c06a258940696093f255fb1061beb58e1cdd0b.tar.gz
zcatch-72c06a258940696093f255fb1061beb58e1cdd0b.zip
copied refactor to trunk
Diffstat (limited to 'src/game/client/components/binds.h')
-rw-r--r--src/game/client/components/binds.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/game/client/components/binds.h b/src/game/client/components/binds.h
new file mode 100644
index 00000000..e8393979
--- /dev/null
+++ b/src/game/client/components/binds.h
@@ -0,0 +1,41 @@
+#ifndef GAME_CLIENT_COMPONENTS_BINDS_H
+#define GAME_CLIENT_COMPONENTS_BINDS_H
+#include <game/client/component.h>
+#include <engine/keys.h>
+
+class CBinds : public CComponent
+{
+	char m_aaKeyBindings[KEY_LAST][128];
+
+	int GetKeyId(const char *pKeyName);
+
+	static void ConBind(IConsole::IResult *pResult, void *pUserData);
+	static void ConUnbind(IConsole::IResult *pResult, void *pUserData);
+	static void ConUnbindAll(IConsole::IResult *pResult, void *pUserData);
+	static void ConDumpBinds(IConsole::IResult *pResult, void *pUserData);
+	class IConsole *GetConsole() const { return Console(); }
+	
+	static void ConfigSaveCallback(class IConfig *pConfig, void *pUserData);
+	
+public:
+	CBinds();
+	
+	class CBindsSpecial : public CComponent
+	{
+	public:
+		CBinds *m_pBinds;
+		virtual bool OnInput(IInput::CEvent Event);
+	};
+	
+	CBindsSpecial m_SpecialBinds;
+	
+	void Bind(int KeyId, const char *pStr);
+	void SetDefaults();
+	void UnbindAll();
+	const char *Get(int KeyId);
+	const char *GetKey(const char *pBindStr);
+	
+	virtual void OnConsoleInit();
+	virtual bool OnInput(IInput::CEvent Event);
+};
+#endif