List of usage examples for com.badlogic.gdx.math Vector2 Vector2
public Vector2()
From source file:com.axatrikx.solor.domain.Player.java
License:Apache License
public Player(LevelScreen screen, Vector2 bounds) { super(screen, Shape.CIRCLE, Color.GREEN, bounds, ObjectType.PLAYER); state = PlayerState.MOVING;//from w w w. j av a2s. co m velocity = new Vector2(); }
From source file:com.badlogic.gdx.ai.tests.steer.box2d.Box2dLocation.java
License:Apache License
public Box2dLocation() { this.position = new Vector2(); this.orientation = 0; }
From source file:com.badlogic.gdx.ai.tests.steer.scene2d.Scene2dLocation.java
License:Apache License
public Scene2dLocation() { this.position = new Vector2(); this.orientation = 0; }
From source file:com.badlydrawngames.veryangryrobots.mobiles.Robot.java
License:Apache License
public Robot() { width = Assets.robotWidth;//from w ww.ja va2 s .com height = Assets.robotHeight; distance = max(width, height); fudge = distance * 0.25f; setState(INACTIVE); firingDirection = new Vector2(); robotPos = new Vector2(); playerPos = new Vector2(); lineStart = new Vector2(); lineEnd = new Vector2(); }
From source file:com.badlydrawngames.veryangryrobots.World.java
License:Apache License
/** Constructs a new {@link World}. */ public World(DifficultyManager difficultyManager) { this.difficultyManager = difficultyManager; notifier = new WorldNotifier(); minX = 0;/* ww w . j a va 2 s . c om*/ maxX = WALL_WIDTH * HCELLS; minY = 0; maxY = WALL_WIDTH * VCELLS; roomBounds = new Rectangle(minX, minY, maxX - minX, maxY - minY); player = new Player(); captain = new Captain(); playerPos = new Vector2(); roomBuilder = new RoomBuilder(HCELLS, VCELLS); roomGrid = new Grid(HCELLS * 2, VCELLS * 2, maxX, maxY); shotPool = new Pool<PlayerShot>(MAX_PLAYER_SHOTS, MAX_PLAYER_SHOTS) { @Override protected PlayerShot newObject() { return new PlayerShot(); } }; robotPool = new Pool<Robot>(MAX_ROBOTS, MAX_ROBOTS) { @Override protected Robot newObject() { return new Robot(); } }; robotShotPool = new Pool<RobotShot>(MAX_ROBOT_SHOTS, MAX_ROBOT_SHOTS) { @Override protected RobotShot newObject() { return new RobotShot(); } }; }
From source file:com.badlydrawngames.veryangryrobots.WorldView.java
License:Apache License
/** Constructs a new WorldView. * //from w ww . j a v a 2 s. c o m * @param world the {@link World} that this is a view of. * @param presenter the interface by which this <code>WorldView</code> communicates the state of its controls. */ public WorldView(World world, StatusManager statusManager, Presenter presenter) { this.world = world; this.presenter = presenter; Rectangle bounds = world.getRoomBounds(); worldMinX = bounds.x; worldMinY = bounds.y; worldWidth = bounds.width; worldHeight = bounds.height; worldMaxX = worldMinX + worldWidth; worldMaxY = worldMinY + worldHeight; // TODO: find some way of parameterising the viewport mode. worldCam = CameraHelper.createCamera2(ViewportMode.PIXEL_PERFECT, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, Assets.pixelDensity); worldCam.update(); spriteBatch = new SpriteBatch(); spriteCache = new SpriteCache(SPRITE_CACHE_SIZE, true); spriteBatch.setProjectionMatrix(worldCam.combined); spriteCache.setProjectionMatrix(worldCam.combined); prevSpriteCache = new SpriteCache(SPRITE_CACHE_SIZE, true); prevSpriteCache.setProjectionMatrix(worldCam.combined); cacheTransform = new Matrix4(); prevCacheTransform = new Matrix4(); touchPoint = new Vector3(); dragPoint = new Vector3(); joystick = new Vector2(); particleManager = new ParticleManager(MAX_PARTICLES, PARTICLE_SIZE); particleAdapter = new ParticleAdapter(world, particleManager); world.addWorldListener(particleAdapter); flyupManager = new FlyupManager(); statusManager.addScoringEventListener(flyupManager); resetCaches(); }
From source file:com.barconr.games.marblegame.MarbleGameApp.java
License:Apache License
@Override public void create() { Assets.load();/* w ww.j av a2 s .c o m*/ physics = new Physics2D(); physics.createFixtures(Assets.mazemap); if (render2D) { renderer2D = new Maze2Drenderer(Assets.mazemap, physics); } else { renderer3D = new Maze3Drenderer(); } worldAccl = new Vector2(); //System.out.println("Test!!!!!!!!!!!"); }
From source file:com.barconr.games.marblegame.Maze2Drenderer.java
License:Apache License
public Maze2Drenderer(TiledMap tm, Physics2D physics) { font = new BitmapFont(); this.physics = physics; renderer = new Box2DDebugRenderer(); ballLoc = new Vector2(); map = tm;/*from w w w .j a v a2s . c o m*/ camera = new OrthographicCamera(Assets.VIRTUAL_SCREEN_WIDTH, Assets.VIRTUAL_SCREEN_HEIGHT); camera.position.set(Assets.VIRTUAL_SCREEN_WIDTH / 2f, Assets.VIRTUAL_SCREEN_HEIGHT / 2f, 0); camera.update(); //Load Marble Sprite marbleSprite = new Sprite(Assets.marble); marbleSprite.setBounds(0, 0, 16, 16); tilerender = new OrthogonalTiledMapRenderer(map); //createFixtures(Assets.mazemap); debugProj = new Matrix4(camera.combined); debugProj.scale(Assets.PIXELS_PER_METER, Assets.PIXELS_PER_METER, 1); batcher = new SpriteBatch(); batcher.setProjectionMatrix(camera.combined); batcher.enableBlending(); tilerender.setView(camera); }
From source file:com.bladecoder.engine.ui.PieMenu2.java
License:Apache License
public PieMenu2(SceneScreen scr) { sceneScreen = scr;/* w w w . j a va 2 s . co m*/ font = scr.getUI().getSkin().getFont("desc"); buttons = new Button[NUM_VERBS]; endPositions = new Vector2[NUM_VERBS]; for (int i = 0; i < NUM_VERBS; i++) { buttons[i] = new Button(scr.getUI().getSkin(), "pie_lookat"); endPositions[i] = new Vector2(); addActor(buttons[i]); buttons[i].addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, com.badlogic.gdx.scenes.scene2d.Actor actor) { if (iActor != null) { sceneScreen.runVerb(iActor, "lookat", null); } hide(); } }); } }
From source file:com.blastedstudios.ledge.ui.postprocessing.filters.CrtScreen.java
License:Apache License
public CrtScreen(boolean barrelDistortion, RgbMode mode, int effectsSupport) { // @off/*from w ww . ja va 2 s.co m*/ super(ShaderLoader.fromFile("screenspace", "crt-screen", (barrelDistortion ? "#define ENABLE_BARREL_DISTORTION\n" : "") + (mode == RgbMode.RgbShift ? "#define ENABLE_RGB_SHIFT\n" : "") + (mode == RgbMode.ChromaticAberrations ? "#define ENABLE_CHROMATIC_ABERRATIONS\n" : "") + (isSet(Effect.TweakContrast.v, effectsSupport) ? "#define ENABLE_TWEAK_CONTRAST\n" : "") + (isSet(Effect.Vignette.v, effectsSupport) ? "#define ENABLE_VIGNETTE\n" : "") + (isSet(Effect.Tint.v, effectsSupport) ? "#define ENABLE_TINT\n" : "") + (isSet(Effect.Scanlines.v, effectsSupport) ? "#define ENABLE_SCANLINES\n" : "") + (isSet(Effect.PhosphorVibrance.v, effectsSupport) ? "#define ENABLE_PHOSPHOR_VIBRANCE\n" : "") + (isSet(Effect.ScanDistortion.v, effectsSupport) ? "#define ENABLE_SCAN_DISTORTION\n" : ""))); // @on dodistortion = barrelDistortion; vtint = new Vector3(); tint = new Color(); chromaticDispersion = new Vector2(); setTime(0f); setTint(1.0f, 1.0f, 0.85f); setDistortion(0.3f); setZoom(1f); setRgbMode(mode); // default values switch (mode) { case ChromaticAberrations: setChromaticDispersion(-0.1f, -0.1f); break; case RgbShift: setColorOffset(0.003f); break; case None: break; default: throw new GdxRuntimeException("Unsupported RGB mode"); } }