User Tools

Site Tools


programming_fundamentals_with_processing:ch02-getting-going.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
programming_fundamentals_with_processing:ch02-getting-going.html [2017/07/26 15:52] – [Source code] mithatprogramming_fundamentals_with_processing:ch02-getting-going.html [2017/07/26 16:03] – [Entry points] mithat
Line 18: Line 18:
 Below is one of the simplest Processing programs you can write. When executed, it will print an important message about cranberries. Below is one of the simplest Processing programs you can write. When executed, it will print an important message about cranberries.
  
-**program ''%%cranberries_basic.pde%%'':** +<file  java cranberries_basic_mode.pde>
- +
-<code java>+
 println("Cranberries are high in antioxidants."); println("Cranberries are high in antioxidants.");
-</code> +</file>
-This is an example of a program written in what Processing calls its Basic Mode. In Basic Mode, the program's execution will begin at the first statement in the source code file. It will then continue statement-by-statement until it reaches the end of the file. Here's a program with two statements:+
  
-**program ''%%cranberries_and_more.pde%%'':**+This is an example of a program written in what Processing calls its Basic ModeIn Basic Mode, the program's execution will begin at the first statement in the source code file. It will then continue statement-by-statement until it reaches the end of the file.
  
-<code java>+Here's a program with two statements: 
 + 
 +<file java cranberries_and_more.pde>
 println("Cranberries are high in antioxidants."); println("Cranberries are high in antioxidants.");
 println("Some blueberries too."); println("Some blueberries too.");
-</code+</file> 
-Processing's Basic Mode is an extremely easy way to program. However, the rules of Basic Mode state that you are not allowed to define any functions in Basic Mode--which as we shall see later is quite a serious limitation. Therefore, for the remainder of this text we are going to pretend that Processing's Basic Mode doesn't exist and focus entirely on what Processing calls its Continuous Mode--described next.+ 
 +Processing's Basic Mode is an extremely easy way to program. However, the rules of Basic Mode state that you are not allowed to define any functions in Basic Mode---which as we shall see later is quite a serious limitation. Therefore, for the remainder of this text we are going to pretend that Processing's Basic Mode doesn't exist and focus entirely on what Processing calls its Continuous Mode. We describe that next.
  
 === Processing with an entry point === === Processing with an entry point ===
  
-Processing will automatically switch to Continuous Mode when you define at least one function in your program. (This is why you are not allowed to define functions in Basic Mode.) In Continuous Mode, Processing will look for a definition of a function called **''%%setup%%''** and use this function as the point where the programs execution begins. Below is the Continuous Mode equivalent of the Basic Mode example above.+Processing will automatically switch to Continuous Mode when you define at least one function in your program. (This is why you are not allowed to define functions in Basic Mode.) In Continuous Mode, Processing will look for a definition of a function called **''%%setup%%''**and it will use this function as the point where the programs execution begins. Below is the Continuous Mode equivalent of the Basic Mode example above.
  
-**program ''%%cranberries_continuous.pde%%'':** +<file java cranberries_continuous_mode.pde>
- +
-<code java>+
 void setup() { void setup() {
   println("Cranberries are high in antioxidants.");   println("Cranberries are high in antioxidants.");
 } }
-</code>+</file> 
 This program consists of a definition of the ''%%setup%%'' function that has only one statement in it. If you run this program, you will discover that it too prints out an important message about cranberries. This program consists of a definition of the ''%%setup%%'' function that has only one statement in it. If you run this program, you will discover that it too prints out an important message about cranberries.
  
Line 50: Line 49:
 <code java> <code java>
 void setup() { void setup() {
-   
 } }
 </code> </code>
programming_fundamentals_with_processing/ch02-getting-going.html.txt · Last modified: 2017/07/26 17:44 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki