Gridarta Editor
net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R > Class Template Referenceabstract

Default implementation for GameObject implementing classes. More...

+ Inheritance diagram for net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:
+ Collaboration diagram for net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:

Public Member Functions

clone ()
 
void facesReloaded ()
 
Icon getDoubleImage ()
 Returns a double variant of the face for this GameObject. More...
 
Icon getStretchedImage (final long stretchFactor)
 Returns a stretched variant of the face for this floor-type GameObject. More...
 
final long getStretchFactor ()
 Acquire stretch factor of the object. More...
 
Icon getTransparentDoubleImage ()
 Returns a transparent variant of the face for this GameObject. More...
 
Icon getTransparentImage ()
 Returns a transparent variant of the face for this GameObject. More...
 
final int getYOffset ()
 Acquire Y offset of the object for rendering purposes. More...
 
abstract boolean isDrawDouble (boolean drawDoubleFaces)
 Returns whether to draw this game object with double height. More...
 
boolean isEqual (@NotNull final BaseObject<?, ?, ?, ?> gameObject)
 
abstract boolean isStretched (boolean tileStretching)
 Returns whether to draw this game object with stretching transformation. More...
 
final void refreshStretchFactor ()
 Invalidates stretch factor value calculated by getStretchFactor() and clears the stored stretched face. More...
 
void setObjectFace ()
 
boolean usesDirection ()
 
- Public Member Functions inherited from net.sf.gridarta.model.gameobject.AbstractGameObject< G, A, R >
asGameObject ()
 
clone ()
 
getArchetype ()
 
String getAttributeString ( @NotNull final String attributeName, final boolean queryArchetype)
 
GameObjectContainer< G, A, R > getContainer ()
 
getContainerGameObject ()
 
MapSquare< G, A, R > getMapSquare ()
 
getNext ()
 
getPrev ()
 
getTopContainer ()
 
boolean hasUndefinedArchetype ()
 
void insertAfter ( @NotNull final G node)
 
void insertBefore ( @NotNull final G node)
 
boolean isBottom ()
 
boolean isInContainer ()
 
boolean isTop ()
 
void markModified ()
 
void moveBottom ()
 
void moveDown ()
 
void moveTop ()
 
void moveUp ()
 
newInstance ( @NotNull final GameObjectFactory< G, A, R > gameObjectFactory)
 
void notifyBeginChange ()
 
void notifyEndChange ()
 
void notifyTransientChange ()
 
void remove ()
 
void setArchetype ( @NotNull final R archetype)
 
void setContainer ( @Nullable final GameObjectContainer< G, A, R > container, final int mapX, final int mapY)
 
void visit ( @NotNull final BaseObjectVisitor< G, A, R > baseObjectVisitor)
 

Static Public Attributes

static final String ALIGN = "align"
 The name of the "align" attribute. More...
 
static final String ALPHA = "alpha"
 The name of the "alpha" attribute. More...
 
static final String DRAW_DOUBLE = "draw_double"
 The name of the "draw_double" attribute. More...
 
static final String DRAW_DOUBLE_ALWAYS = "draw_double_always"
 The name of the "draw_double_always" attribute. More...
 
static final String GLOW_RADIUS = "glow_radius"
 The name of the "glow_radius" attribute. More...
 
static final String LAYER = "layer"
 The name of the "layer" attribute. More...
 
static final int MAX_SUB_LAYERS = 7
 
static final String ROTATE = "rotate"
 The name of the "rotate" attribute. More...
 
static final String SUB_LAYER = "sub_layer"
 The name of the "sub_layer" attribute. More...
 
static final String SYS_OBJECT = "sys_object"
 The name of the "sys_object" attribute. More...
 
static final String Z = "z"
 The name of the "z" attribute. More...
 
static final String ZOOM = "zoom"
 The name of the "zoom" attribute. More...
 

Protected Member Functions

 DefaultIsoGameObject (@NotNull final R archetype, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects)
 Creates a new instance. More...
 
- Protected Member Functions inherited from net.sf.gridarta.model.gameobject.AbstractGameObject< G, A, R >
 AbstractGameObject ( @NotNull final R archetype, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects)
 Creates a new instance. More...
 
String getEffectiveFaceName ( @NotNull final String faceName)
 

Private Member Functions

int getYFloorOffset (final int dx, final int dy)
 Acquire Y offset at the specified coordinates, relative to the game object's coordinates and its sub-layer. More...
 

Private Attributes

ImageIcon doubleFace
 The double face. More...
 
