Extending Modules - ColoradoSchoolOfMines/interface_sdk GitHub Wiki

Modules

There are currently three types of Modules that can be extended from. We recommend using the ProcessingModule.

ProcessingModule

       Main article: Making a ProcessingModule

For a module to be a Processing module it must extend ProcessingModule. ProcessingModule requires two functions to be implemented- setup() and draw(). Setup is called once when the module is initialized to run. The draw() function is called in a continual loop as the program is run. The draw() function is where the body of the module should exist. All drawing is done using PApplet's functions, and subclasses must receive the PApplet as a parent in order to draw.

AWTModule

For a module to use AWT, it should extend from AWTModule. The extending class should implement a run() function to properly run. An AWTModule should call dispose() to exit. AWTModule extends from Frame, so it is not necessary to create a new Frame object with which to run AWT functions with.

CommandlineModule

To properly implement a module that runs on the command line, you will need to implement a run method that can have its own looping mechanism inside. There are no other requirements, as all graphics are provided by the console. However, you can only print text, due to the command line's nature.