{"id":737,"date":"2012-04-27T11:11:30","date_gmt":"2012-04-27T02:11:30","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=737"},"modified":"2013-02-07T11:03:21","modified_gmt":"2013-02-07T02:03:21","slug":"ofxui%e3%81%a7%e6%96%87%e5%ad%97ofxuilabel%e3%81%8c%e8%a1%a8%e7%a4%ba%e3%81%95%e3%82%8c%e3%81%aa%e3%81%84%e3%80%82","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/openframeworks\/737","title":{"rendered":"ofxUI\u3067\u6587\u5b57(ofxUILabel)\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u3002"},"content":{"rendered":"<p>\u3081\u3061\u3083\u304f\u3061\u3083\u30ab\u30c3\u30b3\u30a4\u30a4openFrameworks\u306eGUI\u30a2\u30c9\u30aa\u30f3\u3092\u3064\u304b\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><!--more--><br \/>\n<iframe loading=\"lazy\" src=\"http:\/\/player.vimeo.com\/video\/36385123\" width=\"500\" height=\"281\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen><\/iframe><br \/>\n\u30ab\u30c3\u30b3\u30a4\u30a4\uff01<\/p>\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306f\u4ee5\u4e0b\u304b\u3089\u3002<br \/>\n<a href=\"https:\/\/github.com\/rezaali\/ofxUI\">https:\/\/github.com\/rezaali\/ofxUI<\/a><br \/>\n\u4f7f\u3044\u65b9\u306fREADME\u306e\u300cTUTORIAL\u300d\u306b\u66f8\u3044\u3066\u3042\u308b\u901a\u308a\u306a\u306e\u3067\u3059\u304c\u3001\u4e00\u90e8\u4fee\u6b63\u3057\u306a\u3044\u3068\u6587\u5b57\u304c\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\uff11\uff0egithub\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u89e3\u51cd\u2192\u30d5\u30a9\u30eb\u30c0\u540d\u3092ofxUI\u306b\u5909\u66f4\u2192 addons\u30d5\u30a9\u30eb\u30c0\u306b\u5165\u308c\u308b<br \/>\n\uff12\uff0eopenFrameworks\u306eemptyExample\u3092\u30b3\u30d4\u30fc<br \/>\n\uff13\uff0eXcode\u3067emptyExample\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u958b\u304f<br \/>\n\uff14\uff0eaddons\/ofxUI\/src \u30d5\u30a9\u30eb\u30c0\u3092\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306eaddons\u30d5\u30a9\u30eb\u30c0\u306b\u8ffd\u52a0<br \/>\n\uff15\uff0eaddon\/ofxXmlSettings \u30d5\u30a9\u30eb\u30c0\u3092\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306eaddons\u30d5\u30a9\u30eb\u30c0\u306b\u8ffd\u52a0<\/p>\n<p>\u3053\u3053\u307e\u3067\u3067\u6e96\u5099\u5b8c\u4e86\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u30b5\u30f3\u30d7\u30eb\u3092\u52d5\u304b\u3057\u3066\u307f\u307e\u3059\u3002<br \/>\nofxUI\/example-ofxUITutorial\u3000\u30d5\u30a9\u30eb\u30c0\u306ebin\/data\/gui\u304b\u3089gui\u30d5\u30a9\u30eb\u30c0 \u3092\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306edata\u30d5\u30a9\u30eb\u30c0\u306b\u8ffd\u52a0\u3002<br \/>\n\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u30b3\u30d4\u30da(\u30cf\u30a4\u30e9\u30a4\u30c8\u3055\u308c\u3066\u3044\u308b\u90e8\u5206\u304c\u8ffd\u52a0\u3057\u305f\u30b3\u30fc\u30c9\u3067\u3059\u3002\u5143\u306e\u30b3\u30fc\u30c9\u306f\u6d88\u3055\u305a\u306b\u305d\u306e\u307e\u307e\u3067\uff09<br \/>\n\u3000<\/p>\n<p>\u3000<br \/>\n<b>ofxUI\/example-ofxUITutorial\/src\/testApp.h \u2192 emptyExample\/src\/testApp.h<\/b>[cpp highlight=&#8221;1,5,7&#8243;]   <\/p>\n<p>#include &quot;ofxUI.h&quot;<\/p>\n<p>class testApp : public ofxiPhoneApp {<\/p>\n<p>    ofxUICanvas *gui;<br \/>\n    \/\/void exit(); \/\/\u4e8c\u91cd\u306b\u6307\u5b9a\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u306b\u306a\u308b\u306e\u3067\u524a\u9664\u3059\u308b\u304b\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8<br \/>\n    void guiEvent(ofxUIEventArgs &amp;e); <\/p>\n<p>}<\/p>\n<p>[\/cpp]<br \/>\n\u3000<\/p>\n<p>\u3000<br \/>\n<b>ofxUI\/example-ofxUITutorial\/src\/testApp.cpp \u2192 emptyExample\/src\/testApp.mm<\/b>[cpp highlight=&#8221;3-8,13,14,17-29&#8243;]<br \/>\nvoid testApp::setup(){<\/p>\n<p>    gui = new ofxUICanvas(0,0,320,320);<br \/>\n    gui-&gt;addWidgetDown(new ofxUILabel(&quot;OFXUI TUTORIAL&quot;, OFX_UI_FONT_LARGE));<br \/>\n    gui-&gt;addWidgetDown(new ofxUISlider(304,16,0.0,255.0,100.0,&quot;BACKGROUND VALUE&quot;));<br \/>\n    gui-&gt;addWidgetDown(new ofxUIToggle(32, 32, false, &quot;FULLSCREEN&quot;));<br \/>\n    ofAddListener(gui-&gt;newGUIEvent, this, &amp;testApp::guiEvent);<br \/>\n    gui-&gt;loadSettings(&quot;GUI\/guiSettings.xml&quot;);<br \/>\n}\t<\/p>\n<p>\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nvoid testApp::exit(){<br \/>\n    gui-&gt;saveSettings(&quot;GUI\/guiSettings.xml&quot;);<br \/>\n    delete gui;<br \/>\n}<br \/>\n\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nvoid testApp::guiEvent(ofxUIEventArgs &amp;e)<br \/>\n{<br \/>\n    if(e.widget-&gt;getName() == &quot;BACKGROUND VALUE&quot;)<br \/>\n    {<br \/>\n        ofxUISlider *slider = (ofxUISlider *) e.widget;<br \/>\n        ofBackground(slider-&gt;getScaledValue());<br \/>\n    }<br \/>\n    else if(e.widget-&gt;getName() == &quot;FULLSCREEN&quot;)<br \/>\n    {<br \/>\n        ofxUIToggle *toggle = (ofxUIToggle *) e.widget;<br \/>\n        ofSetFullscreen(toggle-&gt;getValue());<br \/>\n    }<br \/>\n}<br \/>\n[\/cpp]<br \/>\n\u3000<\/p>\n<p>\u3000<br \/>\n\u3053\u308c\u3067\u4e00\u5fdc\u30d3\u30eb\u30c9\u306f\u901a\u308b\u3057\u30b9\u30e9\u30a4\u30c0\u30fc\u306a\u3069\u306f\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3059\u304c\u6587\u5b57\uff08ofxUILabel\uff09\u304c\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002 orz<br \/>\n[code]<br \/>\nError : font not allocated iphone<br \/>\n[\/code]<br \/>\n\u3068\u3044\u3046\u30a2\u30e9\u30fc\u30c8\u304c\u51fa\u307e\u304f\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u30d5\u30a9\u30f3\u30c8\u304c\u8aad\u307f\u8fbc\u3081\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u307e\u305adata\/GUI\u306e\u306a\u304b\u306b\u3042\u308b\u30d5\u30a9\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u300cNewMedia Fett.ttf\u300d\u3092\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306edata\u30d5\u30a9\u30eb\u30c0\u306e\u76f4\u4e0b\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002<\/p>\n<p>setup()\u95a2\u6570\u306b\u4ee5\u4e0b\u306e\u4e00\u6587\u3092\u8ffd\u52a0<br \/>\n[cpp highlight=&#8221;4&#8243;]<br \/>\nvoid testApp::setup(){<\/p>\n<p>    gui = new ofxUICanvas(0,0,320,320);<br \/>\n    gui-&gt;setupFont(&quot;NewMedia Fett.ttf&quot;); \/\/\u8ffd\u52a0<br \/>\n    gui-&gt;addWidgetDown(new ofxUILabel(&quot;OFXUI TUTORIAL&quot;, OFX_UI_FONT_LARGE));<br \/>\n    gui-&gt;addWidgetDown(new ofxUISlider(304,16,0.0,255.0,100.0,&quot;BACKGROUND VALUE&quot;));<br \/>\n    gui-&gt;addWidgetDown(new ofxUIToggle(32, 32, false, &quot;FULLSCREEN&quot;));<br \/>\n    ofAddListener(gui-&gt;newGUIEvent, this, &amp;testApp::guiEvent);<br \/>\n    gui-&gt;loadSettings(&quot;GUI\/guiSettings.xml&quot;);<br \/>\n}<br \/>\n[\/cpp]<\/p>\n<p>\u3053\u308c\u3067\u3001\u3061\u3083\u3093\u3068\u30e9\u30d9\u30eb\u304c\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001<br \/>\n[cpp]<br \/>\n gui-&gt;setupFont(&quot;GUI\/NewMedia Fett.ttf&quot;);<br \/>\n[\/cpp]<br \/>\n\u4e0a\u8a18\u306e\u65b9\u6cd5\u3067\u306f\u3001\u30d5\u30a9\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u304c\u8aad\u307f\u8fbc\u3081\u307e\u305b\u3093\u3067\u3057\u305f\u3002<br \/>\ndata\u30d5\u30a9\u30eb\u30c0\u76f4\u4e0b\u3067\u306a\u3044\u3068\u30c0\u30e1\u307f\u305f\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3081\u3061\u3083\u304f\u3061\u3083\u30ab\u30c3\u30b3\u30a4\u30a4openFrameworks&hellip;<\/p>\n","protected":false},"author":1,"featured_media":746,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-737","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-openframeworks","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/737","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/comments?post=737"}],"version-history":[{"count":31,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/737\/revisions"}],"predecessor-version":[{"id":763,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/737\/revisions\/763"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/746"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}