📄 input_device_directinput.h
字号:
/* $Id: input_device_directinput.h,v 1.3 2003/10/29 13:12:43 mbn Exp $
**
** ClanLib Game SDK
** Copyright (C) 2003 The ClanLib Team
** For a total list of contributers see the file CREDITS.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef header_input_device_directinput
#define header_input_device_directinput
#if _MSC_VER > 1000
#pragma once
#endif
#include "../input_device_generic.h"
#include "display_window_win32.h"
#include "API/Core/System/keep_alive.h"
class CL_InputDevice_DirectInput : public CL_InputDevice_Generic, public CL_KeepAlive
{
//! Construction:
public:
CL_InputDevice_DirectInput(CL_DisplayWindow_Win32 *window, LPCDIDEVICEINSTANCE device_instance);
virtual ~CL_InputDevice_DirectInput();
//! Attributes:
public:
//: Returns the x position of the device.
virtual int get_x() const;
//: Returns the y position of the device.
virtual int get_y() const;
//: Returns true if the passed key code is down for this device.
virtual bool get_keycode(int keycode) const;
//: Key name for specified identifier (A, B, C, Space, Enter, Backspace).
virtual std::string get_key_name(int id) const;
//: Returns the the current position of a joystick axis.
virtual float get_axis(int index) const;
//: Returns the name of the device (i.e. 'Microsoft Sidewinder 3D').
virtual std::string get_name() const;
//: Returns the number of axes available on this device.
virtual int get_axis_count() const;
//: Returns the number of buttons available on this device.
//- <p>If used on a keyboard, this function returns -1.</p>
virtual int get_button_count() const;
//! Operations:
public:
//: Sets the position of the device.
virtual void set_position(int x, int y);
//! Implementation:
private:
virtual void keep_alive();
CL_DisplayWindow_Win32 *window;
DIDEVICEINSTANCE device_instance;
LPDIRECTINPUTDEVICE8 directinput_device;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -