hAPI Fisica  0.1
The hAPI Fisica physics engine expands Richard Marxer's fisica for Processing. The engine wraps the jbox2d physics engine for use with the Haply Development kit and the Hapkit.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
FDrawable Class Referenceabstract
Inheritance diagram for FDrawable:
FBody FJoint FBlob FBox FCircle FCompound FLine FPoly HTool FConstantVolumeJoint FDistanceJoint FGearJoint FMouseJoint FPrismaticJoint FRevoluteJoint

Public Member Functions

void draw (PGraphics graphics)
 
void draw (PApplet applet)
 
void drawDebug (PGraphics graphics)
 
void drawDebug (PApplet applet)
 
void attachImage (PImage img)
 
void dettachImage ()
 
float getImageAlpha ()
 
void setImageAlpha (float alpha)
 
void setDrawable (boolean drawable)
 
boolean isDrawable ()
 
int getFillColor ()
 
void setFillColor (int col)
 
void setNoFill ()
 
void setFill (float g)
 
void setFill (float g, float a)
 
void setFill (float r, float g, float b)
 
void setFill (float r, float g, float b, float a)
 
void setStrokeColor (int col)
 
void setNoStroke ()
 
void setStroke (float g)
 
void setStroke (float g, float a)
 
void setStroke (float r, float g, float b)
 
void setStroke (float r, float g, float b, float a)
 
void setStrokeWeight (float weight)
 

Protected Member Functions

void updateStyle (FDrawable other)
 
void appletStroke (PGraphics applet, int argb)
 
void appletFill (PGraphics applet, int argb)
 
void appletFillStroke (PGraphics applet)
 
void drawImage (PGraphics applet)
 

Protected Attributes

boolean m_drawable = true
 
boolean m_fill = true
 
int m_fillColor = 0xFFFFFFFF
 
boolean m_stroke = true
 
int m_strokeColor = 0xFF000000
 
float m_strokeWeight = 1.0f
 
PImage m_image = null
 
float m_imageAlpha = 255.0f
 
PImage m_mask = null
 

Detailed Description

This is a class from which all drawable objects of a world inherit.

It contains most helping methods that handles stroke and fill colors and styles, as well as image attachments, etc.

Member Function Documentation

◆ attachImage()

void FDrawable.attachImage ( PImage  img)

Attach an image to the object. This method allows to draw an image onto the screen instead of calling the draw(PApplet) method.

Parameters
imgthe PImage to attach to the object.

◆ dettachImage()

void FDrawable.dettachImage ( )

Dettach any image that has been attached to the object.

See also
attachImage(PImage)

◆ draw() [1/2]

void FDrawable.draw ( PGraphics  graphics)

This method is called when calling

world.draw()

. This method may be overriden to allow custom drawing of the object.

Parameters
graphicsthe graphics onto which the object must be drawn.

◆ draw() [2/2]

void FDrawable.draw ( PApplet  applet)

This method is called when calling

world.draw()

. This method may be overriden to allow custom drawing of the object.

Parameters
appletthe applet onto which the object must be drawn.

◆ drawDebug() [1/2]

void FDrawable.drawDebug ( PGraphics  graphics)

This method is called when calling

world.drawDebug()

. This method may be overriden to allow custom debug drawing of the object.

Parameters
graphicsthe graphics onto which the object must be drawn.

◆ drawDebug() [2/2]

void FDrawable.drawDebug ( PApplet  applet)

This method is called when calling

world.drawDebug()

. This method may be overriden to allow custom debug drawing of the object.

Parameters
appletthe applet onto which the object must be drawn.

◆ getFillColor()

int FDrawable.getFillColor ( )

Returns the fill color of the object.

Returns
a Processing color type. e.g.
myBody.setFillColor(color(20,100,30,90));
See also
setNoFill()
setFill(float)
setFill(float,float)
setFill(float,float,float)
setFill(float,float,float,float)

◆ getImageAlpha()

float FDrawable.getImageAlpha ( )

Get the opacity with which to draw the attached image.

Returns
the opacity, a value from 0.0 to 1.0 with which to draw the attached image
See also
attachImage(PImage)
setImageAlpha(float)

◆ isDrawable()

boolean FDrawable.isDrawable ( )

Get whether the object must be drawn or not.

Returns
drawable if
true
the object will be drawn, else it will not
See also
setDrawable(boolean)

