// Path: workspace/Angr/src/fi/hbp/angr/G.java
// public class G {
//     /**
//      * Debug mode
//      *
//      * If this is set to true game will output some additional data and
//      * enables debug camera functionality. Debug camera is enabled by
//      * pressing d while in the game stage.
//      */
//     public static final boolean DEBUG = false;
// 
//     /**
//      * Global static assets manager
//      *
//      * @note As there is no universal support for threaded  access to the
//      * OpenGL context from multiple threads and as its exclusively prohibited
//      * in gdx a global asset manager is needed. This asset manager makes it
//      * easier to load new assets asynchronously without blocking rendering.
//      */
//     private static AssetManager assetManager = new AssetManager();
// 
//     /**
//      * Conversion from Box2D to the sprite relative/pixel coordinates
//      */
//     public static final float BOX_TO_WORLD = 100.0f;
// 
//     /**
//      * Conversion from sprite relative/pixel coordinates to Box2D coordinates
//      */
//     public static final float WORLD_TO_BOX = 1.0f / BOX_TO_WORLD;
// 
//     /**
//      * Get global static assets manager
//      * @return Global asset manager.
//      */
//     public static AssetManager getAssetManager() {
//         return assetManager;
//     }
// 
//     /**
//      * Game scoreboard
//      */
//     public static Scoreboard scoreboard = null;
// 
//     /**
//      * Game pause button
//      */
//     public static int pauseButton = Keys.P;
//     public static int pauseButton1 = Keys.BACK;
// }


import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.QueryCallback;
import com.badlogic.gdx.physics.box2d.World;
import com.badlogic.gdx.physics.box2d.joints.MouseJoint;
import com.badlogic.gdx.physics.box2d.joints.MouseJointDef;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import fi.hbp.angr.G;
         * to which we can connect the mouse joint */
        BodyDef bodyDef = new BodyDef();
        groundBody = world.createBody(bodyDef);
    }

    QueryCallback callback = new QueryCallback() {
        @Override
        public boolean reportFixture (Fixture fixture) {
            /* If the hit point is inside the fixture of the body
            /* we report it
             */
            Vector2 v = fixture.getBody().getPosition();
            if (fixture.testPoint(testPoint.x, testPoint.y) ||
                    v.dst(testPoint.x, testPoint.y) < touchDst) {
                hitBody = fixture.getBody();
                if (hitBody.equals(body)) {
                    return false;
                }
            }
            return true; /* Keep going until all bodies in the area are checked. */
        }
    };

    @Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        if (slingshotEnabled == false)
            return false;

        /* Translate the mouse coordinates to world coordinates */
        stage.getCamera().unproject(testPoint.set(screenX, screenY, 0));
// Path: workspace/Angr/src/fi/hbp/angr/G.java
// public class G {
//     /**
//      * Debug mode
//      *
//      * If this is set to true game will output some additional data and
//      * enables debug camera functionality. Debug camera is enabled by
//      * pressing d while in the game stage.
//      */
//     public static final boolean DEBUG = false;
// 
//     /**
//      * Global static assets manager
//      *
//      * @note As there is no universal support for threaded  access to the
//      * OpenGL context from multiple threads and as its exclusively prohibited
//      * in gdx a global asset manager is needed. This asset manager makes it
//      * easier to load new assets asynchronously without blocking rendering.
//      */
//     private static AssetManager assetManager = new AssetManager();
// 
//     /**
//      * Conversion from Box2D to the sprite relative/pixel coordinates
//      */
//     public static final float BOX_TO_WORLD = 100.0f;
// 
//     /**
//      * Conversion from sprite relative/pixel coordinates to Box2D coordinates
//      */
//     public static final float WORLD_TO_BOX = 1.0f / BOX_TO_WORLD;
// 
//     /**
//      * Get global static assets manager
//      * @return Global asset manager.
//      */
//     public static AssetManager getAssetManager() {
//         return assetManager;
//     }
// 
//     /**
//      * Game scoreboard
//      */
//     public static Scoreboard scoreboard = null;
// 
//     /**
//      * Game pause button
//      */
//     public static int pauseButton = Keys.P;
//     public static int pauseButton1 = Keys.BACK;
// }


// Path: workspace/Angr/src/fi/hbp/angr/models/SlingshotActor.java
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.QueryCallback;
import com.badlogic.gdx.physics.box2d.World;
import com.badlogic.gdx.physics.box2d.joints.MouseJoint;
import com.badlogic.gdx.physics.box2d.joints.MouseJointDef;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import fi.hbp.angr.G;

         * to which we can connect the mouse joint */
        BodyDef bodyDef = new BodyDef();
        groundBody = world.createBody(bodyDef);
    }

    QueryCallback callback = new QueryCallback() {
        @Override
        public boolean reportFixture (Fixture fixture) {
            /* If the hit point is inside the fixture of the body
            /* we report it
             */
            Vector2 v = fixture.getBody().getPosition();
            if (fixture.testPoint(testPoint.x, testPoint.y) ||
                    v.dst(testPoint.x, testPoint.y) < touchDst) {
                hitBody = fixture.getBody();
                if (hitBody.equals(body)) {
                    return false;
                }
            }
            return true; /* Keep going until all bodies in the area are checked. */
        }
    };

    @Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        if (slingshotEnabled == false)
            return false;

        /* Translate the mouse coordinates to world coordinates */
        stage.getCamera().unproject(testPoint.set(screenX, screenY, 0));
        testPoint.x *= G.WORLD_TO_BOX;