Background
jLogo Programming
- Commanding a Turtle
- Pseudocode
- Adding New Commands
- Iteration & Animation
- Hierarchical Structure
- Procedure Inputs
- Operators & Expressions
- Defining Operators
- Words & Sentences
- User Interface Events
- What If? (Predicates)
- Recursion
- Local Variables
- Global Variables
- Word/Sentence Iteration
- Mastermind Project
- Turtles As Actors
- Arrays
- File Input/Output
Java
- A Java Program
- What's a Class?
- Extending Existing Classes
- Types
- Turtle Graphics
- Control Flow
- User Interface Events
Appendices
- Jargon
- What Is TG?
- TG Directives
- jLogo Primitives
- TG Editor
- Java Tables
- Example Programs
- Installation Notes
Updates
- December 13, 2008
- March 7, 2009
- January 6, 2012
- March 15, 2013
- January 20, 2014
- February 13, 2014
- July 29, 2014
- January 18, 2016
- January 29, 2016
Lastly
New TG Features - March 15, 2013
Introduction
Version .0.9.35 of TG has new features that make it easier to use and enhancements that allow you to put together much more interesting applications.
Multi-line Commands
I finally gave in and added support for a tilde ('~') continuation character in the Editor (but not CommandCenter). You can now do things like:
|
LABEL Enhancements
Prior to version .9.35, the SETLABELHEIGHT command's input was a font size. There was no easy way to map font sizes to the actual pixel height of characters. I provided a table in documentation for SETLABELHEIGHT that gave estimates of character heights for a few font sizes.
Char Char Size Height Width ---- ------ ----- 12 9 7 14 10 8 16 12 9 18 14 10 24 18 14 32 22 18 |
In v.9.35 of TG, the input to SETLABELHEIGHT is a requested height for capital letters in the current font. TG does its best to choose the font size that has capital letters with the requested height.
In addition to better control over the height of LABELed text. A new operator, LABELWIDTH, outputs the width in turtle steps (pixels) of the textual representation of its input.
Following is an example of how the new LABEL stuff can be used to draw a button on the graphics canvas.
|
Table 1 provides documentation for the new/modified LABEL stuff.
Name | Input(s) | Description | |||||||||||||||||||||||||||||||||||||||||||||
LABELWIDTH | thing | Outputs the number of turtle steps wide the text representation of the input would be if it was drawn on the graphics canvas wit LABEL. The current font and label height are used to compute the amount. | |||||||||||||||||||||||||||||||||||||||||||||
SETLABELFONT | number |
Sets the font face and style of characters drawn on the graphics
canvas with the LABEL command.
|
|||||||||||||||||||||||||||||||||||||||||||||
SETLABELHEIGHT | number | The height of capital letters the turtle draws on the graphics canvas with the LABEL command is set to an approximation of the input. All other characters in the current font are drawn with heights proportional to capital letters. | |||||||||||||||||||||||||||||||||||||||||||||
|
Three Flavors of mouseClicked and mouseMoved
Name | Input(s) | Description |
MOUSECLICKED | When a mouseClicked Event is received by the TG program, if it is the left-button and it is in the graphics canvas, TG invokes a user-defined procedure with the name MOUSECLICKED if one has been defined. | |
MOUSECLICKED | xCor yCor | Similar to MOUSECLICKED defined without inputs, but the location of the mouse at the time of the click is provided in an X-coordinate input and a Y-coordinate input. |
MOUSECLICKED | posSentence | Similar to MOUSECLICKED defined without inputs, but the location of the mouse at the time of the click is provided as a two-number sentence input. The first number is the X-coordinate and the last number is the Y-coordinate (see POS operator). |
MOUSEMOVED | When a mouseMoved Event is received by TG, it performs a user-defined procedure named mouseMoved if one has been defined. mouseMoved Events only happen when the mouse is in an active graphics canvas. | |
MOUSEMOVED | xCor yCor | Similar to MOUSEMOVED defined without inputs, but the location of the mouse at the time of the mouseMoved Event is provided in an X-coordinate input and a Y-coordinate input. |
MOUSEMOVED | posSentence | Similar to MOUSEMOVED defined without inputs, but the location of the mouse at the time of the mouseMoved Event is provided as a two-number sentence input. The first number is the X-coordinate and the last number is the Y-coordinate (see POS operator). |
Directive Additions/Changes
Directives HELP, JLOGOFILES, PICTFILES, and PRINTPROCS now print their output to the CommandCenter in columnar format, as many as fit across the CommandCenter.
The VERSION directive prints TG's version number, the version number of the Java Virtual Machine (JVM), and the name and version number of the operating system.
A new directive, PWD, prints TG's current working directory - where it looks for stuff you load, like .wav files (audio clips), .bmp files (images), and .jlogo files (source code).
New Value: null
For additional compatibility with Java, a null value has been
introduced. All variables initially contain null, including all
members of an ARRAY. In comparison and assignment contexts, the word
"null
is now treated as a special case, like the words
"true
and "false
in boolean contexts.
Finally...
A first pass at character file input and output is complete. I'm holding off documenting it until I've written a few programs, just to make sure that what is provided meets the needs of typical programs. So, stay tuned...
Many other minor changes, have been made. A few bugs have been fixed. Checkout details at:
- Details on all TG directives are here (Appendix C).
- Details on all jLogo primitive procedures are here (Appendix D).
- Details on TG editor commands are here (Appendix E).