当前位置: 首页 > news >正文

电子商务网站建设培训小结安顺市网站建设

电子商务网站建设培训小结,安顺市网站建设,保定手机网站制作,wordpress改底部代码InputCaps处理外部输入的事件 该例子主要由两部分内容#xff1a; 外部输入事件获取 ​ 可以处理keyboard、mouse、joystick、touch、sensor的输入事件 显示一个ui图标按钮 Input 定义监听事件类型#xff1a; KlayGE::InputActionDefine actions[] {InputActionDefin…InputCaps处理外部输入的事件 该例子主要由两部分内容 外部输入事件获取 ​ 可以处理keyboard、mouse、joystick、touch、sensor的输入事件 显示一个ui图标按钮 Input 定义监听事件类型 KlayGE::InputActionDefine actions[] {InputActionDefine(KeyboardMsg, KS_AnyKey),InputActionDefine(MouseMsg, MS_X),InputActionDefine(MouseMsg, MS_Y),InputActionDefine(MouseMsg, MS_Z),InputActionDefine(MouseMsg, MS_AnyButton),InputActionDefine(JoystickMsg, JS_LeftThumbX),InputActionDefine(JoystickMsg, JS_LeftThumbY),InputActionDefine(JoystickMsg, JS_LeftThumbZ),InputActionDefine(JoystickMsg, JS_RightThumbX),InputActionDefine(JoystickMsg, JS_RightThumbY),InputActionDefine(JoystickMsg, JS_RightThumbZ),InputActionDefine(JoystickMsg, JS_LeftTrigger),InputActionDefine(JoystickMsg, JS_RightTrigger),InputActionDefine(JoystickMsg, JS_AnyButton),InputActionDefine(TouchMsg, TS_Pan),InputActionDefine(TouchMsg, TS_Tap),InputActionDefine(TouchMsg, TS_Press),InputActionDefine(TouchMsg, TS_PressAndTap),InputActionDefine(TouchMsg, TS_Zoom),InputActionDefine(TouchMsg, TS_Rotate),InputActionDefine(TouchMsg, TS_Flick),InputActionDefine(TouchMsg, TS_Wheel),InputActionDefine(TouchMsg, TS_AnyTouch),InputActionDefine(SensorMsg, SS_AnySensing),InputActionDefine(Exit, KS_Escape)}; } 在OnCreate中绑定事件监听 KlayGE::InputEngine inputEngine KlayGE::Context::Instance().InputFactoryInstance().InputEngineInstance();KlayGE::InputActionMap actionMap;actionMap.AddActions(actions, actions std::size(actions));action_handler_t input_handler MakeSharedPtrinput_signal();input_handler-Connect([this](InputEngine const sender, InputAction const action){this-InputHandler(sender, action);});inputEngine.ActionMap(actionMap, input_handler); // 获取joystic_设备for (size_t i 0; i inputEngine.NumDevices(); i){auto const device inputEngine.Device(i);if (device-Type() InputEngine::IDT_Joystick){joystick_ checked_pointer_castInputJoystick(device);}}主要的消息处理函数InputHandler实现 void InputCaps::InputHandler(KlayGE::InputEngine const sender, KlayGE::InputAction const action) {switch (action.first){case KeyboardMsg:{key_str_.clear();InputKeyboardActionParamPtr param checked_pointer_castInputKeyboardActionParam(action.second);for (uint32_t i 0; i 0xEF; i){if (param-buttons_state[i]){key_str_ key_name[i] L ;}}}break;case MouseMsg:{InputMouseActionParamPtr param checked_pointer_castInputMouseActionParam(action.second);std::wostringstream stream;stream param-abs_coord.x() param-abs_coord.y() ;stream param-move_vec.x() param-move_vec.y() param-wheel_delta ;for (uint32_t i 0; i 8; i){if (param-buttons_state (1UL i)){stream button i L ;}}mouse_str_ stream.str();}break;case JoystickMsg:{InputJoystickActionParamPtr param checked_pointer_castInputJoystickActionParam(action.second);std::wostringstream stream;stream param-thumbs[0].x() param-thumbs[0].y() param-thumbs[0].z() ;stream param-thumbs[1].x() param-thumbs[1].y() param-thumbs[1].z() ;stream param-triggers[0] param-triggers[1] ;for (uint32_t i 0; i 16; i){if (param-buttons_state (1UL i)){stream button i L ;}}joystick_str_ stream.str();if (joystick_){for (uint32_t i 0; (i joystick_-NumVibrationMotors()) (i 2); i){joystick_-VibrationMotorSpeed(i, param-triggers[i]);}}}break;case TouchMsg:{InputTouchActionParamPtr param checked_pointer_castInputTouchActionParam(action.second);std::wostringstream stream;stream touch_name[param-gesture - 0x300] ;if (param-gesture ! TS_None){stream center param-center.x() param-center.y() ;switch (param-gesture){case TS_Pan:case TS_Tap:case TS_Flick:stream move param-move_vec.x() param-move_vec.y() ;break;case TS_Zoom:stream factor param-zoom ;break;case TS_Rotate:stream angle param-rotate_angle ;break;default:break;}}if (param-wheel_delta ! 0){stream Wheel param-wheel_delta ;}for (uint32_t i 0; i 16; i){if (param-touches_down (1UL i)){stream Touch i L Down ;}if (param-touches_up (1UL i)){stream Touch i L Up ;}}touch_str_ stream.str();}break;case SensorMsg:{InputSensorActionParamPtr param checked_pointer_castInputSensorActionParam(action.second);std::wostringstream stream;stream Lat: param-latitude Lng: param-longitude;stream Orientation: param-orientation_quat.x() param-orientation_quat.y() param-orientation_quat.z() param-orientation_quat.w();sensor_str_ stream.str();}break;case Exit:this-Quit();break;} }UI ui使用内置的ui解析脚本uiml格式文件,从外部获取一个特定尺寸的图片作为按钮显示在指定位置 ?xml version1.0 encodingutf-8 standaloneno? uidialog idLogo captionLogo x-128 y0 align_xright align_ytop width128 height128 show_captionfalse opacitytrue bg_color_a0control typetex_button idLogoButton texturepowered_by_klayge.dds x0 y0 width128 height128 is_default0//dialog /ui在OnCreate函数中加载ui资源 KlayGE::UIManager::Instance().Load(*KlayGE::ResLoader::Instance().Open(InputCaps.uiml));在DoUpdateOverlay函数中渲染 KlayGE::UIManager::Instance().Render();在Onsize时更新 KlayGE::UIManager::Instance().SettleCtrls();编写本例子遇到的坑 以下类无法找到link失败 1InputCaps.obj : error LNK2019: 无法解析的外部符号 __declspec(dllimport) class std::unique_ptrclass KlayGE::Signal::Detail::Mutex,struct std::default_deleteclass KlayGE::Signal::Detail::Mutex __cdecl KlayGE::Signal::Detail::CreateMutexA(void) (__imp_?CreateMutexADetailSignalKlayGEYA?AV?$unique_ptrVMutexDetailSignalKlayGEU?$default_deleteVMutexDetailSignalKlayGEstdstdXZ)函数 public: __cdecl KlayGE::Signal::Detail::SignalTemplateBasevoid __cdecl(class KlayGE::InputEngine const ,struct std::pairunsigned short,class std::shared_ptrstruct KlayGE::InputActionParam const ),struct KlayGE::Signal::CombinerDefaultvoid ::SignalTemplateBasevoid __cdecl(class KlayGE::InputEngine const ,struct std::pairunsigned short,class std::shared_ptrstruct KlayGE::InputActionParam const ),struct KlayGE::Signal::CombinerDefaultvoid (void) (??0?$SignalTemplateBase$$A6AXAEBVInputEngineKlayGEAEBU?$pairGV?$shared_ptrUInputActionParamKlayGEstdstdZU?$CombinerDefaultXSignal2DetailSignalKlayGEQEAAXZ) 中引用了该符号 1F:\code\project\test\Learning.test\GFX\KlayGE\KlayGELearning\bin\Debug\InputCaps.exe : fatal error LNK1120: 1 个无法解析的外部命令意思就是找不到这个函数 __declspec(dllimport) class std::unique_ptrclass KlayGE::Signal::Detail::Mutex,struct std::default_deleteclass KlayGE::Signal::Detail::Mutex __cdecl KlayGE::Signal::Detail::CreateMutexA(void)在KlayGE_Core_vc142.dll中只找到了这个 class std::unique_ptrclass KlayGE::Signal::Detail::Mutex,struct std::default_deleteclass KlayGE::Signal::Detail::Mutex __cdecl KlayGE::Signal::Detail::CreateMutexW(void) 很明显CreateMutex是windows kernel32中的api函数但KlayGE却导出了一个同名的函数导致函数签名错误。KlayGE默认使用unicode字符集我的项目未设置使用了多字节结果就成了CreateMutexA。 最终的解决办法 ADD_DEFINITIONS(-DUNICODE -D_UNICODE)但是最好不要让自己的函数名称和常用库的API同名这里出现冲突也和window的unicode使用宏定义有很大原因如下 #ifdef UNICODE #define CreateMutex CreateMutexW #else #define CreateMutex CreateMutexA #endif // !UNICODE最终效果 源码 KlayGE学习主目录
http://www.hkea.cn/news/14552112/