final transient FaceObjectProviders faceObjectProviders
 The FaceObjectProviders for looking up faces. More...
 
final Point point = new Point()
 Cached point to avoid unnecessary allocations. More...
 
ImageIcon stretchedFace
 The stretched floor face. More...
 
long stretchFactor
 Calculated stretch factor. More...
 
boolean stretchFactorIsValid
 If true, the stored stretchFactor is valid and can be used in getStretchFactor() instead of calculating a new one. More...
 
ImageIcon transDoubleFace
 The transparent double face. More...
 
ImageIcon transFace
 The transparent face. More...
 

Static Private Attributes

static final int MAX_STRETCH = 8
 
static final int MAX_STRETCH_DIAGONAL = 12
 
static final long serialVersionUID = 1L
 The serial version UID. More...
 

Detailed Description

Default implementation for GameObject implementing classes.

Author
Andreas Kirschbaum

Definition at line 38 of file DefaultIsoGameObject.java.

Constructor & Destructor Documentation

◆ DefaultIsoGameObject()

net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.DefaultIsoGameObject ( @NotNull final R  archetype,
@NotNull final FaceObjectProviders  faceObjectProviders,
@NotNull final AnimationObjects  animationObjects 
)
protected

Creates a new instance.

Parameters
archetypethe base archetype
faceObjectProvidersthe face object providers for looking up faces
animationObjectsthe animation objects for looking up animations

Definition at line 175 of file DefaultIsoGameObject.java.

Member Function Documentation

◆ clone()

G net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.clone ( )

◆ facesReloaded()

void net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.facesReloaded ( )

Definition at line 444 of file DefaultIsoGameObject.java.

◆ getDoubleImage()

Icon net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getDoubleImage ( )

Returns a double variant of the face for this GameObject.

Returns
the double face for this game object

Definition at line 211 of file DefaultIsoGameObject.java.

◆ getStretchedImage()

Icon net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getStretchedImage ( final long  stretchFactor)

Returns a stretched variant of the face for this floor-type GameObject.

Returns
the stretched face for this game object

Definition at line 404 of file DefaultIsoGameObject.java.

◆ getStretchFactor()

final long net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getStretchFactor ( )

Acquire stretch factor of the object.

As the calculation is costly, the value will be stored until the next call to refreshStretchFactor()

Returns
the stretch factor

Definition at line 282 of file DefaultIsoGameObject.java.

◆ getTransparentDoubleImage()

Icon net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getTransparentDoubleImage ( )

Returns a transparent variant of the face for this GameObject.

Returns
the transparent face for this game object

Definition at line 223 of file DefaultIsoGameObject.java.

◆ getTransparentImage()

Icon net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getTransparentImage ( )

Returns a transparent variant of the face for this GameObject.

Returns
the transparent face for this game object

Definition at line 199 of file DefaultIsoGameObject.java.

◆ getYFloorOffset()

int net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getYFloorOffset ( final int  dx,
final int  dy 
)
private

Acquire Y offset at the specified coordinates, relative to the game object's coordinates and its sub-layer.

Parameters
dxrelative X coordinate
dyrelative Y coordinate
Returns
Y offset

Definition at line 245 of file DefaultIsoGameObject.java.

Referenced by net.sf.gridarta.model.gameobject.DefaultIsoGameObject< TestGameObject, TestMapArchObject, TestArchetype >.getStretchFactor().

+ Here is the caller graph for this function:

◆ getYOffset()

final int net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getYOffset ( )

Acquire Y offset of the object for rendering purposes.

Returns
the y offset.

Definition at line 234 of file DefaultIsoGameObject.java.

◆ isDrawDouble()

abstract boolean net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isDrawDouble ( boolean  drawDoubleFaces)
abstract

Returns whether to draw this game object with double height.

Parameters
drawDoubleFaceswhether the "draw double faces" map view setting is enabled
Returns
whether to draw this game object with double height

Referenced by net.sf.gridarta.model.gameobject.DefaultIsoGameObject< TestGameObject, TestMapArchObject, TestArchetype >.getStretchedImage().

+ Here is the caller graph for this function:

◆ isEqual()

boolean net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isEqual ( @NotNull final BaseObject<?, ?, ?, ?>  gameObject)

Definition at line 437 of file DefaultIsoGameObject.java.

◆ isStretched()

abstract boolean net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isStretched ( boolean  tileStretching)
abstract

Returns whether to draw this game object with stretching transformation.

