gestalt.demo.basic
Class UsingEventHandling

java.lang.Object
  extended by gestalt.render.MinimalRenderer
      extended by gestalt.render.BasicRenderer
          extended by gestalt.render.AnimatorRenderer
              extended by gestalt.demo.basic.UsingEventHandling
All Implemented Interfaces:
Gestalt, GestaltKeyListener, GestaltMouseListener, Loopable

public class UsingEventHandling
extends AnimatorRenderer
implements GestaltKeyListener, GestaltMouseListener

this demo shows how to obtain mouse and key events there are two different ways to obtain events. 1 event model implement the 'GestaltKeyListener' and/or 'GestaltMouseListner' interfaces when event methods are invoked, the mouse coordinates and pressed keys are passed as argument 2 polling poll the EventHandler 'event' event.mouseX event.mouseY event.keyDown event.keyCode ... to use this demo, move the mouse over the window and press numbers 1 - 9


Field Summary
 
Fields inherited from class gestalt.render.MinimalRenderer
WORKAROUND_FORCE_QUIT
 
Fields inherited from interface gestalt.Gestalt
ALPHA, BIN_2D_BACKGROUND, BIN_2D_BACKGROUND_FINISH, BIN_2D_BACKGROUND_SETUP, BIN_2D_FOREGROUND, BIN_2D_FOREGROUND_FINISH, BIN_2D_FOREGROUND_SETUP, BIN_3D, BIN_3D_FINISH, BIN_3D_SETUP, BIN_ARBITRARY, BIN_FRAME_FINISH, BIN_FRAME_SETUP, BIN_NUMBER_OF_DEFAULT_BINS, BITMAP_BLENDFACTOR_DST_ALPHA, BITMAP_BLENDFACTOR_DST_COLOR, BITMAP_BLENDFACTOR_ONE, BITMAP_BLENDFACTOR_ONE_MINUS_DST_ALPHA, BITMAP_BLENDFACTOR_ONE_MINUS_DST_COLOR, BITMAP_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, BITMAP_BLENDFACTOR_ONE_MINUS_SRC_COLOR, BITMAP_BLENDFACTOR_SRC_ALPHA, BITMAP_BLENDFACTOR_SRC_ALPHA_SATURATE, BITMAP_BLENDFACTOR_SRC_COLOR, BITMAP_BLENDFACTOR_ZERO, BITMAP_BLENDMODE_ADD, BITMAP_BLENDMODE_ADD_2, BITMAP_BLENDMODE_MULTIPLY, BITMAP_BLENDMODE_OVERWRITE, BITMAP_COMPONENT_ORDER_BGRA, BITMAP_COMPONENT_ORDER_RGBA, BLUE, CAMERA_A_HANDY_ANGLE, CAMERA_CULLING_BACKFACE, CAMERA_CULLING_FRONT_AND_BACKFACE, CAMERA_CULLING_FRONTFACE, CAMERA_CULLING_NONE, CAMERA_MODE_LOOK_AT, CAMERA_MODE_ROTATE_XYZ, CAMERA_MODE_ROTATION_AXIS, ENGINE_JOGL, EPSILON, FOG_FILTER_EXP, FOG_FILTER_EXP2, FOG_FILTER_LINEAR, FONT_ALIGN_CENTER, FONT_ALIGN_LEFT, FONT_ALIGN_RIGHT, FONT_QUALITY_HIGH, FONT_QUALITY_LOW, FONT_STYLE_BOLD, FONT_STYLE_ITALIC, FONT_STYLE_REGULAR, GREEN, HINT_LEAVE_STATE_UNCHANGED, IMAGE_FILEFORMAT_JPEG, IMAGE_FILEFORMAT_PNG, IMAGE_FILEFORMAT_TGA, INTEL, KEYCODE_0, KEYCODE_1, KEYCODE_2, KEYCODE_3, KEYCODE_4, KEYCODE_5, KEYCODE_6, KEYCODE_7, KEYCODE_8, KEYCODE_9, KEYCODE_A, KEYCODE_B, KEYCODE_C, KEYCODE_D, KEYCODE_DOWN, KEYCODE_E, KEYCODE_ESCAPE, KEYCODE_F, KEYCODE_G, KEYCODE_H, KEYCODE_I, KEYCODE_J, KEYCODE_K, KEYCODE_L, KEYCODE_LEFT, KEYCODE_M, KEYCODE_META, KEYCODE_N, KEYCODE_O, KEYCODE_P, KEYCODE_PAGE_DOWN, KEYCODE_PAGE_UP, KEYCODE_Q, KEYCODE_R, KEYCODE_RIGHT, KEYCODE_S, KEYCODE_SHIFT, KEYCODE_SPACE, KEYCODE_T, KEYCODE_U, KEYCODE_UP, KEYCODE_V, KEYCODE_W, KEYCODE_X, KEYCODE_Y, KEYCODE_Z, LINE_PRIMITIVE_TYPE_LINE_LOOP, LINE_PRIMITIVE_TYPE_LINE_STRIP, LINE_PRIMITIVE_TYPE_LINES, MACOSX, MATERIAL_BLEND_ALPHA, MATERIAL_BLEND_BRIGHTER, MATERIAL_BLEND_CUSTOM, MATERIAL_BLEND_INVERS_MULTIPLY, MATERIAL_BLEND_MULTIPLY, MATERIAL_BLEND_WHITE_INVERT, MATERIAL_NORMAL_NORMALIZE, MATERIAL_NORMAL_RESCALE_NORMALS, MESH_LINE_LOOP, MESH_LINES, MESH_POINTS, MESH_POLYGON, MESH_QUAD_STRIP, MESH_QUADS, MESH_TRIANGLE_FAN, MESH_TRIANGLE_STRIP, MESH_TRIANGLES, MOUSEBUTTON_LEFT, MOUSEBUTTON_MIDDLE, MOUSEBUTTON_RIGHT, MOVIE_DIRECTION_BACKWARDS, MOVIE_DIRECTION_FORWARD, PI, PI_HALF, PICKING_BIN_2D, PICKING_BIN_3D, RED, SHAPE_CUBE_TEXTURE_SAME_FOR_EACH_SIDE, SHAPE_CUBE_TEXTURE_WRAP_AROUND, SHAPE_ORIGIN_BOTTOM_CENTERED, SHAPE_ORIGIN_BOTTOM_LEFT, SHAPE_ORIGIN_BOTTOM_RIGHT, SHAPE_ORIGIN_CENTERED, SHAPE_ORIGIN_CENTERED_LEFT, SHAPE_ORIGIN_CENTERED_RIGHT, SHAPE_ORIGIN_TOP_CENTERED, SHAPE_ORIGIN_TOP_LEFT, SHAPE_ORIGIN_TOP_RIGHT, SHAPE_TRANSFORM_MATRIX, SHAPE_TRANSFORM_MATRIX_AND_ROTATION, SHAPE_TRANSFORM_POSITION_AND_ROTATION, SHAPEBIN_SORT_BY_DISTANCE_TO_CAMERA, SHAPEBIN_SORT_BY_Z_DISTANCE_TO_CAMERAPLANE, SHAPEBIN_SORT_BY_Z_POSITION, SQRT_TWO, TEXTURE_FILTERTYPE_LINEAR, TEXTURE_FILTERTYPE_MIPMAP, TEXTURE_FILTERTYPE_NEAREST, TEXTURE_MEDIA_IMAGE_BGR, TEXTURE_PROPORTION_ARBITRARY, TEXTURE_PROPORTION_POWEROF2, TEXTURE_WRAPMODE_CLAMP, TEXTURE_WRAPMODE_CLAMP_TO_BORDER, TEXTURE_WRAPMODE_REPEAT, TWO_PI, UNDEFINED, USE_DISPLAY_LISTS
 
