Java 类com.badlogic.gdx.utils.viewport.Viewport 实例源码

项目:arcadelegends-gg    文件:RenderSystem.java   
public RenderSystem(DecalBatch decalBatch, AssetManager assetManager, float worldDegree, Assets.LevelAssets assets) {
    super(Aspect.all(RenderComponent.class, PositionComponent.class));
    this.levelAssets = assets;
    decalMap = new ObjectMap<>();
    uiMap = new ObjectMap<>();
    this.decalBatch = decalBatch;
    this.assetManager = assetManager;
    buffers = new ObjectMap<>();

    this.spriteBatch = new SpriteBatch();
    this.font = assets.uifont;
    font.setColor(Color.BLACK);
    this.uiCamera = new OrthographicCamera();

    Viewport viewportUi = new FitViewport(levelAssets.health_bar_gradient.getWidth(), levelAssets.health_bar_gradient.getHeight(), uiCamera);
    viewportUi.update(viewportUi.getScreenWidth(), viewportUi.getScreenHeight(), true);

    stateTime = 0;
    this.worldDegree = worldDegree;

    gradientShader = new ShaderProgram(Shaders.GradientShader.vertexShader, Shaders.GradientShader.fragmentShader);
    if (gradientShader.isCompiled() == false)
        throw new IllegalArgumentException("couldn't compile shader: " + gradientShader.getLog());
    shaderBatch = new SpriteBatch(10, gradientShader);
}
项目:Teleport-Ball    文件:RestartHud.java   
public RestartHud(final Application app, Viewport viewport, SpriteBatch batch, final Player player, final Ball ball, final TextureAtlas atlas)
{
    super(viewport, batch);
    gameOverLabel = new GameOverLabel();
    restartButton = new RestartButton(player, ball, atlas);
    score = new Score();
    highScore = new HighScore(app);
    homeButton = new HomeButton(app, atlas);

    gameOverLabel.getLabel().setPosition(Constants.V_WIDTH / 2, Constants.V_HEIGHT / 2 + 350, Align.center);
    restartButton.getButton().setPosition(Constants.V_WIDTH / 2, Constants.V_HEIGHT / 2 + 100, Align.center);
    homeButton.getButton().setPosition(Constants.V_WIDTH / 2, Constants.V_HEIGHT / 2 - 25, Align.top);
    score.getLabel().setPosition(Constants.V_WIDTH / 2, Constants.V_HEIGHT / 2 - 300, Align.center);
    highScore.getLabel().setPosition(Constants.V_WIDTH / 2, Constants.V_HEIGHT / 2 - 500, Align.center);

    actors.add(gameOverLabel.getLabel());
    actors.add(restartButton.getButton());
    actors.add(homeButton.getButton());
    actors.add(score.getLabel());
    actors.add(highScore.getLabel());

    addAllActorsToStage();
}
项目:Geometry-wars    文件:MenuScreen.java   
public MenuScreen(Viewport viewport, Skin skin) {
    this.viewport = viewport;
    this.skin = skin;
    this.WIDTH = Gdx.graphics.getWidth();
    this.HEIGHT = Gdx.graphics.getHeight();
    this.buttonWidth = WIDTH / 2 - 120;
    stage = new Stage(viewport);

    background = new Texture(Gdx.files.internal("screen.png"));

    btnStartInactive = new Texture(Gdx.files.internal("btn-start-game.png"));
    btnStartActive = new Texture(Gdx.files.internal("btn-start-game-active.png"));

    btnCampaignInactive = new Texture(Gdx.files.internal("btn-campaign.png"));

    btnSettingsInactive = new Texture(Gdx.files.internal("btn-settings.png"));
    btnSettingsActive = new Texture(Gdx.files.internal("btn-settings-active.png"));

    btnQuitInactive = new Texture(Gdx.files.internal("btn-quit.png"));
    btnQuitActive = new Texture(Gdx.files.internal("btn-quit-active.png"));


}
项目:Geometry-wars    文件:SettingScreenOld.java   
public SettingScreenOld(Viewport viewport, Skin skin) {
    float screenWidth = Gdx.graphics.getWidth();
    float screenHeight = Gdx.graphics.getHeight();
    stage = new Stage(viewport);

    Label label = new Label("Player 1", skin);
    label.setPosition(screenWidth / 2, screenHeight - 10, Align.top);
    stage.addActor(label);

    label = new Label("Forward", skin);
    label.setPosition(10, screenHeight - 60);
    stage.addActor(label);

    TextField field = new TextField("", skin);
    field.setPosition(50, screenHeight - 20);
    field.setWidth(100);
    field.setHeight(50);
    stage.addActor(field);
}
项目:braingdx    文件:GameContext2DImpl.java   
public GameContext2DImpl(ViewportFactory viewportFactory, ShaderConfig shaderConfig) {
    camera = new OrthographicCamera();
    world = new GameWorld(camera);
    behaviorManager = new BehaviorManager();
    batch = new SpriteBatch();
    input = new InputMultiplexer();
    boxWorld = new World(Vector2.Zero, false);
    lightingManager = new LightingManager(boxWorld, camera);
    renderManager = new GameObjectRenderManager(batch);
    gameCamera = new VectorGameCamera(camera);
    particleManager = new ParticleManager();
    stage = new Stage(viewportFactory.create(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
    Viewport worldStageViewport = viewportFactory.create(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    worldStageViewport.setCamera(camera);
    worldStage = new Stage(worldStageViewport);
    renderPipeline = new CombinedRenderPipelineFactory(shaderConfig, world, lightingManager, stage, worldStage, viewportFactory)
            .create();
    tiledMapManager = new TiledMapManagerImpl(behaviorManager, world, renderManager);
    wire();
}
项目:Mundus    文件:BasePicker.java   
public Pixmap getFrameBufferPixmap(Viewport viewport) {
    int w = viewport.getScreenWidth();
    int h = viewport.getScreenHeight();
    int x = viewport.getScreenX();
    int y = viewport.getScreenY();
    final ByteBuffer pixelBuffer = BufferUtils.newByteBuffer(w * h * 4);

    Gdx.gl.glBindFramebuffer(GL20.GL_FRAMEBUFFER, fbo.getFramebufferHandle());
    Gdx.gl.glReadPixels(x, y, w, h, GL30.GL_RGBA, GL30.GL_UNSIGNED_BYTE, pixelBuffer);
    Gdx.gl.glBindFramebuffer(GL20.GL_FRAMEBUFFER, 0);

    final int numBytes = w * h * 4;
    byte[] imgLines = new byte[numBytes];
    final int numBytesPerLine = w * 4;
    for (int i = 0; i < h; i++) {
        pixelBuffer.position((h - i - 1) * numBytesPerLine);
        pixelBuffer.get(imgLines, i * numBytesPerLine, numBytesPerLine);
    }

    Pixmap pixmap = new Pixmap(w, h, Pixmap.Format.RGBA8888);
    BufferUtils.copy(imgLines, 0, pixmap.getPixels(), imgLines.length);

    return pixmap;
}
项目:GdxDemo3D    文件:GameRenderer.java   
public GameRenderer(Viewport viewport, Camera camera, GameEngine engine) {
    this.viewport = viewport;
    this.camera = camera;
    this.engine = engine;

    shapeRenderer = new MyShapeRenderer();
    shapeRenderer.setAutoShapeType(true);

    spriteBatch = new SpriteBatch();
    font = new BitmapFont();
    font.setColor(Color.WHITE);
    font.setUseIntegerPositions(false);
    font.getData().setScale(0.01f);
    shadowBatch = new ModelBatch(new DepthShaderProvider());

    ShaderProgram.pedantic = false;
    final String vertUber = Gdx.files.internal("shaders/uber.vert").readString();
    final String fragUber = Gdx.files.internal("shaders/uber.frag").readString();
    modelBatch = new ModelBatch(new DefaultShaderProvider(vertUber, fragUber) {
        @Override
        protected Shader createShader(final Renderable renderable) {
            return new UberShader(renderable, config);
        }
    });
}
项目:KyperBox    文件:KyperBoxGame.java   
public KyperBoxGame(String prefs, String game_name, Viewport view) {
    this.view = view;
    this.prefs_name = prefs;
    if (game_name == null)
        this.game_name = this.getClass().getSimpleName();
    else
        this.game_name = game_name;
    if (prefs_name == null)
        prefs_name = this.game_name + "_data";
    //WARNING    ===========
}
项目:KyperBox    文件:GameLayer.java   
public Vector2 project(Vector2 coords) {
    Viewport view = layer.getState().getGame().getView();
    view.project(coords);
    coords.scl(getZoom());
    coords.set(coords.x + position.x, coords.y + position.y);
    return coords;
}
项目:jewelthief    文件:GameScreenInputAdapter.java   
public GameScreenInputAdapter(Game game, Viewport viewport, Hud hud) {
    this.game = game;
    this.viewport = viewport;
    this.hud = hud;
    playerDragging = false;
    numTouches = 0;
    allowButtonClick = false;
    Gdx.input.setCatchBackKey(true);
}
项目:Undertailor    文件:OverworldController.java   
public OverworldController(MultiRenderer renderer, Environment environment, Viewport viewport) {
    this.events = new EventHelper(this);
    this.camera = new OverworldCamera(this);
    this.collision = new CollisionHandler(camera, true);
    this.transitions = new Pair<>();
    this.environment = environment;
    this.playTransitions = true;
    this.renderer = renderer;
    this.character = null;
    this.room = null;

    this.setViewport(viewport);
}
项目:Teleport-Ball    文件:MenuHud.java   
public MenuHud(Viewport viewport, SpriteBatch batch, final Application app, Sprite bg, final TextureAtlas atlas)
{
    super(viewport, batch);
    redBG = new Sprite(app.assets.get("images/paddlandball/bg-red.png", Texture.class));
    orangeBG = new Sprite(app.assets.get("images/paddlandball/bg-orange.png", Texture.class));
    blueBG = new Sprite(app.assets.get("images/paddlandball/bg-blue.png", Texture.class));
    greenBG = new Sprite(app.assets.get("images/paddlandball/bg-green.png", Texture.class));

    colorOverlay = new ColorOverlay(bg, redBG, orangeBG, blueBG, greenBG, app, atlas);
    titleLabel = new TitleLabel();
    playButton = new PlayButton(app, atlas);
    helpButton = new HelpButton(app, this, atlas);

    titleLabel.getLabel().setPosition(Constants.V_WIDTH / 2, Constants.V_HEIGHT / 2 + 500, Align.center);
    playButton.getButton().setPosition(Constants.V_WIDTH / 2, Constants.V_HEIGHT / 2 + 100, Align.center);
    helpButton.getButton().setPosition(Constants.V_WIDTH / 2, Constants.V_HEIGHT / 2 - 100, Align.center);
    colorOverlay.getImage().setPosition(Constants.V_WIDTH / 2, -150, Align.bottom);

    actors.add(titleLabel.getLabel());
    actors.add(playButton.getButton());
    actors.add(helpButton.getButton());
    actors.add(colorOverlay.getImage());

    // ADD COLOR BUTTONS OF COLOR OVERLAY TO ACTOR LIST
    for (ColorButton colorButton : colorOverlay.getColorButtons())
    {
        actors.add(colorButton.getButton());
    }

    addAllActorsToStage();
}
项目:cachebox3.0    文件:CacheboxMain.java   
@Override
public void create() {

    Gdx.graphics.setContinuousRendering(false);

    final Viewport viewport = new ScalingViewport(Scaling.stretch, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), new OrthographicCamera());
    final Batch batch = new SpriteBatch();

    final Splash splash = new Splash(new Splash.LoadReady() {
        @Override
        public void ready() {
            Config.AppRaterlaunchCount.setValue(Config.AppRaterlaunchCount.getValue() + 1);
            Config.AcceptChanges();

            // Splash is ready with initialisation
            // now switch Stage to ViewManager
            Gdx.app.postRunnable(new Runnable() {
                @Override
                public void run() {
                    StageManager.setMainStage(new ViewManager(
                            CacheboxMain.this, StageManager.viewport, StageManager.batch));
                    batch.dispose();
                }
            });
        }
    }, viewport, batch);

    StageManager.setMainStage(splash);

    Gdx.graphics.requestRendering();
    CB.initThreadCheck();
}
项目:cachebox3.0    文件:Splash.java   
public Splash(LoadReady loadReadyHandler, Viewport viewport, Batch batch) {
    super("splash", viewport, batch);
    this.loadReadyHandler = loadReadyHandler;
    Texture backgroundTexture = new Texture("splash-back.jpg");
    CB.backgroundImage = new Image(backgroundTexture);
    CB.backgroundImage.setWidth(Gdx.graphics.getWidth());
    CB.backgroundImage.setHeight(Gdx.graphics.getHeight());
    this.addActor(CB.backgroundImage);
    InitialView();
}
项目:M-M    文件:TouchControl.java   
@Override
public void update(final Box2DService box2d, final Viewport viewport, final float gameX, final float gameY) {
    viewport.project(entityPosition.set(gameX, gameY));
    if (moving) {
        updateMovementWithAngle(MathUtils.atan2(y - entityPosition.y, x - entityPosition.x));
    }
}
项目:M-M    文件:ComputerControl.java   
@Override
public void update(final Box2DService box2d, final Viewport viewport, final float gameX, final float gameY) {
    timeSinceTarget++;
    timeSinceMoveChange++;
    if (target == null || target.isDestroyed()) {
        timeSinceTarget += UPDATES_TO_CHANGE_TARGET;
    }
    if (timeSinceTarget >= UPDATES_TO_CHANGE_TARGET && multipleTargets) {
        timeSinceTarget -= UPDATES_TO_CHANGE_TARGET;
        if (box2d.getPlayers().size <= 1) {
            target = bot;
            return;
        }
        multipleTargets = box2d.getPlayers().size > 2;
        if (multipleTargets) {
            target = box2d.getPlayers().random();
            if (target == bot) {
                target = box2d.getPlayers()
                        .get((box2d.getPlayers().indexOf(target, true) + 1) / box2d.getPlayers().size);
            }
        } else {
            for (final Player player : box2d.getPlayers()) {
                if (player != bot) {
                    target = player;
                    break;
                }
            }
        }
    }
    if (timeSinceMoveChange >= UPDATES_TO_CHANGE_MOVEMENT) {
        timeSinceMoveChange -= UPDATES_TO_CHANGE_MOVEMENT;
        final float x = target.getX() + random(box2d);
        final float y = target.getY() + random(box2d);
        updateMovementWithAngle(MathUtils.atan2(y - bot.getY(), x - bot.getX()));
    }
}
项目:Fruit-Destroyer    文件:IntroHud.java   
public IntroHud(Application APP, Viewport viewport, SpriteBatch batch, Font slimJoe, Font bigJohn)
{
    super(viewport, batch);
    this.APP = APP;
    this.slimJoe = slimJoe;
    this.bigJohn = bigJohn;

    background = new Image(new Texture("backgrounds/white.jpg"));
    title = new Label("NahroTo", new Label.LabelStyle(bigJohn.getFont(), Color.WHITE));
    underscript1 = new Label("a ", new Label.LabelStyle(slimJoe.getFont(), Color.WHITE));
    underscript2 = new Label(" production", new Label.LabelStyle(slimJoe.getFont(), Color.WHITE));

    title.setPosition(Constants.V_WIDTH / 2, Constants.V_HEIGHT / 2, Align.center);
    underscript1.setPosition(title.getX(), title.getY() + 6, Align.bottomRight);
    underscript2.setPosition(title.getX(), title.getY(), Align.topLeft);

    background.addAction(alpha(0f));
    title.addAction(color(Color.BLACK));
    underscript1.addAction(color(Color.BLACK));
    underscript2.addAction(color(Color.BLACK));

    actors.add(background);
    actors.add(title);
    actors.add(underscript1);
    actors.add(underscript2);

    addAllActors();
}
项目:TempoGDX    文件:InfoScreen.java   
public InfoScreen(Viewport viewport, InfoScreenDelegate delegate) {
  stage = new Stage(viewport);
  this.delegate = delegate;
  skin = SkinFactory.create();

  createLayout();
}
项目:TempoGDX    文件:MainScreen.java   
public MainScreen(Viewport viewport, MainScreenDelegate delegate) {
  this.delegate = delegate;
  metronome = new Metronome();
  tapTempoCalculator = new TapTempoCalculator(Constants.NUMBER_OF_TAPS, Constants.MIN_BPM);
  stage = new Stage(viewport);

  createLayout();
}
项目:Geometry-wars    文件:LoginScreen.java   
public LoginScreen(Viewport viewport, Skin skin) {
    this.viewport = viewport;
    this.skin = skin;
    this.WIDTH = Gdx.graphics.getWidth();
    this.HEIGHT = Gdx.graphics.getHeight();
    this.BUTTON_WIDTH =WIDTH/4-50;
    this.BUTTON_HEIGHT=WIDTH/20;

    stage = new Stage(viewport);

    background = new Texture(Gdx.files.internal("screen.png"));
    loginScreen = new Texture(Gdx.files.internal("screen-login.png"));
    loginButton = new Texture(Gdx.files.internal("btn-login.png"));
    registerButton = new Texture(Gdx.files.internal("btn-register.png"));
}
项目:Geometry-wars    文件:GameScreen.java   
public GameScreen(Viewport viewport, Skin skin, Player player) {
    stage = new GameStage(viewport);
    this.skin = skin;

    Sprite projectileSprite = SpriteRepository.getBlueProjectile();
    projectileSprite.setScale(0.15f * SettingsRepository.getInstance().getActorScale());
    PlayerActor playerActor = new PlayerActor(stage, SpriteRepository.getArrow(), player, projectileSprite);
    playerActor.setScale(0.3f * SettingsRepository.getInstance().getActorScale());
    playerActor.setPosition(CustomUtils.getCenterCoordinates(playerActor, stage));
    stage.addPlayer(playerActor);

    DroneActor droneActor = new DroneActor(stage, SpriteRepository.getAttackDrone(), playerActor);
    droneActor.setMovementBehavior(new StayAroundActor(droneActor, playerActor, 25, 50, 3));
    droneActor.setCollisionBehavior(new DamageEnemyActor(droneActor, 1, 0));
    projectileSprite = new Sprite(projectileSprite);
    projectileSprite.setScale(0.075f * SettingsRepository.getInstance().getActorScale());
    droneActor.setAttackBehavior(new SnipeEnemiesAttack(droneActor, playerActor, 0.1f, projectileSprite));
    droneActor.setScale(0.3f * SettingsRepository.getInstance().getActorScale());
    playerActor.setDrone(droneActor);

    /*
    Texture text = new Texture("Desktop/Assets/bck_rectangle.png");
    Sprite sprite  = new Sprite(text);
    //actor.setPosition(stage.getWidth() / 2 - center.getWidth() / 2, stage.getHeight() / 2 - center.getHeight() / 2);
    final int xAmount = 50;
    final int yAmount = 25;
    final float scaleX = stage.getWidth() / (sprite.getWidth() * xAmount);
    final float scaleY = stage.getHeight() / (sprite.getHeight() * yAmount);
    sprite.setScale(scaleX, scaleY);
    for (int i = 0; i < 50; i++) {
        for (int j = 0; j < 25; j++) {
            SpriteActor actor = new SpriteActor(stage, new Sprite(sprite));
            actor.setPosition(i * sprite.getWidth() * sprite.getScaleX(), j * sprite.getHeight() * sprite.getScaleY());
            stage.addActor(actor);
        }
    }
    */

    createUI();
}
项目:gdx-texture-packer-gui    文件:MainController.java   
@Override
public void resize(Stage stage, int width, int height) {
    final Viewport viewport = stage.getViewport();
    viewport.update(width, height, true);

    toastManager.resize();

    LmlData lmlData = interfaceService.getParser().getData();
    lmlData.addArgument("stageWidth", stage.getWidth());
    lmlData.addArgument("stageHeight", stage.getHeight());
}
项目:Entitas-Java    文件:GUIManagerGDX.java   
public GUIManagerGDX(Viewport viewport, BitmapFont defaultFont, EngineGDX engine) {
    this.guiFactories = EntitasCollections.createMap(String.class, GUIFactory.class);
    this.defaultFont = defaultFont;
    this.engine = engine;
    stage = new Stage(viewport);

}
项目:ud405    文件:Boulder.java   
public void init(Viewport viewport){
    position = new Vector2();

    // TODO: Set the initial velocity to zero in both directions
    velocity = new Vector2(0, 0);

    radius = viewport.getWorldWidth() * RADIUS_RATIO;
    position.y = viewport.getWorldHeight() + radius;
    Random random = new Random();
    position.x = random.nextFloat() * (viewport.getWorldWidth() - 2 * radius) + radius;
}
项目:ud405    文件:Avalanche.java   
public void update(float delta, Viewport viewport){
    Random random = new Random();
    if (random.nextFloat() < delta * SPAWNS_PER_SECOND){
        boulders.add(new Boulder(viewport));
    }

    for (int i = 0; i < boulders.size; i++){
        Boulder boulder = boulders.get(i);
        boulder.update(delta);
        if (boulder.isBelowScreen()){
            boulders.removeIndex(i);
        }
    }
}
项目:ud406    文件:LevelLoader.java   
public static Level load(String levelName, Viewport viewport) {

        String path = Constants.LEVEL_DIR + File.separator + levelName + "." + Constants.LEVEL_FILE_EXTENSION;
        Level level = new Level(viewport);

        FileHandle file = Gdx.files.internal(path);
        JSONParser parser = new JSONParser();

        try {
            JSONObject rootJsonObject = (JSONObject) parser.parse(file.reader());

            JSONObject composite = (JSONObject) rootJsonObject.get(Constants.LEVEL_COMPOSITE);

            JSONArray platforms = (JSONArray) composite.get(Constants.LEVEL_9PATCHES);
            loadPlatforms(platforms, level);

            // TODO: Get the non-platform level objects from composite (using the Constants.LEVEL_IMAGES key)
            JSONArray nonPlatformObjects = (JSONArray) composite.get(Constants.LEVEL_IMAGES);

            // TODO: Call loadNonPlatformEntities()
            loadNonPlatformEntities(level, nonPlatformObjects);

        } catch (Exception ex) {
            Gdx.app.error(TAG, ex.getMessage());
            Gdx.app.error(TAG, Constants.LEVEL_ERROR_MESSAGE);
        }

        return level;
    }
项目:ud405    文件:BouncingBall.java   
/**
 * TODO: Here's the polling action
 *
 * We've defined a base radius for the ball, and we determine the actual radius by multiplying
 * the base radius by the radius multiplier. We start the radius multiplier at 1.0, and then we
 * adjust it up or down each frame based on whether or not the Z or X keys are pressed. We also
 * have a radius growth rate constant that determines how fast the radius multiplier changes.
 *
 * Note that we also make sure the radius multiplier can't fall below a certain minimum. That
 * way we don't end up with an invisible ball with a negative radius.
 */
public void update(float delta, Viewport viewport) {

    if (Gdx.input.isKeyPressed(Keys.Z)) {
        radiusMultiplier += delta * RADIUS_GROWTH_RATE;
    }
    if (Gdx.input.isKeyPressed(Keys.X)) {
        radiusMultiplier -= delta * RADIUS_GROWTH_RATE;
        radiusMultiplier = Math.max(radiusMultiplier, MIN_RADIUS_MULTIPLIER);
    }
    radius = radiusMultiplier * BASE_RADIUS;

    float secondsSinceLastKick = MathUtils.nanoToSec * (TimeUtils.nanoTime() - lastKick);

    if (secondsSinceLastKick > KICK_INTERVAL) {
        lastKick = TimeUtils.nanoTime();
        randomKick();
    }

    velocity.x -= delta * DRAG * velocity.x;
    velocity.y -= delta * DRAG * velocity.y;

    position.x += delta * velocity.x;
    position.y += delta * velocity.y;


    collideWithWalls(radius, viewport.getWorldWidth(), viewport.getWorldHeight());
}
项目:gdx-lml    文件:StageViewportAnnotationProcessor.java   
@SuppressWarnings("unchecked")
private void setViewportProvider(final Object provider) {
    if (provider instanceof ObjectProvider<?>) {
        interfaceService.setViewportProvider((ObjectProvider<Viewport>) provider);
        return;
    }
    throw new GdxRuntimeException(
            "Invalid viewport provider: has to implement ObjectProvider<Viewport>: " + provider);
}
项目:ud406    文件:Level.java   
public Level(Viewport viewport) {
    this.viewport = viewport;

    gigaGal = new GigaGal(Constants.DEFAULT_SPAWN_LOCATION, this);
    platforms = new Array<Platform>();
    enemies = new DelayedRemovalArray<Enemy>();
    bullets = new DelayedRemovalArray<Bullet>();
    explosions = new DelayedRemovalArray<Explosion>();
    powerups = new DelayedRemovalArray<Powerup>();
}
项目:ud405    文件:BouncingBall.java   
public void update(float delta, Viewport viewport) {

        // Growing and shrinking
        if (Gdx.input.isKeyPressed(Keys.Z)) {
            radiusMultiplier += delta * RADIUS_GROWTH_RATE;
        }
        if (Gdx.input.isKeyPressed(Keys.X)) {
            radiusMultiplier -= delta * RADIUS_GROWTH_RATE;
            radiusMultiplier = Math.max(radiusMultiplier, MIN_RADIUS_MULTIPLIER);
        }

        // Movement
        if (Gdx.input.isKeyPressed(Keys.LEFT)) {
            velocity.x -= delta * ACCELERATION;

        }
        if (Gdx.input.isKeyPressed(Keys.RIGHT)) {
            velocity.x += delta * ACCELERATION;

        }
        if (Gdx.input.isKeyPressed(Keys.UP)) {
            velocity.y += delta * ACCELERATION;

        }
        if (Gdx.input.isKeyPressed(Keys.DOWN)) {
            velocity.y -= delta * ACCELERATION;

        }

        velocity.clamp(0, MAX_SPEED);


        velocity.x -= delta * DRAG * velocity.x;
        velocity.y -= delta * DRAG * velocity.y;

        position.x += delta * velocity.x;
        position.y += delta * velocity.y;

        collideWithWalls(baseRadius * radiusMultiplier, viewport.getWorldWidth(), viewport.getWorldHeight());
    }
项目:gdx-autumn-mvc    文件:StageViewportAnnotationProcessor.java   
@SuppressWarnings("unchecked")
private void setViewportProvider(final Object provider) {
    if (provider instanceof ObjectProvider<?>) {
        interfaceService.setViewportProvider((ObjectProvider<Viewport>) provider);
        return;
    }
    throw new GdxRuntimeException(
            "Invalid viewport provider: has to implement ObjectProvider<Viewport>: " + provider);
}
项目:gdx-lml    文件:Images.java   
@Override
public void render(final float delta) {
    super.render(delta);
    final Batch batch = getStage().getBatch();
    final Viewport viewport = getStage().getViewport();

    // Drawing logo image 3 times in different parts of the screen:
    batch.begin();
    batch.draw(logo, 0, 0);
    batch.draw(logo, (int) (viewport.getWorldWidth() / 2f - logo.getWidth() / 2f),
            (int) (viewport.getWorldHeight() / 2f - logo.getHeight() / 2f));
    batch.draw(logo, (int) (viewport.getWorldWidth() - logo.getWidth()),
            (int) (viewport.getWorldHeight() - logo.getHeight()));
    batch.end();
}
项目:libgdx_ui_editor    文件:MainStage.java   
public MainStage(Viewport viewport){
    super(viewport);
    init();
}
项目:Race99    文件:StageFactory.java   
public StageFactory(Viewport viewport, StageManager stageManager){
    this.viewport = viewport;
    addObserver(stageManager);
}
项目:feup-lpoo-armadillo    文件:OptionsMenu.java   
/**
 * Options Menu Constructor.
 * It initializes all the needed elements.
 *
 * @param viewport The viewport that will be associated to the stage.
 * @param game     The current game session.
 * @param hud      The current Hud, associated to the current game being played.
 */
protected OptionsMenu(Viewport viewport, Armadillo game, HudMenu hud) {
    super(viewport, game.getBatch());

    Gdx.input.setInputProcessor(this);

    this.game = game;
    this.hud = hud;

    table = new Table();
    skin = game.getPrimarySkin();

    message = new Label("", this.skin);

    confStage();
}
项目:KyperBox    文件:KyperBoxGame.java   
public KyperBoxGame(String game_name, Viewport view) {
    this(null, game_name, view);
}
项目:KyperBox    文件:KyperBoxGame.java   
public KyperBoxGame(Viewport view) {
    this(null, view);
}
项目:KyperBox    文件:KyperBoxGame.java   
public Viewport getView() {
    return view;
}
项目:KyperBox    文件:GameLayer.java   
public Vector2 unproject(Vector2 coords) {
    Viewport view = layer.getState().getGame().getView();
    view.unproject(coords);
    coords.set(-position.x +coords.x, coords.y - position.y).scl(1f/getZoom());
    return coords;
}
项目:gdx-controllerutils    文件:ControllerMenuStage.java   
public ControllerMenuStage(Viewport viewport) {
    super(viewport);
}