|
Gob(HyperView
tView,String tName,int tFlags)
Gob(Gob tGob,String tName,int tX,int tY,int
pX,int pY,Spline tSpline,int tFlags)
Gob(HyperView tView,String tName,int tX,int
tY,int pX,int pY)
Gob(Gob tGob,String tName,int tX,int tY,int
pX,int pY,int tFlags)
Gob(Gob tGob,String tName,int tX,int tY,int
tFlags)
Gob(HyperView tView,String tName,int sx,int
sy,int pX,int pY,int tFlags)
Gob(HyperView tView,String tName,int sx,int
sy,Spline tSpline,int tFlags) |
|
void printGobAttr(HyperView)
This method is for debugging your display. Use
it to
print some if the Gob's current values.
|
void addSpline(Spline)
Add a movement Spline to this Gob (before
adding to display)
|
public
void onClick()
Generic
Mouse IO method.
Note: This is called from the
HyperView.blitterLock Thread monitor
context and is the default
Mouse Event Handler for Gob.class Objects
that do not have a Dispatch.class
attached.
If enabled, the lightweight onClick()
method is called when the Gob.class is clicked
on by the mouse.
To implement this method you must
- "overwrite"
the onClick() method.
- Set the
Gob.gobFlags GOB_DO_ONCLICK bit.
Gob
how to get mouse clicks example
// Note: Gob.class super()
constructor called in this example.
// ie Gob(HyperView,
String,
int,
int, int)
//
View
"ImageName" width, height,flags.
public class MyGob extends Gob
{
MyGob(HyperView tView)
{ //
Call relevant super() constructor.
super(tView,"myImage.gif",100,100,100,100,)
gobFlags |= GOB_DO_ONCLICK;
// Enable Gob onclick bit
}
public void onClick()
{
int x = mouseX;
int y = mouseY;
System.out.println("Click x="+x+" y="+y);
}
}
overwriting onClick() is the simplest mouse
even method in the HyperView.
However it does not erase/change the current
display. The onClick() method
is called between video rendering
frames. It does not have the full
licence to
change the entire display that a Dispatch.class
does. But because it is between
render frames, it can change its own graphics
with no display interference
(jaggies/screen tears basically contention
between display/render hardware.)
The other method of trapping Mouse IO is
to make a Gadget and attach a fully qualified
Dispatch.class Object to it.
HyperView.class has 2
different mouse event handling techniques.
Dispatch.class
Advantage:
-Backs up/restores
entire display.
-Full access to entire display
variables during VBLANK,
- Uses the Display stack to
restore the previous view.
- Fastest event response time.
|
Disadvantage:
- Extra setup
time
- Must use a Gob
Gadget.class
- Saving/restoring
display takes
overhead.
- Gadgets can take more
video RAM than a Gob-
class because they
have am extra display Image
for a selected Image.
|
|
Gob.onClick()
Advantage:
-Simple
overwrite
of onClick() method
- Faster to process with no
display backup or restore.
|
Disadvantage:
Because onClick()
is called by the
View between render frames,
too many of such calls can
slow down video rendering.
|
|
|
Another
example. Creating a Gob from a gif
Here is a 46 pixel width X 47 pixel height
image called "ea2.gif"
Note
that the area around the globe is
transparent. Thus you can
create/modify
images for Gobs
in your favorite paint program.
Note: This is done from "ViewMain.main();
|
|
public
void zENA();
Enable ZBuffer emulation (Z plane
Depth scaling)
|
public void
zOff()
Disable ZBuffer emulation
|
void
gobZInit()
initialize Gob zbuffer
|
public
void initScanline(int tInt)
Convert
this Gob into a series of scanlines. This
was initially for collision detection via a
32 bit OR with a 1
bit bitmask, but instead collision
detection will be implemented with a point
in poly polygon compare which
is computationally much more
efficient.
|
public
void printScanLines()
print
the scanlines to stdout
|
public
void collisionOn()
enable
collision detection.
|
public
void collisionOff()
disable collision detection.
|
public
void remove()
remove
this gob from the HyperView
and flag it for destruction.
|
public
void move(int,int)
Move the Gob to this X/Y location.
|
public
void enable()
Enable
the GOB_ON_DISPLAY bit.
|
public
void disable()
Disable
the GOB_ON_DISPLAY bit.
|
public
boolean inView()
Returns
true if the Gob.x and Gob.y are within the
HyperView width/Height
Otherwise false
|
public
boolean onDisplay()
Returns
true if the Gob.x and Gob.y are within the
HyperView width/Height
and sets/unsets the Gob.gobFlags ->
GOB_ON_DISPLAY bit.
Note: See HyperConstants.class
for all Gob.gobFlags bit definitions.
|
public
Graphics getGraphics()
Returns
a awt.Graphics reference for this gob.
|
public
boolean onClick()
Called
when this Gob is clicked on
and if implemented and "overwritten".
ie: You must overwrite this method to
implement it.
See above for implementation of
onClick()
|
public
void onRelease()
Called
when the mouse button is released. If enabled
in flag bits. To properly use this you must
overwrite
this method and enable the mouse
released bit. See HyperConstants.class
for all bit definitions.
|
public
void addGob(Gob)
Add/Attach a Gob on to
this Gob. This is how you make more
complicated displays by adding Gobs to
other Gobs. The "attached" Gobs are
always thereafter rendered on top of the Gob
they are
attached to.
Note: The HyperView CLI command
"dumpgobs" dumps most Gob.class info including
all attachments.
|
public
void center()
Center
this Gob either in the View or in the parent
Gob if attached to another Gob.
|
public
Image getImageFromJar(String)
Gets
an Image from the jar file the parent
HyperView.class is running from.
Note:This will only work when
called from a Browser that is running the
HyperView from a jar.
The View does this inherently so there
is no real user implementation of this method.
|
public int[] getPixels()
Return an array of
(width * height) integers that represents the
RGB/Alpha values for the Gob.gobImage
|
public void cleanUp()
Dispose of all Graphics
memory for this Gob.
|
|