游戏框架其九:WASD方向控制 { MovementController }

下面实现的方向控制是基于键盘上的W A S D,来控制运动物体的方向的。下面是实现~#pragma once//========================================================================// File: MovementController.h 就是实现键盘按钮 WASD 的方向控制//================
摘要由CSDN通过智能技术生成

下面实现的方向控制是基于键盘上的W A S D,来控制运动物体的方向的。下面是实现~

#pragma once
//========================================================================
// File: MovementController.h 就是实现键盘按钮 WASD 的方向控制
//========================================================================

#include "../GameCode4/Interfaces.h"
#include "Geometry.h"


// Forward declarations
class SceneNode;

typedef unsigned int  DWORD;
typedef unsigned short WORD;
typedef unsigned char  BYTE;
typedef unsigned int  ActorId;
typedef unsigned int  GameViewId;
typedef D3DXCOLOR     Color;
typedef float         FLOAT;
typedef unsigned int  UINT;
#ifdef   UNICODE
typedef wchar_t       TCHAR;
#else
typedef unsigned char TCHAR;
#endif
typedef unsigned char CHAR;
typedef unsigned wchar_t WCHAR;
enum HRESULT
{
    E_INVALIDARG,
    E_FAIL,
    S_OK,
};


//
// MovementController Description
//
//    Implements a WASD style movement controller
//
//  class MovementController		
//


class IPointerHandler
{
public:
    virtual bool VOnPointerMove(const Point &pos, const int radius) = 0;
    virtual bool VOnPointerButtonDown(const Point &pos, const int radius, const std::string &buttonName) = 0;
    virtual bool VOnPointerButtonUp(const Point &pos, const int radius, const std::string &buttonName) = 0;
};

class IKeyboardHandler
{
public:
    virtual bool VOnKeyDown(const BYTE c)=0;
    virtual bool VOnKeyUp(const BYTE c)=0;
};

class MovementCon
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值