相关文章:

  • 陇南网站设计优化软件是什么意思
  • 门户网站导航建设方案广州微信网站建设公司哪家好
  • 网站为什么需要空间新手学做网站难吗
  • 个人网站设计流程图帮做图标的网站
  • 门户网站建设方案是什么意思wordpress文章页面修改
  • 上海市建设工程材料网站收录很快的推广网站
  • 校园网站建设 必要性分析泉州专业网站开发公司
  • 宁波网站建设哪里有自助 建站
  • 专业网站设计公司和普通设计公司的区别Wordpress获取自定义分类
  • 网站建设前期策划网易游戏
  • 宁德企业网站建设网络营销的主要方法
  • 建设微信商城网站没有任何收录的网站做SEM有用吗
  • 为什么网站建设要值班深圳营销型网站设计公司
  • t型布局网站怎么做苏州微信小程序开发公司
  • 购物网站开发的意义一个网站3个相似域名
  • 成年做羞羞的视频网站space建设工程施工合同属于
  • 什么职位做网站网络组建考试题
  • 兰山做网站中国软件
  • 怎样在自己的网站上家程序wordpress数据写入数据库表
  • 淘宝做网站的公司wordpress 模版不能更新
  • 温州网站关键词商标做网站logo
  • 音频文件放到网站空间里生成链接怎么做百度重庆营销中心
  • 做一个简单的网站需要多少钱用户界面设计与制作
  • 网站ftp上传到空间做设计的几种网站
  • 校园网站建设与应用网站建设兆金手指科杰
  • 好看的网站推荐一下中山网站建设文化价位
  • 手机网站 幻灯片js成都优化外包
  • 网站开发工程师代码互联网广告营销
  • 大连网站建设在线定制软件开发文案
  • 做服装到哪个网站拿货品质好做玄幻封面素材网站