{"id":3650,"date":"2013-07-03T12:37:41","date_gmt":"2013-07-03T03:37:41","guid":{"rendered":"http:\/\/r-dimension.xsrv.jp\/classes_j\/?p=3650"},"modified":"2014-07-23T07:46:24","modified_gmt":"2014-07-22T22:46:24","slug":"of_basics","status":"publish","type":"post","link":"https:\/\/r-dimension.xsrv.jp\/classes_j\/of_basics\/","title":{"rendered":"openFrameworks\u5165\u9580 \uff08iPhone\uff09\u57fa\u790e"},"content":{"rendered":"<h1>\u753b\u50cf\u306e\u8868\u793a<\/h1>\n<p>\u307e\u305a\u306f\u3001\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u3068\u3053\u308d\u304b\u3089\u59cb\u3081\u3066\u307f\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f7f\u3044\u307e\u3059\u3002\u30d5\u30a1\u30a4\u30eb\u306f\u3001\u5fc5\u305a\u4ee5\u4e0b\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u5165\u308c\u3066\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n<a href=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/myImageLoaderStart.zip\">myImageLoaderStart<\/a><br \/>\n&nbsp;<br \/>\n<a href=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/skitch.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/skitch-300x113.png\" alt=\"skitch\" width=\"300\" height=\"113\" class=\"alignnone size-medium wp-image-3300\" srcset=\"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/skitch-300x113.png 300w, https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/skitch.png 821w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><!--more--><\/p>\n<h3>\u80cc\u666f\u3092\u8868\u793a\u3057\u3066\u307f\u308b<\/h3>\n<p>\u307e\u305a\u306f\u300ctestApp.mm\u300d\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u306e\u300cvoid testApp::setup()\u300d\u3068\u3044\u3046\u30ab\u30c3\u30b3\u306e\u4e2d\u306b\u3001\u4ee5\u4e0b\u306e\u8a18\u8ff0\u3092\u52a0\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nwallpaper.loadImage(\"wallpaper\/Default1-Portrait~ipad.png\");\r\n<\/pre>\n<p>\u305d\u3057\u3066\u3001xCode\u306e\u5de6\u4e0a\u306eRun\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u306e\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u304ciPad\u306b\u8ee2\u9001\u3055\u308c\u307e\u3059\u3002<br \/>\n&nbsp;<br \/>\n<a href=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/skitch-3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/skitch-3.png\" alt=\"skitch-3\" width=\"153\" height=\"51\" class=\"alignnone size-full wp-image-3308\" srcset=\"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/skitch-3.png 153w, https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/skitch-3-150x51.png 150w\" sizes=\"auto, (max-width: 153px) 100vw, 153px\" \/><\/a><br \/>\n&nbsp;<br \/>\n\u3053\u306e\u30b3\u30fc\u30c9\u306f\u3001\u4ee5\u4e0b\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u3042\u308b\u753b\u50cf\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3044\u307e\u3059\u3002\u4ed6\u306b\u3082\u3044\u304f\u3064\u304b\u58c1\u7d19\u304c\u3042\u308b\u306e\u3067\u3001\u81ea\u5206\u306e\u597d\u304d\u306a\u58c1\u7d19\u306e\u540d\u524d\u306b\u66f8\u304d\u63db\u3048\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n&nbsp;<br \/>\n<a href=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/skitch-2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/skitch-2-300x83.png\" alt=\"skitch-2\" width=\"300\" height=\"83\" class=\"alignnone size-medium wp-image-3303\" srcset=\"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/skitch-2-300x83.png 300w, https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/skitch-2-1024x284.png 1024w, https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2013\/03\/skitch-2.png 1369w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h3>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8868\u793a\u3057\u3066\u307f\u308b<\/h3>\n<p>\u540c\u3058\u624b\u9806\u3067\u3001\u58c1\u7d19\u306e\u624b\u524d\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8868\u793a\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nobject.loadImage(\"object\/Target1.png\");\r\n<\/pre>\n<p>\u3053\u308c\u3082\u540c\u3058\u3088\u3046\u306b\u3001\u3059\u304d\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u540d\u524d\u306b\u66f8\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>\u7c21\u5358\u306a\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3<\/h1>\n<h3>\u753b\u50cf\u3092\u79fb\u52d5\u3057\u3066\u307f\u308b<\/h3>\n<p>\u6b21\u306b\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u52d5\u304b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u52d5\u304b\u3059\u305f\u3081\u306b\u306f\u3001x\u5ea7\u6a19\u3068y\u5ea7\u6a19\u3068\u3044\u3046\u4f4d\u7f6e\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306e\u30eb\u30fc\u30eb\u3092\u77e5\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2014\/07\/1.5-565x256.jpg\" alt=\"1.5\" width=\"565\" height=\"256\" class=\"alignnone size-large wp-image-3987\" srcset=\"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2014\/07\/1.5-565x256.jpg 565w, https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2014\/07\/1.5-300x136.jpg 300w, https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2014\/07\/1.5.jpg 645w\" sizes=\"auto, (max-width: 565px) 100vw, 565px\" \/><\/p>\n<p>&nbsp;<br \/>\n\u307f\u306a\u3055\u3093\u304c\u4eca\u307e\u3067\u52c9\u5f37\u3057\u3066\u6765\u305f\u6570\u5b66\u306e\u5ea7\u6a19\u3068\u9055\u3044\u3001\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u5834\u5408\u306f\u4e00\u822c\u7684\u306b\u5de6\u4e0a\u304c\u8d77\u70b9\u306b\u306a\u308a\u307e\u3059\u3002\u3067\u3059\u306e\u3067\u3001\u7279\u306by\u8ef8\u65b9\u5411\u304c\u4e0a\u304b\u3089\u4e0b\u306b\u5411\u304b\u3063\u3066\u6570\u5024\u304c\u5897\u3048\u3066\u3044\u304f\u3068\u3044\u3046\u3053\u3068\u3092\u899a\u3048\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u52d5\u304b\u3059\u524d\u306b\u3001\u307e\u305a\u306f\u30a2\u30d7\u30ea\u306e\u8d77\u52d5\u6642\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f4d\u7f6e\u3092\u5909\u3048\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>setup()\u306e\u4e2d\u306eposX\u3001posY\u306e\u5024\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u3048\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nposX = 100;   \/\/\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306ex\u5ea7\u6a19\r\nposY = 100;   \/\/\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306ey\u5ea7\u6a19\r\n<\/pre>\n<p>\u3069\u3046\u3067\u3059\u304b\u3002\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f4d\u7f6e\u304c\u5909\u308f\u3063\u305f\u3068\u601d\u3044\u307e\u3059\u3002\u3055\u3089\u306b\u3001\u305d\u306e\u4e0b\u306exspeed\u306e\u5024\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nxspeed = 2; \/\/x\u8ef8\u65b9\u5411\u306e\u901f\u5ea6\r\n<\/pre>\n<p>\u3059\u308b\u3068\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u53f3\u306b\u52d5\u304d\u51fa\u3057\u307e\u3059\u3002\u540c\u3058\u3088\u3046\u306byspeed\u306e\u5024\u3082\u5909\u3048\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u3053\u306e\u307e\u307e\u3060\u3068\u30aa\u30d6\u30a8\u30b8\u30a7\u30af\u3068\u306f\u884c\u3063\u305f\u304d\u308a\u623b\u3063\u3066\u304d\u307e\u305b\u3093\u3002\u305d\u3053\u3067\u3001update()\u306e\u4e2d\u306e\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u6709\u52b9\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nif(posX > ofGetWidth()) posX = 0;\r\nelse if(posX < 0) posX = ofGetWidth();\r\n    \r\nif(posY > ofGetHeight()) posY = 0;\r\nelse if(posY < 0) posY = ofGetHeight();\r\n<\/pre>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306f\u3082\u3068\u3082\u3068\u300c\/*\u300d\u3068\u300c*\/\u300d\u306b\u56f2\u307e\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u72b6\u614b\u3060\u3068\u30b3\u30fc\u30c9\u304c\u7121\u52b9\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u308c\u3089\u306e\u8a18\u53f7\u3092\u524a\u9664\u3057\u3066\u3042\u3052\u308b\u3068\u3001\u30b3\u30fc\u30c9\u304c\u6709\u52b9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3059\u308b\u3068\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u7aef\u307e\u3067\u884c\u304f\u3068\u6700\u521d\u306e\u5730\u70b9\u306b\u623b\u3063\u3066\u6765\u307e\u3059\u3002<\/p>\n<h3>\u753b\u9762\u3092\u30bf\u30c3\u30c1\u3057\u3066\u79fb\u52d5\u3057\u3066\u307f\u308b<\/h3>\n<p>\u66f4\u306b\u3001\u753b\u9762\u3092\u30bf\u30c3\u30c1\u3059\u308b\u4e8b\u306b\u3088\u3063\u3066\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f4d\u7f6e\u3092\u5909\u3048\u3066\u307f\u307e\u3057\u3087\u3046\u3002touchDown()\u306e\u4e2d\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nvoid testApp::touchDown(ofTouchEventArgs & touch){\r\n    \r\n    posX = touch.x;\r\n    posY = touch.y;\r\n}\r\n<\/pre>\n<h3>\u30e9\u30f3\u30c0\u30e0\u306b\u52d5\u304b\u3057\u3066\u307f\u308b<\/h3>\n<p>\u6b21\u306f\u3001\u30bf\u30c3\u30c1\u3059\u308b\u3054\u3068\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u30e9\u30f3\u30c0\u30e0\u306a\u65b9\u5411\u306b\u52d5\u304f\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nvoid testApp::touchDown(ofTouchEventArgs & touch){\r\n    \r\n    posX = touch.x; \/\/\u30bf\u30c3\u30c1\u3057\u305f\u5730\u70b9\u304c\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f4d\u7f6e\u306b\u306a\u308b\r\n    posY = touch.y;\r\n    \r\n    xspeed = ofRandom(-5, 5);   \/\/\u30bf\u30c3\u30c1\u3059\u308b\u3054\u3068\u306b-5\u304b\u30895\u307e\u3067\u306e\u9593\u306e\u6570\u5024\u3092\u81ea\u52d5\u7684\u306b\u8a2d\u5b9a\r\n    yspeed = ofRandom(-5, 5);\r\n}\r\n<\/pre>\n<h1>\u52a0\u901f\u5ea6\u30bb\u30f3\u30b5\u30fc<\/h1>\n<h3>\u753b\u50cf\u3092\u50be\u3051\u3066\u52d5\u304b\u3057\u3066\u307f\u308b<\/h3>\n<p>\u52a0\u901f\u5ea6\u30bb\u30f3\u30b5\u30fc\u306f\u610f\u5916\u306b\u7c21\u5358\u3067\u3059\u3002\u307e\u305a\u306fsetup()\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u307e\u3057\u3087\u3046\u3002ofxAccelerometer.setup()\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002\u66f4\u306b\u3001\u3072\u3068\u307e\u305axspeed\u306f0\u306b\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nvoid testApp::setup(){\r\n\t\r\n    ofxAccelerometer.setup();   \/\/\u52a0\u901f\u5ea6\u30bb\u30f3\u30b5\u30fc\u3092\u4f7f\u3046\r\n\r\n\twallpaper.loadImage(\"wallpaper\/Default1-Portrait~ipad.png\");\r\n\tobject.loadImage(\"object\/Target1.png\");\r\n    \r\n    posX = 100;   \/\/\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306ex\u5ea7\u6a19\r\n    posY = 100;   \/\/\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306ey\u5ea7\u6a19\r\n    \r\n    xspeed = 0; \/\/x\u8ef8\u65b9\u5411\u306e\u901f\u5ea6\r\n    yspeed = 0; \/\/y\u8ef8\u65b9\u5411\u306e\u901f\u5ea6\r\n    \r\n    reaction = 0.7; \/\/\u53cd\u767a\u529b\r\n}\r\n<\/pre>\n<p>\u3055\u3089\u306b\u3001update()\u306b2\u884c\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nvoid testApp::update(){\r\n    \r\n    xspeed += ofxAccelerometer.getForce().x;    \/\/\u30bb\u30f3\u30b5\u30fc\u306e\u5024\u3092\u901f\u5ea6\u306b\u52a0\u7b97\r\n    yspeed -= ofxAccelerometer.getForce().y;\r\n    \r\n    posX += xspeed;\r\n    posY += yspeed;\r\n    \r\n    \/\/\u7e70\u308a\u8fd4\u3057\r\n    \/*\r\n    if(posX > ofGetWidth()) posX = 0;\r\n    else if(posX < 0) posX = ofGetWidth();\r\n    \r\n    if(posY > ofGetHeight()) posY = 0;\r\n    else if(posY < 0) posY = ofGetHeight();\r\n    *\/\r\n    \r\n    \/\/\u6298\u308a\u8fd4\u3057\r\n    if(posX > ofGetWidth()) posX = ofGetWidth();\r\n    else if(posX < 0) posX = 0;\r\n    \r\n    if(posY > ofGetHeight()) posY = ofGetHeight();\r\n    else if(posY < 0) posY = 0;\r\n    \r\n    \/\/\u30d0\u30a6\u30f3\u30b9\r\n    \/*\r\n    if(posX > ofGetWidth()) { posX = ofGetWidth(); xspeed *= -reaction; }\r\n    else if(posX < 0)  { posX = 0; xspeed *= -reaction; }\r\n    \r\n    if(posY > ofGetHeight()) { posY = ofGetHeight(); yspeed *= -reaction; }\r\n    else if(posY < 0)  { posY = 0; yspeed *= -reaction; }\r\n    *\/\r\n}\r\n<\/pre>\n<p>\u8ffd\u52a0\u3055\u308c\u305f\u306e\u306f\u30013, 4\u884c\u76ee\u3067\u3059\u3002\u305d\u3057\u3066\u3001\u300c\u7e70\u308a\u8fd4\u3057\u300d\u306e\u30b3\u30fc\u30c9\u306f\u505c\u6b62\u3057\u3001\u300c\u6298\u308a\u8fd4\u3057\u300d\u306e\u30b3\u30fc\u30c9\u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u4e8b\u306b\u3088\u3063\u3066\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u7aef\u307e\u3067\u884c\u304f\u3068\u6b62\u307e\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u753b\u50cf\u3092\u30d0\u30a6\u30f3\u30c9\u3055\u305b\u3066\u307f\u308b<\/h3>\n<p>\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30d0\u30a6\u30f3\u30c9\u3055\u305b\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3002update()\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nvoid testApp::update(){\r\n    \r\n    xspeed += ofxAccelerometer.getForce().x;    \/\/\u30bb\u30f3\u30b5\u30fc\u306e\u5024\u3092\u901f\u5ea6\u306b\u52a0\u7b97\r\n    yspeed -= ofxAccelerometer.getForce().y;\r\n    \r\n    posX += xspeed;\r\n    posY += yspeed;\r\n    \r\n    \/\/\u7e70\u308a\u8fd4\u3057\r\n    \/*\r\n    if(posX > ofGetWidth()) posX = 0;\r\n    else if(posX < 0) posX = ofGetWidth();\r\n    \r\n    if(posY > ofGetHeight()) posY = 0;\r\n    else if(posY < 0) posY = ofGetHeight();\r\n    *\/\r\n    \r\n    \/\/\u6298\u308a\u8fd4\u3057\r\n    \/*\r\n    if(posX > ofGetWidth()) posX = ofGetWidth();\r\n    else if(posX < 0) posX = 0;\r\n    \r\n    if(posY > ofGetHeight()) posY = ofGetHeight();\r\n    else if(posY < 0) posY = 0;\r\n    *\/\r\n    \r\n    \/\/\u30d0\u30a6\u30f3\u30c9\r\n    if(posX > ofGetWidth()) { posX = ofGetWidth(); xspeed *= -reaction; }\r\n    else if(posX < 0)  { posX = 0; xspeed *= -reaction; }\r\n    \r\n    if(posY > ofGetHeight()) { posY = ofGetHeight(); yspeed *= -reaction; }\r\n    else if(posY < 0)  { posY = 0; yspeed *= -reaction; }\r\n}\r\n<\/pre>\n<p>\u66f4\u306b\u3001setup()\u306e\u4e2d\u306ereaction\u306e\u5024\u3092\u5909\u3048\u308b\u3068\u53cd\u767a\u529b\u304c\u5909\u308f\u308a\u307e\u3059\u3002\u53cd\u767a\u3057\u305f\u3068\u304d\u306b\u6e1b\u901f\u3057\u3066\u884c\u3063\u3066\u6b32\u3057\u3044\u306e\u3067\u30011.0\u672a\u6e80\u306e\u5024\u3092\u5165\u308c\u307e\u3059\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nreaction = 0.7; \/\/\u53cd\u767a\u529b\r\n<\/pre>\n<h1>\u30ab\u30e1\u30e9<\/h1>\n<h3>\u64ae\u5f71\u3057\u3066\u307f\u308b<\/h3>\n<p>\u307e\u305a\u3001\u300cmyImagePickerStart\u300d\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30fb\u89e3\u51cd\u3057\u6240\u5b9a\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u5165\u308c\u3001\u5b9f\u884c\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n\u666e\u901a\u306b\u30ab\u30e1\u30e9\u304c\u8d77\u52d5\u3057\u3066\u3001\u5199\u771f\u3092\u64ae\u308b\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2014\/07\/myImagePickerStart2014.zip\">myImagePickerStart2014<\/a><\/p>\n<h3>\u30a8\u30d5\u30a7\u30af\u30c8\u3092\u304b\u3051\u3066\u307f\u308b<\/h3>\n<p>\u3082\u3061\u308d\u3093\u3001\u3053\u308c\u3060\u3051\u3060\u3068\u3064\u307e\u3089\u306a\u3044\u306e\u3067\u3001\u5c11\u3057\u8272\u5473\u3092\u5909\u3048\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u6b21\u306b\u3001update()\u306e\u4e2d\u306e\u3001effect1\u306e\u90e8\u5206\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\ndisplayPixels[y*cameraW*4 + x*4] = g;   \/\/\u8d64\r\ndisplayPixels[y*cameraW*4 + x*4 + 1] = b;   \/\/\u7dd1\r\ndisplayPixels[y*cameraW*4 + x*4 + 2] = r;   \/\/\u9752\r\ndisplayPixels[y*cameraW*4 + x*4 + 3] = 255;\r\n<\/pre>\n<p>\u30e2\u30cb\u30bf\u306e\u8272\u306f\u3001red\uff08\u8d64\uff09\u3001green\uff08\u7dd1\uff09\u3001blue\uff08\u9752\uff09\u306e\u9806\u756a\u3067\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u9806\u756a\u3092\u5909\u3048\u3066\u307f\u307e\u3059\u3002<br \/>\n\u672c\u6765\u8d64\u306e\u90e8\u5206\u304c\u7dd1\u306b\u3002\u672c\u6765\u7dd1\u306e\u90e8\u5206\u304c\u9752\u306b\u3002\u672c\u6765\u9752\u306e\u90e8\u5206\u304c\u8d64\u306b\u5909\u63db\u3055\u308c\u307e\u3059\u3002\u304b\u306a\u308a\u8272\u304c\u5909\u5316\u3057\u305f\u306e\u304c\u5206\u304b\u308b\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002\u3053\u308c\u3092\u5143\u306b\u3057\u3066\u8272\u3005\u7d44\u307f\u5408\u308f\u305b\u3092\u5909\u3048\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u6b21\u306e\u30a8\u30d5\u30a7\u30af\u30c8\u306f\u3001\u5b8c\u5168\u306b\u8272\u3092\u53cd\u8ee2\u3055\u305b\u307e\u3059\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\ndisplayPixels[y*cameraW*4 + x*4] = 255 - r;     \/\/\u8d64\r\ndisplayPixels[y*cameraW*4 + x*4 + 1] = 255 - g;     \/\/\u7dd1\r\ndisplayPixels[y*cameraW*4 + x*4 + 2] = 255 - b;     \/\/\u9752\r\ndisplayPixels[y*cameraW*4 + x*4 + 3] = 255;\r\n<\/pre>\n<p>\u3053\u306e\u30a8\u30d5\u30a7\u30af\u30c8\u306f\u767d\u3068\u9ed2\u306e2\u968e\u8abf\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nint brightness = (r + g + b)\/3;\r\n\r\nif(brightness < 127)\r\n{\r\n    displayPixels[y*cameraW*4 + x*4] = 255;     \/\/\u8d64\r\n    displayPixels[y*cameraW*4 + x*4 + 1] = 0;     \/\/\u7dd1\r\n    displayPixels[y*cameraW*4 + x*4 + 2] = 0;     \/\/\u9752\r\n    displayPixels[y*cameraW*4 + x*4 + 3] = 255;\r\n    \r\n}else if(brightness >=127)\r\n{\r\n    displayPixels[y*cameraW*4 + x*4] = 255;     \/\/\u8d64\r\n    displayPixels[y*cameraW*4 + x*4 + 1] = 255;     \/\/\u7dd1\r\n    displayPixels[y*cameraW*4 + x*4 + 2] = 255;     \/\/\u9752\r\n    displayPixels[y*cameraW*4 + x*4 + 3] = 255;\r\n}\r\n<\/pre>\n<h1>\u5730\u56f3<\/h1>\n<h3>\u307e\u305a\u306f\u5730\u56f3\u3092\u8868\u793a\u3057\u3066\u307f\u308b<\/h3>\n<p>\u307e\u305a\u306f\u300cmyMapKitStart\u300d\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30fb\u89e3\u51cd\u3001\u6240\u5b9a\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u5165\u308c\u3001\u5b9f\u884c\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n\u554f\u984c\u306a\u3051\u308c\u3070\u5730\u56f3\u304c\u8868\u793a\u3055\u308c\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n<p><a href=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2014\/07\/myMapKitStart2014.zip\">myMapKitStart2014<\/a><\/p>\n<h3>\u5730\u56f3\u306e\u8868\u793a\u65b9\u6cd5\u3092\u5909\u3048\u3066\u307f\u308b\uff08\u901a\u5e38\u3001\u885b\u661f\u753b\u50cf\u3001\u6df7\u5408\uff09<\/h3>\n<p>setup()\u306e\u4e2d\u3067\u3001\u306f\u3058\u3081\u306f\u5730\u56f3\u306e\u307f\u3092\u8868\u793a\u3059\u308b\u30e2\u30fc\u30c9\u306b\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u885b\u661f\u5199\u771f\u3084\u5730\u56f3\u3068\u885b\u661f\u5199\u771f\u306e\u6df7\u5408\u3082\u8a66\u3057\u3066\u307f\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nmapKit.setType(OFXIPHONE_MAPKIT_MAP);\r\nmapKit.setType(OFXIPHONE_MAPKIT_SATELLITE);\r\nmapKit.setType(OFXIPHONE_MAPKIT_HYRBID);\r\n<\/pre>\n<h3>\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u73fe\u5728\u5730\u306b\u79fb\u52d5\u3057\u3066\u307f\u308b<\/h3>\n<p>setup()\u306b2\u884c\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\ncLocation = new ofxiPhoneCoreLocation();\r\nhasGPS = cLocation->startLocation();\r\n<\/pre>\n<p>\u6b21\u306b\u3001update()\u5185\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nvoid ofApp::update() {\r\n\tif(mapKit.isOpen()) {\r\n\/\/\t\tprintf(\"User is %son screen\\n\", mapKit.isUserOnScreen() ? \"\" : \"not \");\r\n        \r\n        if(locFlag1 == TRUE)\r\n        {\r\n            mapKit.setCenter(cLocation->getLatitude(),cLocation->getLongitude(),true);\r\n            locFlag1 = FALSE;\r\n        }\r\n\t}\t\r\n}\r\n<\/pre>\n<p>\u5b8c\u5168\u306a\u30b3\u30fc\u30c9\uff08setup()\u3068update()\uff09\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\n\/\/--------------------------------------------------------------\r\nvoid ofApp::setup(){\t\r\n    \r\n    ofBackground(0, 0);\r\n    \r\n    cLocation = new ofxiPhoneCoreLocation();\r\n    hasGPS = cLocation->startLocation();\r\n    \r\n\t\/\/ initialize the accelerometer\r\n\tofxAccelerometer.setup();\r\n\t\r\n\t\/\/ dump lots of info to console (useful for debugging)\r\n\tofSetLogLevel(OF_LOG_VERBOSE);\r\n\t\r\n\tofEnableAlphaBlending();\r\n\t\r\n\t\/\/ load font for displaying info\r\n\tfont.loadFont(\"verdana.ttf\", 12);\r\n\t\r\n\t\/\/ open the mapview\r\n\tmapKit.open();\r\n\t\r\n\t\/\/ set initial position to specified coordinates, and cover 1000 Km x 1000 Km area\r\n\tmapKit.setRegionWithMeters(POS2_LATITUDE, POS2_LONGITUDE, 1000, 1000);\r\n\r\n\t\/\/ optionally add ofApp as a listener for map event (callbacks below)\r\n\tmapKit.addListener(this);\r\n\t\r\n\t\/\/ set other optional parameters\r\n\tmapKit.setShowUserLocation(true);\r\n\tmapKit.setType(ofxiOS_MAPKIT_HYRBID);\r\n\/\/\tmapKit.setAllowZoom(false);\r\n\/\/\tmapKit.setAllowScroll(false);\r\n\/\/\tmapKit.setAllowUserInteraction(false);\r\n\t\r\n\t\/\/ do some hardcode OPTIONAL stuff to render the opengl view ONTOP of the map view\r\n\t\/\/ note this could affect performance quite seriously\r\n\t\r\n\t\/\/ add OpenGL View main window.\r\n    ofxiOSSendGLViewToFront();\r\n\t\r\n\t\/\/ OpenGL View is now in front of mapview, but it isn't transparent, so we can't see the map\r\n\t\/\/ Make the map transparent so we can see the mapview in undrawn areas\r\n\tofxiOSSetGLViewTransparent(true);\r\n\t\r\n\t\/\/ Now that the OpenGL view is in front of the mapview, it will receive all the touch events, so we cannot interact with the map\r\n\t\/\/ So disable interaction with the OpenGL view (ofApp::touchXXXXX will not be called)\r\n\tofxiOSSetGLViewUserInteraction(false);\r\n    \r\n    myGuiViewController = [[MyGuiView alloc] initWithNibName:@\"MyGuiView\" bundle:nil];\r\n\t[ofxiPhoneGetGLParentView() addSubview:myGuiViewController.view];\r\n    \r\n    locFlag1 = locFlag2 = locFlag3 = FALSE;\r\n}\r\n\r\n\r\n\/\/--------------------------------------------------------------\r\nvoid ofApp::update() {\r\n\tif(mapKit.isOpen()) {\r\n\/\/\t\tprintf(\"User is %son screen\\n\", mapKit.isUserOnScreen() ? \"\" : \"not \");\r\n        \r\n        if(locFlag1 == TRUE)\r\n        {\r\n            mapKit.setCenter(cLocation->getLatitude(),cLocation->getLongitude(),true);\r\n            locFlag1 = FALSE;\r\n        }\r\n\t}\t\r\n}\r\n<\/pre>\n<h3>\u81ea\u5206\u304c\u884c\u304d\u305f\u3044\u5834\u6240\u306b\u79fb\u52d5\u3057\u3066\u307f\u308b<\/h3>\n<p>update()\u306e\u90e8\u5206\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3059\u308b\u3060\u3051\u3067\u3059\u3002\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u306f\u30f4\u30a7\u30eb\u30b5\u30a4\u30e6\u5bae\u6bbf\u306e\u7def\u5ea6\u7d4c\u5ea6\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre lang=\"java\" line=\"1\">\r\nvoid testApp::update() {\r\n\tif(mapKit.isOpen()) {\r\n\/\/\t\tprintf(\"User is %son screen\\n\", mapKit.isUserOnScreen() ? \"\" : \"not \");\r\n        \r\n        if(locFlag1 == TRUE)\r\n        {\r\n            \/\/mapKit.setCenter(cLocation->getLatitude(),cLocation->getLongitude(),true);\r\n            mapKit.setCenter(35.685605,139.752275,true);\r\n            locFlag1 = FALSE;\r\n        }\r\n\t}\r\n}\r\n<\/pre>\n<pre lang=\"java\" line=\"1\">\r\n\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u3001\u4f4d\u7f6e\u60c5\u5831\u30923\u3064\u307e\u3067\u767b\u9332\u51fa\u6765\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\r\nlocFlag1, 2, 3\u3068\u5897\u3084\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002\r\n\r\nvoid ofApp::update() {\r\n\tif(mapKit.isOpen()) {\r\n\/\/\t\tprintf(\"User is %son screen\\n\", mapKit.isUserOnScreen() ? \"\" : \"not \");\r\n        \r\n        if(locFlag1 == TRUE)\r\n        {\r\n            mapKit.setCenter(cLocation->getLatitude(),cLocation->getLongitude(),true);\r\n            locFlag1 = FALSE;\r\n        }\r\n        \r\n        if(locFlag2 == TRUE)\r\n        {\r\n            mapKit.setCenter(41.890242, 12.492226,true);\r\n            locFlag2 = FALSE;\r\n        }\r\n        \r\n        if(locFlag3 == TRUE)\r\n        {\r\n            mapKit.setCenter(40.7197,-74.0019,true);\r\n            locFlag3 = FALSE;\r\n        }\r\n\t}\t\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u753b\u50cf\u306e\u8868\u793a \u307e\u305a\u306f\u3001\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u3068\u3053\u308d\u304b\u3089\u59cb\u3081\u3066\u307f\u307e\u3059\u3002\u4ee5&#8230; <a href=\"https:\/\/r-dimension.xsrv.jp\/classes_j\/of_basics\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,24],"tags":[],"class_list":["post-3650","post","type-post","status-publish","format-standard","hentry","category-media_third","category-openframeworks"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/posts\/3650","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/comments?post=3650"}],"version-history":[{"count":8,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/posts\/3650\/revisions"}],"predecessor-version":[{"id":3998,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/posts\/3650\/revisions\/3998"}],"wp:attachment":[{"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/media?parent=3650"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/categories?post=3650"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/tags?post=3650"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}