Parameters
tileStretchingwhether the "tile-stretching" map view setting is enabled
Returns
whether to draw this game object with stretching transformation

Referenced by net.sf.gridarta.model.gameobject.DefaultIsoGameObject< TestGameObject, TestMapArchObject, TestArchetype >.getStretchedImage().

+ Here is the caller graph for this function:

◆ refreshStretchFactor()

final void net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.refreshStretchFactor ( )

Invalidates stretch factor value calculated by getStretchFactor() and clears the stored stretched face.

Definition at line 271 of file DefaultIsoGameObject.java.

◆ setObjectFace()

void net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setObjectFace ( )

Definition at line 186 of file DefaultIsoGameObject.java.

◆ usesDirection()

boolean net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.usesDirection ( )

Definition at line 181 of file DefaultIsoGameObject.java.

Member Data Documentation

◆ ALIGN

◆ ALPHA

final String net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.ALPHA = "alpha"
static

The name of the "alpha" attribute.

Definition at line 103 of file DefaultIsoGameObject.java.

Referenced by net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer< G, A, R >.paintGameObject().

◆ doubleFace

◆ DRAW_DOUBLE

final String net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.DRAW_DOUBLE = "draw_double"
static

The name of the "draw_double" attribute.

Definition at line 85 of file DefaultIsoGameObject.java.

Referenced by net.sf.gridarta.var.atrinik.model.gameobject.GameObject.isDrawDouble().

◆ DRAW_DOUBLE_ALWAYS

final String net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.DRAW_DOUBLE_ALWAYS = "draw_double_always"
static

The name of the "draw_double_always" attribute.

Definition at line 79 of file DefaultIsoGameObject.java.

Referenced by net.sf.gridarta.var.atrinik.model.gameobject.GameObject.isDrawDouble().

◆ faceObjectProviders

◆ GLOW_RADIUS

final String net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.GLOW_RADIUS = "glow_radius"
static

◆ LAYER

final String net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.LAYER = "layer"
static

The name of the "layer" attribute.

Definition at line 61 of file DefaultIsoGameObject.java.

Referenced by net.sf.gridarta.var.atrinik.model.gameobject.GameObject.applyMassChange(), net.sf.gridarta.model.validation.errors.SysObjectNotOnLayerZeroError< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.correct(), net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer< G, A, R >.getSquareLocationAt(), net.sf.gridarta.var.atrinik.model.gameobject.GameObject.isStretched(), net.sf.gridarta.gui.map.renderer.IsoPickmapRenderer< G extends DefaultIsoGameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.paintSquare(), net.sf.gridarta.gui.map.renderer.IsoMapRenderer< TestGameObject, TestMapArchObject, TestArchetype >.paintSquare(), net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer< G, A, R >.resizeFromModel(), net.sf.gridarta.var.atrinik.gui.map.renderer.MapRendererTest.testPaintCombined1(), net.sf.gridarta.var.atrinik.gui.map.renderer.MapRendererTest.testPaintZ1(), net.sf.gridarta.var.atrinik.gui.map.renderer.MapRendererTest.testPaintZ2(), net.sf.gridarta.gui.map.renderer.AbstractIsoMapRenderer< G, A, R >.tileStretchingOffsets(), net.sf.gridarta.model.validation.checks.SysObjectNotOnLayerZeroChecker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.validateGameObject(), and net.sf.gridarta.model.validation.checks.DoubleLayerChecker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.validateSquare().

◆ MAX_STRETCH

◆ MAX_STRETCH_DIAGONAL

◆ MAX_SUB_LAYERS

final int net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.MAX_SUB_LAYERS = 7
static

◆ point

final Point net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.point = new Point()
private

Cached point to avoid unnecessary allocations.

Definition at line 155 of file DefaultIsoGameObject.java.

◆ ROTATE

final String net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.ROTATE = "rotate"
static

◆ serialVersionUID

final long net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.serialVersionUID = 1L
staticprivate

The serial version UID.

Definition at line 43 of file DefaultIsoGameObject.java.

◆ stretchedFace

◆ stretchFactor

long net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.stretchFactor
private

◆ stretchFactorIsValid

boolean net.sf.gridarta.model.gameobject.DefaultIsoGameObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.stretchFactorIsValid
private

If true, the stored stretchFactor is valid and can be used in getStretchFactor() instead of calculating a new one.

Definition at line 161 of file DefaultIsoGameObject.java.

◆ SUB_LAYER

◆ SYS_OBJECT

◆ transDoubleFace

◆ transFace

◆ Z

◆ ZOOM


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