{"id":1297,"date":"2009-05-22T10:29:58","date_gmt":"2009-05-22T09:29:58","guid":{"rendered":"http:\/\/funrecycler.com\/?p=1613"},"modified":"2009-05-22T10:29:58","modified_gmt":"2009-05-22T09:29:58","slug":"processing-hello-world","status":"publish","type":"post","link":"https:\/\/funrecycler.com\/index.php\/2009\/05\/22\/processing-hello-world\/","title":{"rendered":"processing &#8211; hello world"},"content":{"rendered":"<p style=\"overflow-wrap:anywhere\"><img decoding=\"async\" src=\"https:\/\/funrecycler.com\/wp-content\/uploads\/2009\/05\/m-afaaef8663724da0.png\" alt=\"processing_intro\" style=\"display:block;margin-left:auto;margin-right:auto;width:600px;height:100px;max-width:100%;height:auto\" \/> In meinen Beitrag <a href=\"https:\/\/funrecycler.com\/index.php\/2009\/05\/13\/processing-grafikprogrammierung\/\" style=\"overflow-wrap:anywhere\">Processing &#8211; Grafikprogrammierung<\/a> habe ich procressing vorgestellt. Nun m\u00f6chte ich in diesen Beitrag die Syntax der Sprache erl\u00e4utern. Zuerst ein paar Worte zum allgemeinen Aufbau des Quellcodes. <\/p>\n<p><!--more--><\/p>\n<p style=\"overflow-wrap:anywhere\"> In Processing besteht ein Programm immer aus 2 Teilen. In &quot;<strong>void setup<\/strong>&quot; werden allgemeine Einstellungen get\u00e4tigt. So kann die Gr\u00f6\u00dfe festegelegt, die Hintergrundfarbe aber auch globale Variablen k\u00f6nnen definiert werden. <\/p>\n<pre><code>void setup()\n{\n   size(400, 200);\n   background(132, 34, 23);\n   PFont font = loadFont(&quot;ArialMT-48.vlw&quot;);\n   textFont(font,20);\n}<\/code><\/pre>\n<p style=\"overflow-wrap:anywhere\"> \u00dcber &quot;<strong>size<\/strong>&quot; wird die Gr\u00f6\u00dfe in Pixel definiert. &quot;<strong>background<\/strong>&quot; definiert die Hintergrundfarbe. M\u00f6chte man Text ausgeben ist es n\u00f6tig eine Schriftart zuladen. &quot;<strong>PFont<\/strong>&quot; l\u00e4dt ein Font. Ein Font kann \u00fcber &quot;<strong>Tools &gt; Create Font<\/strong>&quot; direkt in Processing erstellt werden. Processing benutzt ein eigenes Font Format. Hat man einen Font erstellt, wird dieser im Data Ordner der IDE abgelegt und kann somit genutzt werden. &quot;<strong>textFont<\/strong>&quot; definert die Gr\u00f6\u00dfe f\u00fcr den zuvor geladenen Font. In &quot;<strong>void draw<\/strong>&quot; ruft man die eigentliche Zeichnungfunktion auf. <\/p>\n<pre><code>void draw()\n{\n   text(&quot;Hello World!&quot;, 20,40);\n}<\/code><\/pre>\n<p style=\"overflow-wrap:anywhere\"> Gezeichnet wird der Text \u00fcber &quot;<strong>text<\/strong>&quot;, die Position wird \u00fcber die X und Y Koordinate angegeben. Der Nullpunkt ist wie in vielen Bereichen der des Computers in der linken oberen Ecke. Processing = Java &#8230;. somit l\u00e4sst sich das Programm als Applet exportieren und hier direkt einf\u00fcgen.(<a href=\"http:\/\/www.java.com\/de\/\" style=\"overflow-wrap:anywhere\">Java<\/a> wird ben\u00f6tigt) <\/p>\n<p>Aktiver Inhalt entfernt: applet<\/p>\n<p style=\"overflow-wrap:anywhere\"> M\u00f6chte man nun selber bestimmen wo Hello World auftaucht, dann geht dies wie folgt. \u00dcber die Mouse Koordinaten welche beim bewegen \u00fcber das Anwendungfenster zur\u00fcckgegeben werden, kann der Text in der Anwenung positioniert werden. Die X und Y Koordinate der Mouse geben die Funktionen &quot;<strong>mouseX<\/strong>&quot; und &quot;<strong>mouseY<\/strong>&quot; zur\u00fcck. Zus\u00e4tzlich mu\u00df das klicken abgefragt werden, dies geschiet \u00fcber &quot;<strong>mousePressed<\/strong>&quot;. <\/p>\n<pre><code>void draw()\n{\n    if (mousePressed == true)\n    {\n       text(&quot;Hello World!&quot;, mouseX,mouseY);\n    }\n}<\/code><\/pre>\n<p style=\"overflow-wrap:anywhere\"> Viel Spa\u00df beim programmieren.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In meinen Beitrag Processing &#8211; Grafikprogrammierung habe ich procressing vorgestellt. Nun m\u00f6chte ich in diesen Beitrag die Syntax<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,3,5],"tags":[548,549,550,551],"class_list":["post-1297","post","type-post","status-publish","format-standard","hentry","category-allgemein","category-computer-und-technik","category-programmieren","tag-hello-world","tag-processing","tag-processing-hello-world","tag-processing-void-draw"],"_links":{"self":[{"href":"https:\/\/funrecycler.com\/index.php\/wp-json\/wp\/v2\/posts\/1297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/funrecycler.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/funrecycler.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/funrecycler.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/funrecycler.com\/index.php\/wp-json\/wp\/v2\/comments?post=1297"}],"version-history":[{"count":1,"href":"https:\/\/funrecycler.com\/index.php\/wp-json\/wp\/v2\/posts\/1297\/revisions"}],"predecessor-version":[{"id":2311,"href":"https:\/\/funrecycler.com\/index.php\/wp-json\/wp\/v2\/posts\/1297\/revisions\/2311"}],"wp:attachment":[{"href":"https:\/\/funrecycler.com\/index.php\/wp-json\/wp\/v2\/media?parent=1297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/funrecycler.com\/index.php\/wp-json\/wp\/v2\/categories?post=1297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/funrecycler.com\/index.php\/wp-json\/wp\/v2\/tags?post=1297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}