In Java programming language, every functions are put inside a class. And to make those functions easier to find and use from classes, Java support grouping a pack of classes into a package. GTGE utilize this class packaging feature to make GTGE API well structured, and make finding and using GTGE functions much easier.
GTGE create a class based on functions (for example class for graphics functions), and group similar classes (for example engine classes) into a package. Let see GTGE Diagram :
As we can see above, classes with similar characteristic are grouped into a package, the graphics class, input class, sound class that categorized as engine class are grouped in engine package, and the sprite class, background class, collision class that categorized as game object class are grouped in game object package.
There are 3 main packages in GTGE :
- Package com.golden.gamedev
This package contains core classes that initializes GTGE game engine and display the game.
- Package com.golden.gamedev.engine
This package contains GTGE engine classes, such as graphics engine, input engine, audio engine, etc.
- Package com.golden.gamedev.object
This package contains game object classes, such as sprite, background, etc.
With GTGE classes neatly packaged, finding functions and classes in GTGE can be done quickly and easily.
After we know how GTGE API is being organized, a little code prolog of how those classes can be used. In Java programming language import
keyword is used to use a class from a package.
For example: to use Sprite
class that reside in com.golden.gamedev.object
package
import com.golden.gamedev.object.Sprite;
In next chapter, this would be much clear (this is one of Java syntax that you should have been know anyway).