{"id":433,"date":"2013-04-08T18:17:04","date_gmt":"2013-04-08T09:17:04","guid":{"rendered":"http:\/\/androiphone.uvs.jp\/?p=433"},"modified":"2013-04-08T18:17:42","modified_gmt":"2013-04-08T09:17:42","slug":"androidandengine-%e3%83%9e%e3%83%ab%e3%83%81%e3%82%bf%e3%83%83%e3%83%97%e3%82%bf%e3%83%83%e3%83%81%e3%81%ae%e5%ba%a7%e6%a8%99%e5%8f%96%e5%be%97%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"https:\/\/androiphone.uvs.jp\/?p=433","title":{"rendered":"[Android][AndEngine] \u30de\u30eb\u30c1\u30bf\u30c3\u30d7(\u30bf\u30c3\u30c1)\u306e\u5ea7\u6a19\u53d6\u5f97\u306b\u3064\u3044\u3066"},"content":{"rendered":"<h4>\n\u3000cocos2d\u306e\u30b8\u30a7\u30b9\u30c1\u30e3\u30fc\u691c\u51fa\u306fUIGestureRecognizer\u3068\u3044\u3046\u7d20\u6674\u3089\u3057\u3044\u30af\u30e9\u30b9\u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001\u691c\u51fa\u30ed\u30b8\u30c3\u30af\u306b\u306f\u5168\u304f\u89e6\u308c\u305a\u306b\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3067\u304d\u305f\u3002\u304c\uff01AndEngine\u306b\u79fb\u690d\u3059\u308b\u306b\u3042\u305f\u3063\u3066\u3001\u3044\u308d\u3044\u308d\u8abf\u3079\u305f\u304c\u3001\u5927\u4f53\u3001\u81ea\u524d\u3067\u5b9f\u88c5\u3057\u3066\u3044\u308b\u3089\u3057\u3044\u3053\u3068\u304c\u308f\u304b\u308a\u3001\u3084\u3080\u306a\u304f\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u958b\u59cb\u3057\u305f\u3002<br \/>\n\u3000\u30b7\u30f3\u30b0\u30eb\u30bf\u30c3\u30d7\u306e\u30b9\u30ef\u30a4\u30d7\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5b9f\u88c5\u3067\u3044\u3044\u3068\u304a\u3082\u3046\u3002<br \/>\n<\/h4>\n<p>[java]<br \/>\n@Override<br \/>\npublic boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {<br \/>\n\tfloat x = pSceneTouchEvent.getX();<br \/>\n\tfloat y = pSceneTouchEvent.getY();<br \/>\n\tlong n_time = System.currentTimeMillis();<\/p>\n<p>    switch(pSceneTouchEvent.getAction()){<br \/>\n\t\tcase TouchEvent.ACTION_DOWN:{<br \/>\n\t\t\tf_x = x;<br \/>\n\t\t\tf_y = y;<br \/>\n\t\t\ts_time = n_time;<br \/>\n\t\t\tbreak;<br \/>\n\t\t}<\/p>\n<p>       \tcase TouchEvent.ACTION_UP:{<br \/>\n       \t\t\tfloat dy = f_y &#8211; y;<br \/>\n       \t\t\tlong dt = n_time &#8211; s_time;<br \/>\n       \t\t\tfloat speed = dy*1000\/dt;<br \/>\n       \t\t\tif((speed&gt;=SWIPE_SPEED_MIN)&amp;&amp;(dy&gt;=SWIPE_MOVE_MIN)){<br \/>\n           \t\t\t\/\/\u3053\u3053\u3067\u5782\u76f4\u30b9\u30ef\u30a4\u30d7\u306e\u691c\u51fa<br \/>\n       \t\t\t}<\/p>\n<p>       \t\tbreak;<br \/>\n       \t}<br \/>\n    }<br \/>\n\treturn true;<br \/>\n}<\/p>\n<p>[\/java]<\/p>\n<h4>\ns_time\u3068n_time\u3067\u30b9\u30ef\u30a4\u30d7\u6642\u9593\u3092\u8a08\u6e2c\u3057\u3001\u30b9\u30ef\u30a4\u30d7\u30b9\u30d4\u30fc\u30c9\u3068\u8ddd\u96e2\u3092\u7b97\u51fa\u3002SWIPE_SPEED_MIN\u3068SWIPE_MOVE_MIN\u306b\u30b9\u30ef\u30a4\u30d7\u8a8d\u8b58\u306e\u56fa\u5b9a\u5024\u3092\u3044\u308c\u3066\u691c\u51fa\u3068\u3044\u3046\u4ed5\u7d44\u307f\u3002<br \/>\n\u3000<br \/>\n\u3000\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u30b8\u30a7\u30b9\u30c1\u30e3\u30fc\u306e\u5834\u5408\u306f\u3053\u3046\u3082\u3044\u304b\u306a\u3044\u3002\u3058\u3064\u306f\u3001\u30de\u30eb\u30c1\u30bf\u30c3\u30c1\u6642\u306b\u304f\u308b\u5ea7\u6a19\u306f\u3001\u6307\u306e\u6570\u306f\u308f\u304b\u308b\u3082\u306e\u306e\u3001\u3069\u306e\u6307\u304c\u3001\u3069\u306e\u5ea7\u6a19\u304b\u3068\u3044\u3046\u60c5\u5831\u306f\u4e00\u5207\u306a\u3044\u3002\u306e\u3067\u3001\u305d\u308c\u3092\u5224\u5225\u3059\u308b\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u52a0\u3048\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n<p>\u24602\u6307\u3067\u306e\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u5834\u5408\u3001TouchEvent.ACTION_DOWN\u3067\u3001\u300c2\u6307\u306e\u8ddd\u96e2\u300d\u3092\u307e\u305a\u5224\u5225\u3057\u3001\u6b21\u306b\u9069\u6b63\u306a\u8ddd\u96e2\u3067\u3042\u308c\u3070\u3001\u300c2\u70b9\u304c\u5bfe\u8c61\u30b9\u30d7\u30e9\u30a4\u30c8\u5185\u90e8\u306b\u3042\u308b\u300dor\u300c2\u70b9\u306e\u4e2d\u70b9\u304c\u30b9\u30d7\u30e9\u30a4\u30c8\u5185\u306b\u3042\u308b\u300d\u3092\u57fa\u306b\u3057\u3066\u5bfe\u8c61\u30b9\u30d7\u30e9\u30a4\u30c8\u3092\u7279\u5b9a\u3059\u308b\u3002<\/p>\n<p>\u2461\u5bfe\u8c61\u30b9\u30d7\u30e9\u30a4\u30c8\u306e\u7279\u5b9a\u304c\u7d42\u308f\u308c\u3070\u3001TouchEvent.ACTION_MOVE\u3067\u3001\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u6642\u306b\u9001\u3089\u308c\u3066\u304f\u308b\u5ea7\u6a19(2\u6307\u3069\u3063\u3061\u304b\u306f\u4e0d\u660e)\u3092\u3001\u3069\u3063\u3061\u306e\u6307\u304b\u3092\u5224\u65ad\u3059\u308b\u305f\u3081\u306bTouchEvent.ACTION_DOWN\u6642\u306e\u5ea7\u6a19\u304b\u3089\u306e\u8ddd\u96e2\u3067\u5224\u5b9a\u3059\u308b(\u3053\u308c\u3067\u3044\u3044\u304b\u306f\u308f\u304b\u3089\u306a\u3044\u3051\u3069\u3082)\u3002<\/p>\n<p>\u24622\u6307\u306e\u300c\u306a\u3059\u89d2\u5ea6\u300d\u3068TouchEvent.ACTION_MOVE\u6642\u306e2\u70b9\u306e\u300c\u306a\u3059\u89d2\u5ea6\u300d\u306e\u5dee\u3092\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u89d2\u5ea6\u3068\u3057\u3066\u30bb\u30c3\u30c8\u3059\u308b\u3002<\/p>\n<p>\u3092\u30b3\u30fc\u30c9\u5316\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002\u30b3\u30fc\u30c9\u306f\u3042\u308b\u3093\u3060\u3051\u3069\u30fb\u30fb\u30fb\u3044\u308d\u3093\u306a\u30b8\u30a7\u30b9\u30c1\u30e3\u30fc\u691c\u51fa\u306e\u305f\u3081\u306b\u3054\u3063\u3061\u3083\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u6574\u7406\u3057\u3060\u3044\u30b3\u30fc\u30c9\u3092\u4e0a\u3052\u307e\u3059\u3002\u304c\u3001\u2460\uff5e\u2462\u3067\u3001\u304a\u304a\u3080\u306d\u52d5\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n<\/h4>\n","protected":false},"excerpt":{"rendered":"<p>\u3000cocos2d\u306e\u30b8\u30a7\u30b9\u30c1\u30e3\u30fc\u691c\u51fa\u306fUIGestureRecognizer\u3068\u3044\u3046\u7d20\u6674\u3089\u3057\u3044\u30af\u30e9\u30b9\u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001\u691c\u51fa\u30ed\u30b8\u30c3\u30af\u306b\u306f\u5168\u304f\u89e6\u308c\u305a\u306b\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3067\u304d\u305f\u3002\u304c\uff01AndEngine\u306b\u79fb\u690d\u3059\u308b\u306b\u3042\u305f\u3063\u3066\u3001\u3044\u308d\u3044\u308d\u8abf\u3079\u305f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"","_original_post":"","footnotes":""},"categories":[13,5,6],"tags":[],"class_list":["post-433","post","type-post","status-publish","format-standard","hentry","category-andengine","category-android","category-6","ja"],"_links":{"self":[{"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/posts\/433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=433"}],"version-history":[{"count":9,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/posts\/433\/revisions"}],"predecessor-version":[{"id":701,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/posts\/433\/revisions\/701"}],"wp:attachment":[{"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}