-
Notifications
You must be signed in to change notification settings - Fork 0
State
oleegholm edited this page Jan 18, 2012
·
1 revision
The states in a module defines the progress of the module, based on user input. When the module starts, exits, draw, forwards to another module. Here are two examples of how a state might work.
In this first case the module needs to react to a mouse click and store the coordinate point in a value:
- Case MouseDown(p, MouseButtonLeft, _) :: tail => {point = p}.
In //Case MouseDown// a mouse click is registered, and the coordinate is given to the variable //p//. Inside the code block p is passed on to a variable //Point//, which can be accessed from anywhere within the module.
Case matches can be used to do many different things. This case is a part of the Rectangle module, in which a MouseUp triggers this code:
- case MouseUp(point, _, _):: tail => {
- points = points :+ point
- if(points.length == 1) {
- Goto('SecondPoint)
In this example a point is added to a list of points. If there is already a points in the list, it means that the first corner of the rectangle has already been defined. In this case //Goto('SecondPoint) proceeds to execute the State SecondPoint, in which the rectangle is finalized.
- Home - Overview of Siigna
- About - Why we made Siigna
-
Siigna main - The "heart" of Siigna
- Architecture
- Action - Remote and local changes
- Event - How Siigna communicates
- Shape - The figures and geometry
-
Siigna module - The "brain" of Siigna
- Module - How a module is defined
- License - It's open source!
- Contact - Get in touch