◆ setDrawable()

void FDrawable.setDrawable ( boolean  drawable)

Set whether the object must be drawn or not.

Parameters
drawableif
true
the object will be drawn, else it will not
See also
isDrawable()

◆ setFill() [1/4]

void FDrawable.setFill ( float  g)

Set the fill color of the object.

Parameters
ggray value
See also
setFill(float)
setFill(float,float)
setFill(float,float,float)
setFill(float,float,float,float)

◆ setFill() [2/4]

void FDrawable.setFill ( float  g,
float  a 
)

Set the fill color of the object.

Parameters
ggray value
aalpha (opacity) value
See also
setFill(float)
setFill(float,float)
setFill(float,float,float)
setFill(float,float,float,float)

◆ setFill() [3/4]

void FDrawable.setFill ( float  r,
float  g,
float  b 
)

Set the fill color of the object.

Parameters
rred value
ggreen value
bblue value
See also
setFill(float)
setFill(float,float)
setFill(float,float,float)
setFill(float,float,float,float)

◆ setFill() [4/4]

void FDrawable.setFill ( float  r,
float  g,
float  b,
float  a 
)

Set the fill color of the object.

Parameters
rred value
ggreen value
bblue value
aalpha (opacity) value
See also
setFill(float)
setFill(float,float)
setFill(float,float,float)
setFill(float,float,float,float)

◆ setFillColor()

void FDrawable.setFillColor ( int  col)

Set the fill color of the object. This method must be used in conjunction with Processing's color(). In most cases users will find it more convenient to use the versions of setFill(float), setFill(float,float), setFill(float,float,float) or setFill(float,float,float,float)

Parameters
cola Processing color type. e.g.
myBody.setFillColor(color(20,100,30,90));
See also
setNoFill()
setFill(float)
setFill(float,float)
setFill(float,float,float)
setFill(float,float,float,float)

◆ setImageAlpha()

void FDrawable.setImageAlpha ( float  alpha)

Set the opacity with which to draw the attached image.

Parameters
alphathe opacity, a value from 0.0 to 1.0 with which to draw the attached image
See also
attachImage(PImage)
getImageAlpha()

◆ setNoFill()

void FDrawable.setNoFill ( )

◆ setNoStroke()

void FDrawable.setNoStroke ( )

◆ setStroke() [1/4]

void FDrawable.setStroke ( float  g)

Set the stroke color of the object.

Parameters
ggray value
See also
setStroke(float)
setStroke(float,float)
setStroke(float,float,float)
setStroke(float,float,float,float)

◆ setStroke() [2/4]

void FDrawable.setStroke ( float  g,
float  a 
)

Set the stroke color of the object.

Parameters
ggray value
aalpha (opacity) value
See also
setStroke(float)
setStroke(float,float)
setStroke(float,float,float)
setStroke(float,float,float,float)

◆ setStroke() [3/4]

void FDrawable.setStroke ( float  r,
float  g,
float  b 
)

Set the stroke color of the object.

Parameters
rred value
ggreen value
bblue value
See also
setStroke(float)
setStroke(float,float)
setStroke(float,float,float)
setStroke(float,float,float,float)

◆ setStroke() [4/4]

void FDrawable.setStroke ( float  r,
float  g,
float  b,
float  a 
)

Set the stroke color of the object.

Parameters
rred value
ggreen value
bblue value
aalpha (opacity) value
See also
setStroke(float)
setStroke(float,float)
setStroke(float,float,float)
setStroke(float,float,float,float)

◆ setStrokeColor()

void FDrawable.setStrokeColor ( int  col)

Set the stroke color of the object. This method must be used in conjunction with Processing's color(). In most cases users will find it more convenient to use the versions of setStroke(float), setStroke(float,float), setStroke(float,float,float) or setStroke(float,float,float,float)

Parameters
cola Processing color type. e.g.
myBody.setStrokeColor(color(20,100,30,90));
See also
setNoStroke()
setStroke(float)
setStroke(float,float)
setStroke(float,float,float)
setStroke(float,float,float,float)

◆ setStrokeWeight()

void FDrawable.setStrokeWeight ( float  weight)

Set the stroke weight of the object.

Parameters
weightweight value in simulation world units
See also
setStroke(float)
setStroke(float,float)
setStroke(float,float,float)
setStroke(float,float,float,float)

The documentation for this class was generated from the following file: