Class TestbedTest

    • Field Detail

      • log

        private static final org.slf4j.Logger log
      • m_world

        protected World m_world
        Only visible for compatibility. Should use getWorld() instead.
      • groundBody

        protected Body groundBody
      • bomb

        private Body bomb
      • bombSpawnPoint

        private final Vec2 bombSpawnPoint
      • bombSpawning

        private boolean bombSpawning
      • mouseWorld

        private final Vec2 mouseWorld
      • pointCount

        private int pointCount
      • stepCount

        private int stepCount
      • inputQueue

        private final java.util.LinkedList<QueueItem> inputQueue
      • title

        private java.lang.String title
      • m_textLine

        protected int m_textLine
      • textList

        private final java.util.LinkedList<java.lang.String> textList
      • cachedCameraScale

        private float cachedCameraScale
      • cachedCameraPos

        private final Vec2 cachedCameraPos
      • hasCachedCamera

        private boolean hasCachedCamera
      • dialogOnSaveLoadErrors

        private boolean dialogOnSaveLoadErrors
      • savePending

        private boolean savePending
      • loadPending

        private boolean loadPending
      • resetPending

        private boolean resetPending
      • color1

        private final Color3f color1
      • color2

        private final Color3f color2
      • color3

        private final Color3f color3
      • color4

        private final Color3f color4
      • color5

        private final Color3f color5
      • mouseColor

        private final Color3f mouseColor
      • p1

        private final Vec2 p1
      • p2

        private final Vec2 p2
      • tangent

        private final Vec2 tangent
      • statsList

        private final java.util.List<java.lang.String> statsList
      • queryAABB

        private final AABB queryAABB
      • p

        private final Vec2 p
      • v

        private final Vec2 v
      • aabb

        private final AABB aabb
      • vel

        private final Vec2 vel
    • Constructor Detail

      • TestbedTest

        public TestbedTest()
    • Method Detail

      • init

        public void init​(World argWorld,
                         boolean argDeserialized)
      • getWorld

        public World getWorld()
        Gets the current world
        Returns:
      • getModel

        public TestbedModel getModel()
        Gets the testbed model
        Returns:
      • getContactPoints

        public static ContactPoint[] getContactPoints()
        Gets the contact points for the current test
        Returns:
      • getGroundBody

        public Body getGroundBody()
        Gets the ground body of the world, used for some joints
        Returns:
      • getDebugDraw

        public DebugDraw getDebugDraw()
        Gets the debug draw for the testbed
        Returns:
      • getWorldMouse

        public Vec2 getWorldMouse()
        Gets the world position of the mouse
        Returns:
      • getStepCount

        public int getStepCount()
      • getPointCount

        public int getPointCount()
        The number of contact points we're storing
        Returns:
      • getBomb

        public Body getBomb()
        Gets the 'bomb' body if it's present
        Returns:
      • getCachedCameraScale

        public float getCachedCameraScale()
      • setCachedCameraScale

        public void setCachedCameraScale​(float cachedCameraScale)
      • getCachedCameraPos

        public Vec2 getCachedCameraPos()
      • setCachedCameraPos

        public void setCachedCameraPos​(Vec2 argPos)
      • isHasCachedCamera

        public boolean isHasCachedCamera()
      • setHasCachedCamera

        public void setHasCachedCamera​(boolean hasCachedCamera)
      • isDialogOnSaveLoadErrors

        public boolean isDialogOnSaveLoadErrors()
      • setDialogOnSaveLoadErrors

        public void setDialogOnSaveLoadErrors​(boolean dialogOnSaveLoadErrors)
      • getDefaultCameraPos

        public Vec2 getDefaultCameraPos()
        Override for a different default camera pos
        Returns:
      • getDefaultCameraScale

        public float getDefaultCameraScale()
        Override for a different default camera scale
        Returns:
      • getFilename

        public java.lang.String getFilename()
        Gets the filename of the current test. Default implementation uses the test name with no spaces".
        Returns:
      • reset

        public void reset()
        Resets the test
      • save

        public void save()
        Saves the test
      • load

        public void load()
        Loads the test from file
      • _reset

        protected void _reset()
      • _save

        protected void _save()
      • _load

        protected void _load()
      • setCamera

        public void setCamera​(Vec2 argPos)
      • setCamera

        public void setCamera​(Vec2 argPos,
                              float scale)
        Sets the current testbed camera
        Parameters:
        argPos -
        scale -
      • initTest

        public abstract void initTest​(boolean deserialized)
        Initializes the current test
        Parameters:
        argDeserialized - if the test was deserialized from a file. If so, all physics objects were already added.
      • getTestName

        public abstract java.lang.String getTestName()
        The name of the test
        Returns:
      • exit

        public void exit()
        called when the tests exits
      • update

        public void update()
      • queueShiftMouseDown

        public void queueShiftMouseDown​(Vec2 p)
      • queueMouseUp

        public void queueMouseUp​(Vec2 p)
      • queueMouseDown

        public void queueMouseDown​(Vec2 p)
      • queueMouseMove

        public void queueMouseMove​(Vec2 p)
      • queueKeyPressed

        public void queueKeyPressed​(char c,
                                    int code)
      • queueKeyReleased

        public void queueKeyReleased​(char c,
                                     int code)
      • shiftMouseDown

        public void shiftMouseDown​(Vec2 p)
        Called when shift-mouse down occurs
        Parameters:
        p -
      • mouseUp

        public void mouseUp​(Vec2 p)
        Called for mouse-up
        Parameters:
        p -
      • mouseDown

        public void mouseDown​(Vec2 p)
        Called for mouse-down
        Parameters:
        p -
      • mouseMove

        public void mouseMove​(Vec2 p)
        Called when mouse is moved
        Parameters:
        p -
      • setTitle

        public void setTitle​(java.lang.String argTitle)
        Sets the title of the test
        Parameters:
        argTitle -
      • addTextLine

        public void addTextLine​(java.lang.String argTextLine)
        Adds a text line to the reporting area
        Parameters:
        argTextLine -
      • lanchBomb

        public void lanchBomb()
      • launchBomb

        public void launchBomb​(Vec2 position,
                               Vec2 velocity)
      • spawnBomb

        public void spawnBomb​(Vec2 worldPt)
      • completeBombSpawn

        public void completeBombSpawn​(Vec2 p)
      • isUnsupported

        public boolean isUnsupported​(UnsupportedObjectException exception)
        Description copied from interface: UnsupportedListener
        Called when an object is unsupported by the de/serializer.
        Specified by:
        isUnsupported in interface UnsupportedListener
        Parameters:
        exception - the exception describing the error
        Returns:
        if the process should stop and the exception be thrown
      • jointDestroyed

        public void jointDestroyed​(Joint joint)
      • postSolve

        public void postSolve​(Contact contact,
                              ContactImpulse impulse)
        Description copied from interface: ContactListener
        This lets you inspect a contact after the solver is finished. This is useful for inspecting impulses. Note: the contact manifold does not include time of impact impulses, which can be arbitrarily large if the sub-step is small. Hence the impulse is provided explicitly in a separate data structure. Note: this is only called for contacts that are touching, solid, and awake.
        Specified by:
        postSolve in interface ContactListener
        impulse - this is usually a pooled variable, so it will be modified after this call
      • preSolve

        public void preSolve​(Contact contact,
                             Manifold oldManifold)
        Description copied from interface: ContactListener
        This is called after a contact is updated. This allows you to inspect a contact before it goes to the solver. If you are careful, you can modify the contact manifold (e.g. disable contact). A copy of the old manifold is provided so that you can detect changes. Note: this is called only for awake bodies. Note: this is called even when the number of contact points is zero. Note: this is not called for sensors. Note: if you set the number of contact points to zero, you will not get an EndContact callback. However, you may get a BeginContact callback the next step. Note: the oldManifold parameter is pooled, so it will be the same object for every callback for each thread.
        Specified by:
        preSolve in interface ContactListener
      • keyPressed

        public void keyPressed​(char keyCar,
                               int keyCode)
      • keyReleased

        public void keyReleased​(char keyChar,
                                int keyCode)