Constructor Summary
UsingEventHandling()
           
 
Method Summary
 void keyPressed(char theKey, int theKeyCode)
          override this method to receive key events.
 void keyReleased(char theKey, int theKeyCode)
          override this method to receive key events.
 void loop(float theDeltaTime)
          override this method to get a loop.
static void main(java.lang.String[] arg)
           
 void mousePressed(int x, int y, int thePressedMouseButton)
          override this method to receive mouse events.
 void mouseReleased(int x, int y, int thePressedMouseButton)
          override this method to receive mouse events.
 void setup()
          override this method to setup things.
 
Methods inherited from class gestalt.render.AnimatorRenderer
addToRenderLoop, cameramover, finish, fixFramerate, fpscounter, framerate, getCurrentFramerate, getDesiredFramerate, init, init, init, init, loop, quit, renderloop, start, stop, update
 
Methods inherited from class gestalt.render.BasicRenderer
camera, create, dispose, fog, framefinish, framesetup, light, origin, replaceCamera, set3DFinishRef, setBinRef, setCameraRef, setFogRef, setFramefinishRef, setFramesetupRef, setLightRef, setOriginRef, setupDefaultRenderbins, toString
 
Methods inherited from class gestalt.render.MinimalRenderer
bin, bin, createDisplayCapabilities, display, displaycapabilities, drawablefactory, event, setDisplayRef, setDrawablefactoryRef, setEventRef, updateDisplayCapabilities
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UsingEventHandling

public UsingEventHandling()
Method Detail

setup

public void setup()
Description copied from class: AnimatorRenderer
override this method to setup things.

Specified by:
setup in interface Loopable
Overrides:
setup in class AnimatorRenderer

loop

public void loop(float theDeltaTime)
Description copied from class: AnimatorRenderer
override this method to get a loop.
'loop()' is called continously after 'setup()' was called.

Overrides:
loop in class AnimatorRenderer
Parameters:
theDeltaTime - float duration of the last frame in seconds.

mousePressed

public void mousePressed(int x,
                         int y,
                         int thePressedMouseButton)
Description copied from class: BasicRenderer
override this method to receive mouse events.

Specified by:
mousePressed in interface GestaltMouseListener
Overrides:
mousePressed in class BasicRenderer
Parameters:
x - int
y - int
thePressedMouseButton - int

mouseReleased

public void mouseReleased(int x,
                          int y,
                          int thePressedMouseButton)
Description copied from class: BasicRenderer
override this method to receive mouse events.

Specified by:
mouseReleased in interface GestaltMouseListener
Overrides:
mouseReleased in class BasicRenderer
Parameters:
x - int
y - int
thePressedMouseButton - int

keyPressed

public void keyPressed(char theKey,
                       int theKeyCode)
Description copied from class: BasicRenderer
override this method to receive key events.

Specified by:
keyPressed in interface GestaltKeyListener
Overrides:
keyPressed in class BasicRenderer
Parameters:
theKey - char
theKeyCode - int

keyReleased

public void keyReleased(char theKey,
                        int theKeyCode)
Description copied from class: BasicRenderer
override this method to receive key events.

Specified by:
keyReleased in interface GestaltKeyListener
Overrides:
keyReleased in class BasicRenderer
Parameters:
theKey - char
theKeyCode - int

main

public static void main(java.lang.String[] arg)


processing library gestalt_p5 by Patrick Kochlik + Dennis Paul. (c) 2009