Using Java static members and static import in Gosu
Gosu supports static members on a type: variables, functions, and property declarations. A static member exists only on the type itself, not on instances of the type. You access static members on Java types just as you would on native Gosu types.
For Gosu code that accesses static members, you qualify the class that declares the static member or import the
static members from the class. For example, the following line uses the cosine function and the static reference
to value PI from the Math class without importing the static members:
var cosHalfPiDgrees = Math.cos(Math.PI * 0.5)
To use the static members without qualifying them with the class name, you use the syntax of the
uses statement that imports static members. For example, the following lines are equivalent to
the previous, single line of code:
uses java.lang.Math#*
var cosHalfPiDgrees = cos(PI * 0.5)
See also
