Java 类com.badlogic.gdx.InputMultiplexer 实例源码

项目:tutorial-libgdx    文件:PantallaAuto.java   
@Override
public void show() {
    coche = new Coche();
    coche.setPosition(50, 50);

    // Creo los controladores.
    controlador = new ControladorVirtual();
    teclado = new EntradaCocheTeclado(controlador);
    raton = new EntradaCocheRaton(controlador);

    // Para poder usar ambos a la vez creo multiplexores.
    multiplexor = new InputMultiplexer();
    multiplexor.addProcessor(raton);
    multiplexor.addProcessor(teclado);

    // setInputProcessor = poner un controlador o un multiplexor.
    Gdx.input.setInputProcessor(multiplexor);
}
项目:SaveUA    文件:GdxMenu.java   
@Override
public void show() {
    bg = ResKeeper.get(TextureId.BG);
    InputMultiplexer im = new InputMultiplexer(stage);
    im.addProcessor(new HardInputProcessor() {
        @Override
        public boolean keyUp(int keycode) {
            if (keycode == Keys.BACKSPACE || keycode == Keys.BACK) {
                dispose();
                Gdx.app.exit();
            }
            return false;
        }
    });
    Gdx.input.setInputProcessor(im);
    Gdx.input.setCatchBackKey(true);
}
项目:ShapeOfThingsThatWere    文件:AbstractPausedScreen.java   
@Override
public void show() {
  super.show();

  initMenu();
  InputAdapter escape = new InputAdapter() {
    @Override
    public boolean keyDown(int keycode) {
      if (keycode == Keys.ESCAPE && canEscape) {
        resumeGame();
        return true;
      } else
        return false;
    }
  };
  Gdx.input.setInputProcessor(new InputMultiplexer(escape, stage));
}
项目:enklave    文件:ScreenBricks.java   
@Override
public void show() {
    stage = new Stage(new StretchViewport(Width,Height));
    stage.addActor(tabContinue);
    PerspectiveCamera camera2 = new PerspectiveCamera(40, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera2.position.set(0, -Width * 0.075f, Width * 0.135f);
    camera2.lookAt(0, 0, 0);
    camera2.far = Width*0.3f;
    camera2.near = 1;
    camera2.update();
    controller = new CameraInputController(camera2);
    CameraGroupStrategy cameraGroupStrategy = new CameraGroupStrategy(camera2);
    batch = new DecalBatch(cameraGroupStrategy);
    modelBatch = new ModelBatch();
    InputMultiplexer in = new InputMultiplexer();
    in.addProcessor(stage);
    in.addProcessor(controller);
    Gdx.input.setInputProcessor(in);
}
项目:enklave    文件:ScreenExtensions.java   
@Override
public void show() {
    if(drawone){
        addBackgroundExtension();
        addPuls();
        addimagebg();
        addButtonBottom();
        drawone = false;
    }
    cameraGroupStrategy = new CameraGroupStrategy(camera);
    batch = new DecalBatch(cameraGroupStrategy);
    stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()));
    addtostage();
    Gdx.input.setCatchBackKey(true);
    inputmulti = new InputMultiplexer();
    inputmulti.addProcessor(stage);
    Gdx.input.setInputProcessor(inputmulti);
}
项目:enklave    文件:ScreenRooms.java   
@Override
    public void show() {
        if(drawone){
            addroomselect();
            addButtonBottom();
            addPuls();
            addimagebg();
            addbuildRoom();
            addtimerbuildroom();
            drawone = false;
        }
        cameraGroupStrategy = new CameraGroupStrategy(camera);
//        CameraInputController controller = new CameraInputController(camera);
        stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()));
        batchsprite = new SpriteBatch();
        addtostage();
        batch = new DecalBatch(this.cameraGroupStrategy);
        Gdx.input.setCatchBackKey(true);
        InputMultiplexer inputmulti = new InputMultiplexer();
        inputmulti.addProcessor(stage);
        Gdx.input.setInputProcessor(inputmulti);
    }
项目:Polymorph    文件:GameScreen.java   
private void initHud() {
    hud = new Stage(viewport, batch);
    Gdx.input.setInputProcessor(new InputMultiplexer(new KeyboardInputHandler(), hud));

    //init widgets
    ColorButton[] colorButtons = createColorButtons();
    final ShapeButton[] shapeButtons = createShapeButtons(colorButtons);

    // add widgets to stage
    for (ShapeButton shapeButton : shapeButtons) {
        hud.addActor(shapeButton);
    }
    for (ColorButton colorButton : colorButtons) {
        hud.addActor(colorButton);
    }

    TextureAtlas textureAtlas = polymorph.getAssetManager().get(Polymorph.MASTER_PATH, TextureAtlas.class);
    hud.addActor(createHealthBar(textureAtlas));
    hud.addActor(createPauseButton(textureAtlas));
}
项目:arcadelegends-gg    文件:InputSettingsScreen.java   
/**
 * Method responsible for initializing the main menu
 * Called when the screen becomes the current screen of the game
 */
@Override
public void show() {
    cam = new OrthographicCamera();
    viewport = new FitViewport(1920, 1080);
    viewport.setCamera(cam);
    stage = new Stage(viewport);
    stage.setViewport(viewport);
    skin = settingsAssets.styles_json;
    int x = 1920;
    int y = 1080;
    spriteBatch = new SpriteBatch();
    mainbackground = settingsAssets.testmainscreen;
    BitmapFont font = settingsAssets.bocklin_fnt;
    TextureRegion backgroundTexture = new TextureRegion(settingsAssets.background_textbutton);

    inputTable = new Table();
    keys = IInputConfig.InputKeys.values();
    keyMap = new HashMap<>();

    initInputRows(font, backgroundTexture);
    createBackButton();
    AL.input.setInputProcessor(new InputMultiplexer(stage, this));
}
项目:arcadelegends-gg    文件:PauseMenuScreen.java   
/**
 * Method responsible for initializing the pause menu
 * Called when the screen becomes the current screen of the game
 */
@Override
public void show() {
    // Inits:
    cam = new OrthographicCamera();
    viewport = new FitViewport(1920, 1080);
    viewport.setCamera(cam);
    stage = new Stage(viewport);
    stage.setViewport(viewport);
    skin = menuAssets.styles_json;
    skin.getFont("bocklin").getData().setScale(0.8f, 0.8f);
    int x = 1920;
    int y = 1080;
    spriteBatch = new SpriteBatch();
    mainbackground = menuAssets.testmainscreen;

    createComponents();

    AL.input.setInputProcessor(new InputMultiplexer(stage, this));
}
项目:ExamensArbeteTD    文件:PlayState.java   
public PlayState(GameStateManager gsm) {
    super(gsm);
    Assets.loadGameStageAssets();
    Engine ashleyEngine = new Engine();
    LevelManager.loadLevel("maps/simple-map.tmx");
    _renderer = new OrthogonalTiledMapRenderer(LevelManager.tiledMap);
    _gameCamera = new OrthographicCamera();
    EntityFactory entityFactory = new EntityFactory(ashleyEngine);
    InputHandler inputhandler = new InputHandler(_gameCamera,entityFactory,gsm,ashleyEngine);
    _uiStage = new UiStage();
    _entityManager = new EntityManager(ashleyEngine, _batch, _gameCamera, inputhandler, _uiStage, gsm, entityFactory);

    InputMultiplexer multi = new InputMultiplexer();

    multi.addProcessor(_uiStage);
    multi.addProcessor(inputhandler);
    Gdx.input.setInputProcessor(multi);
}
项目:nhglib    文件:InputHandlerOld.java   
public InputHandlerOld() {
    tempVec = new Vector2();

    activeContexts = new Array<>();
    activeKeyCodes = new ArrayMap<>();
    activePointers = new ArrayMap<>();
    activeMouseInputs = new ArrayMap<>();

    inputListeners = new Array<>();
    inputContexts = new ArrayMap<>();

    keyInputsMap = new ArrayMap<>();
    pointerInputsMap = new ArrayMap<>();
    stickInputsMap = new ArrayMap<>();
    mouseInputsMap = new ArrayMap<>();

    Controllers.addListener(this);

    inputMultiplexer = new InputMultiplexer(this);
    Gdx.input.setInputProcessor(inputMultiplexer);
}
项目:nhglib    文件:SystemInputHandler.java   
public SystemInputHandler(InputProxy inputProxy, InputMultiplexer inputMultiplexer, Array<NhgInput> systemInputArray) {
    this.inputProxy = inputProxy;

    vec0 = new Vector2();

    keyboardButtonInputs = new IntMap<>();
    mouseButtonInputs = new IntMap<>();
    touchInputs = new IntMap<>();

    activeKeyboardButtonInputs = new Array<>();
    activeMouseButtonInputs = new Array<>();
    activeTouchInputs = new Array<>();

    mapSystemInput(systemInputArray);
    handleSystemInput(inputMultiplexer);
}
项目:LibGDX-PBR    文件:PBRTestAPP.java   
private void CreateStage(float w, float h, float scale) {
    if(stage!=null) stage.dispose();

    stage = new Stage();
    addMetallicSlider(w,h,scale);
    addRougnessSlider(w,h,scale);
    addAlbedoRSlider(w,h,scale);
    addAlbedoGSlider(w,h,scale);
    addAlbedoBSlider(w,h,scale);
    addOcclusionlider(w,h,scale);
    addTypeButton(w,h,scale);

    InputMultiplexer multiplexer = new InputMultiplexer();
    multiplexer.addProcessor(stage);
    multiplexer.addProcessor(camController);

    Gdx.input.setInputProcessor(multiplexer);
}
项目:space-travels-3    文件:TutorialScreen.java   
@Override
public void show()
{
    InputAdapter backInputAdapter = new InputAdapter()
    {
        @Override
        public boolean keyUp(int keycode)
        {
            switch (keycode)
            {
                case Input.Keys.ESCAPE:
                case Input.Keys.BACK:
                {

                    ScreenManager.removeScreen(TutorialScreen.this);
                    ScreenManager.removeScreen(TutorialScreen.this.gameScreen);
                    return true;
                }
            }
            return false;
        }
    };
    Gdx.input.setInputProcessor(new InputMultiplexer(this.stage, backInputAdapter));
}
项目:space-travels-3    文件:MenuScreen.java   
@Override
public void show()
{
    Gdx.input.setInputProcessor(new InputMultiplexer(this.stage, new InputAdapter()
    {
        @Override
        public boolean keyUp(int keycode)
        {
            switch (keycode)
            {
                case Input.Keys.ESCAPE:
                case Input.Keys.BACK:
                {
                    Gdx.app.exit();
                    return true;
                }
            }
            return false;
        }
    }));
}
项目:space-travels-3    文件:IngameMenuScreen.java   
@Override
public void show()
{
    InputAdapter enterInputAdapter = new InputAdapter()
    {
        @Override
        public boolean keyUp(int keycode)
        {
            switch (keycode)
            {
                case Input.Keys.ENTER:
                {
                    play(
                        IngameMenuScreen.this.level.getId(),
                        IngameMenuScreen.this.level.getDifficulty());
                    return true;
                }
            }
            return false;
        }
    };

    Gdx.input.setInputProcessor(new InputMultiplexer(
        this.stage,
        enterInputAdapter));
}
项目:cachebox3.0    文件:CoordinateActivity.java   
@Override
protected void onFocusSet(VisTextButton button) {
    //  Enable/Disable numPad or keyPad

    if (button == l3_4) {
        //disable numPad
        numPad.setVisible(false);
        // enable keyPad
        Gdx.input.setOnscreenKeyboardVisible(true);
        ((InputMultiplexer) Gdx.input.getInputProcessor()).addProcessor(keyboardListener);

    } else {
        //disable keyPad
        Gdx.input.setOnscreenKeyboardVisible(false);
        ((InputMultiplexer) Gdx.input.getInputProcessor()).removeProcessor(keyboardListener);
        // enable numPad
        numPad.setVisible(true);
    }


}
项目:M-M    文件:GameController.java   
@Override
public void show(final Stage stage, final Action action) {
    bonuses.clear();
    effects.clear();
    box2d.create();
    minionSprites.clear();
    running = true;
    timer = 0f;
    background = gameAssetService.getRandomBackground();
    for (final Table table : playerViews) {
        table.setVisible(false);
    }
    createPlayerSprites();
    createBlockSprites();
    createMinionSprites();
    super.show(stage, Actions.sequence(action, Actions.run(new Runnable() {
        @Override
        public void run() { // Listening to user input events:
            final InputMultiplexer inputMultiplexer = new InputMultiplexer(stage);
            box2d.initiateControls(inputMultiplexer);
            Gdx.input.setInputProcessor(inputMultiplexer);
        }
    })));
}
项目:Inspiration    文件:WorldController.java   
private void init() {
    camera = new OrthographicCamera(Constants.VIEWPORT_WIDTH, Constants.VIEWPORT_HEIGHT);
    camera.position.set(0, 0, 0);
    camera.update();

    isGameOver = false;
    player = new Role("lante");
    mapMgr = new MapsManager(player);

    hudCamera = new OrthographicCamera();
    hudCamera.setToOrtho(false, Constants.VIEWPORT_WIDTH, Constants.VIEWPORT_HEIGHT);//physical world
    hudCamera.update();
    hudScreen = new HUDScreen(this, player);
    multiplexer = new InputMultiplexer();
    multiplexer.addProcessor(hudScreen.getStage());
    multiplexer.addProcessor(this);
    input.setInputProcessor(multiplexer);
}
项目:eamaster    文件:BulletTestCollection.java   
@Override
public void create () {
    if (app == null) {
        app = Gdx.app;
        tests[testIndex].create();
    }

    cameraController = new CameraInputController(tests[testIndex].camera);
    cameraController.activateKey = Keys.CONTROL_LEFT;
    cameraController.autoUpdate = false;
    cameraController.forwardTarget = false;
    cameraController.translateTarget = false;
    Gdx.input.setInputProcessor(new InputMultiplexer(cameraController, this, new GestureDetector(this)));

    font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
    hud = new Stage();
    hud.addActor(fpsLabel = new Label(" ", new Label.LabelStyle(font, Color.WHITE)));
    fpsLabel.setPosition(0, 0);
    hud.addActor(titleLabel = new Label(tests[testIndex].getClass().getSimpleName(), new Label.LabelStyle(font, Color.WHITE)));
    titleLabel.setY(hud.getHeight() - titleLabel.getHeight());
    hud.addActor(instructLabel = new Label("A\nB\nC\nD\nE\nF", new Label.LabelStyle(font, Color.WHITE)));
    instructLabel.setY(titleLabel.getY() - instructLabel.getHeight());
    instructLabel.setAlignment(Align.top | Align.left);
    instructLabel.setText(tests[testIndex].instructions);
}
项目: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();
}
项目:DungeonCrawler    文件:GameScreen.java   
public GameScreen() {
    DungeonGenerator dungeonGenerator = DungeonGeneratorFactory.getDungeonGenerator(1);
    Dungeon dungeon = dungeonGenerator.generateDungeon();
    Dungeon.setActiveDungeon(dungeon);
    GameInputHandler gameInputHandler = new GameInputHandler();
    PlayerCharacterEntity player = PlayerCharacterEntity.getInstance();
    player.placeCharacterIn(dungeon);
    player.respawn();
    PlayerInputHandler playerInputHandler = new PlayerInputHandler(PlayerCharacterEntity.getInstance());

    camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.zoom = 0.5f;

    batch = new SpriteBatch();

    ui = new UserInterface();

    inputMultiplexer = new InputMultiplexer();
    inputMultiplexer.addProcessor(playerInputHandler);
    inputMultiplexer.addProcessor(ui.getInputProcessor());
    inputMultiplexer.addProcessor(gameInputHandler);
}
项目:libgdx-inGameConsole    文件:GUIConsole.java   
@Override
public void resetInputProcessing () {
    usesMultiplexer = true;
    appInput = Gdx.input.getInputProcessor();
    if (appInput != null) {
        if (hasStage(appInput)) {
            log("Console already added to input processor!", LogLevel.ERROR);
            Gdx.app.log("Console", "Already added to input processor!");
            return;
        }
        multiplexer = new InputMultiplexer();
        multiplexer.addProcessor(stage);
        multiplexer.addProcessor(appInput);
        Gdx.input.setInputProcessor(multiplexer);
    } else {
        Gdx.input.setInputProcessor(stage);
    }
}
项目:GDXJam    文件:InputSystem.java   
public void initalizeInput () {
    multiplexer = new InputMultiplexer();
    multiplexer.addProcessor(guiSystem.getStage());
    multiplexer.addProcessor(this);
    Gdx.input.setInputProcessor(multiplexer);

    keybindIndices.put(Keybinds.SQUAD0, 0);
    keybindIndices.put(Keybinds.SQUAD1, 1);
    keybindIndices.put(Keybinds.SQUAD2, 2);
    keybindIndices.put(Keybinds.SQUAD3, 3);
    keybindIndices.put(Keybinds.SQUAD4, 4);

    keybindIndices.put(Keybinds.FORMATION0, 0);
    keybindIndices.put(Keybinds.FORMATION1, 1);
    keybindIndices.put(Keybinds.FORMATION2, 2);
    keybindIndices.put(Keybinds.FORMATION3, 3);
    keybindIndices.put(Keybinds.FORMATION4, 4);
    keybindIndices.put(Keybinds.FORMATION5, 5);
}
项目:Roguelike    文件:OptionsScreen.java   
public void create()
{
    skin = Global.loadSkin();

    stage = new Stage( new ScreenViewport() );
    batch = new SpriteBatch();

    table = new Table();
    stage.addActor( table );
    table.setFillParent( true );

    inputMultiplexer = new InputMultiplexer();

    InputProcessor inputProcessorOne = this;
    InputProcessor inputProcessorTwo = stage;

    inputMultiplexer.addProcessor( inputProcessorTwo );
    inputMultiplexer.addProcessor( inputProcessorOne );
}
项目:elin-game    文件:ElinApplication.java   
@Override
public void create () {
    resourceManager = new ResourceManager();
    resourceManager.initAllResources();

    menuStage_ = new MenuStage(resourceManager);
    gameStage_ = new GameStage(resourceManager);
    dialogStage = new DialogStage(gameStage_);
    uiStage = new UIStage(resourceManager,gameStage_);

    inputMultiplexer = new InputMultiplexer(); 
    inputMultiplexer.addProcessor(menuStage_); 
    inputMultiplexer.addProcessor(dialogStage); 
    inputMultiplexer.addProcessor(uiStage);
    inputMultiplexer.addProcessor(gameStage_);
    inputMultiplexer.addProcessor(new GestureDetector(new MyGestureListener(this)));
    Gdx.input.setInputProcessor(inputMultiplexer);
}
项目:umbracraft    文件:OnscreenInputManager.java   
public OnscreenInputManager() {
    halter = new InputHalter();
    stage = new Stage(Game.view().getViewport());
    final MainMenuButton menuButton = new MainMenuButton(stage);
    touchpad = new TouchpadEntity(stage);
    Gdx.input.setInputProcessor(new InputMultiplexer() {
        {
            addProcessor(touchpad);
            addProcessor(menuButton);
            addProcessor(stage);
        }
    });
    add(touchpad);
    add(menuButton);
    add(new InspectButton(stage));
    add(new DebugText(stage));
    Game.publisher().subscribe(this);
}
项目:umbracraft    文件:Window.java   
void open() {
    layout.show();
    layout.setTypeListener(this);
    lastInputProcessor = Gdx.input.getInputProcessor();
    Gdx.input.setInputProcessor(new InputMultiplexer(layout.getStage(), layout));
    onOpen();
    if (layout.close != null) {
        layout.close.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                if (!layout.close.isDisabled()) {
                    Game.audio().sound(CommonSound.CLOSE);
                    close();
                }
            }
        });
    }
}
项目:Alien-Ark    文件:ArkScreen.java   
public ArkScreen(Skin uiSkin, InputMultiplexer multiplexer) {
    ani = new Ani();
    skin = uiSkin;
    this.multiplexer = multiplexer;

    spriteBatch = new SpriteBatch();

    stage = new Stage();
    dragAndDrop = new DragAndDrop();

    App.TUTORIAL_CONTROLLER.register(stage, ani);
    App.TUTORIAL_CONTROLLER.nextStepFor(this.getClass());

    fuelProgressBar = new ShipProgressBar(ShipProgressBar.ProgressType.FUEL);
    fuelProgressBar.updateFromShipProperties();
    shieldProgressBar = new ShipProgressBar(ShipProgressBar.ProgressType.SHIELD);
    shieldProgressBar.updateFromShipProperties();

    stage.addActor(fuelProgressBar);
    stage.addActor(shieldProgressBar);

}
项目:utilsLibGDX    文件:State.java   
public State(){
    entities = new Stack<Entity>();
    layeredEntityList = new ArrayList<LayeredEntity>();
    particles = new Stack<Particle>();
    text = new Stack<Text>();
    tiles = new Stack<Entity>();
    cam = new Camera(MyGdxGame.VIRTUAL_WIDTH, MyGdxGame.VIRTUAL_HEIGHT, 1);
    cam3d = new Camera3D(75, MyGdxGame.VIRTUAL_WIDTH, MyGdxGame.VIRTUAL_HEIGHT);
    sb = new SpriteBatch();
    CameraGroupStrategy cgs = new CameraGroupStrategy(cam3d, new LayeredEntity.YComparator());
    db = new DecalBatch(cgs);
    cursor = new Cursor(cam);
    ui = new UI(cursor);

    inputMultiplexer = new InputMultiplexer();
    inputMultiplexer.addProcessor(ui);
    Gdx.input.setInputProcessor(inputMultiplexer);
}
项目:FlumpGDX    文件:FlumpGdx.java   
@Override
public void create() {
    Json json = new Json();
    FlumpLibrary library = json.fromJson(FlumpLibrary.class, Gdx.files.internal(path + "library.json"));

    GdxLibrary gdxLib = new GdxLibrary(library);

    stage = new PanStage();
    gui = new Gui(gdxLib, stage);
    Gdx.input.setInputProcessor(new InputMultiplexer(gui, stage));

    String[] movies = new String[library.movies.size];

    int i = 0;
    for (Movie movie : library.movies) {
        movies[i++] = movie.id;
    }
    gui.setMovies(movies);
}
项目:tiles3-basic-example    文件:BasicExampleGameApp.java   
@Override
public void onCreate() {
    TileAssetUtils.registerLoaders(Services.get(AssetManager.class));
    CollisionShapes.init();

    InputMultiplexer inputMultiplexer = new InputMultiplexer();
    ContentCache contentCache = new ContentCache();

    Services.register(this);
    Services.register(contentCache);
    Services.register(inputMultiplexer);

    Gdx.input.setInputProcessor(inputMultiplexer);
    Gdx.input.setCatchBackKey(true);
    Gdx.input.setCatchMenuKey(true);

    stateManager.push(GamePlayState.class);
}
项目:libgdxcn    文件:BulletTestCollection.java   
@Override
public void create () {
    if (app == null) {
        app = Gdx.app;
        tests[testIndex].create();
    }

    cameraController = new CameraInputController(tests[testIndex].camera);
    cameraController.activateKey = Keys.CONTROL_LEFT;
    cameraController.autoUpdate = false;
    cameraController.forwardTarget = false;
    cameraController.translateTarget = false;
    Gdx.input.setInputProcessor(new InputMultiplexer(cameraController, this, new GestureDetector(this)));

    font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
    hud = new Stage();
    hud.addActor(fpsLabel = new Label(" ", new Label.LabelStyle(font, Color.WHITE)));
    fpsLabel.setPosition(0, 0);
    hud.addActor(titleLabel = new Label(tests[testIndex].getClass().getSimpleName(), new Label.LabelStyle(font, Color.WHITE)));
    titleLabel.setY(hud.getHeight() - titleLabel.getHeight());
    hud.addActor(instructLabel = new Label("A\nB\nC\nD\nE\nF", new Label.LabelStyle(font, Color.WHITE)));
    instructLabel.setY(titleLabel.getY() - instructLabel.getHeight());
    instructLabel.setAlignment(Align.top | Align.left);
    instructLabel.setText(tests[testIndex].instructions);
}
项目:libgdxcn    文件:FogTest.java   
@Override
public void create () {
    modelBatch = new ModelBatch();
    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1.f));
    environment.set(new ColorAttribute(ColorAttribute.Fog, 0.13f, 0.13f, 0.13f, 1f));
    environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.position.set(30f, 10f, 30f);
    cam.lookAt(0, 0, 0);
    cam.near = 0.1f;
    cam.far = 45f;
    cam.update();

    ModelBuilder modelBuilder = new ModelBuilder();
    model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position
        | Usage.Normal);
    instance = new ModelInstance(model);

    Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
}
项目:libgdxcn    文件:Basic3DTest.java   
@Override
    public void create () {
        modelBatch = new ModelBatch(new DefaultShaderProvider());
// modelBatch = new ModelBatch();
        environment = new Environment();
        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f));
        environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

        cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        cam.position.set(10f, 10f, 10f);
        cam.lookAt(0, 0, 0);
        cam.near = 0.1f;
        cam.far = 300f;
        cam.update();

        ModelBuilder modelBuilder = new ModelBuilder();
        model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position
            | Usage.Normal);
        instance = new ModelInstance(model);

// model = new G3dModelLoader(new UBJsonReader()).loadModel(Gdx.files.internal("data/g3d/knight.g3db"));
// instance = new ModelInstance(model);

        Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
    }
项目:SaveUA    文件:ScrollMap.java   
/**
 *
 * @param tileMap ширина, высота и размер тайла берется из первого слоя:
 * TiledMapTileLayer bg = (TiledMapTileLayer) tileMap.getLayers().get(0);
 * cellSize = (int) bg.getTileHeight(); mapW = bg.getWidth(); mapH =
 * bg.getHeight();
 */
public ScrollMap(TiledMap tileMap) {
    mapCamera = new OrthographicCamera();
    mapRenderer = new OrthogonalTiledMapRenderer(tileMap, 1f/* / cellSize */);
    stageViewport = new ScreenViewport(new OrthographicCamera());
    TiledMapTileLayer bg = (TiledMapTileLayer) tileMap.getLayers().get(0);
    cellSize = (int) bg.getTileHeight();
    mapW = bg.getWidth() * cellSize;
    mapH = bg.getHeight() * cellSize;
    mapHolder = new Actor();
    mapHolder.setSize(mapW, mapH);
    scrollPane = new ScrollPane(mapHolder);
    scrollPane.setOverscroll(false, false);
    root = new Table();
    root.setFillParent(true);
    root.add(scrollPane).fill().expand();
    stage = new Stage(stageViewport);
    stage.addActor(root);
    im = new InputMultiplexer();
    gameBatch = mapRenderer.getSpriteBatch();
    sprites = new Array<Sprite>();
    gestureDetector = new GestureDetector(gestureListener);
}
项目:SaveUA    文件:SettingsScreen.java   
@Override
public void show() {
    InputMultiplexer im = new InputMultiplexer(stage);
    im.addProcessor(new HardInputProcessor() {
        @Override
        public boolean keyUp(int keycode) {
            if (keycode == Keys.BACKSPACE || keycode == Keys.BACK) {
                dispose();
                manager.showMenu();
            }
            return false;
        }
    });
    Gdx.input.setInputProcessor(im);
    Gdx.input.setCatchBackKey(true);
}
项目:sokobug    文件:CreditsScreen.java   
public CreditsScreen(Sokobug myGame) {
    game = myGame;
    stage = new Stage(game.viewport);
    multiplexer = new InputMultiplexer();

    font32 = game.assetManager.get(Resources.FONTS_JAPONESA32.getPath(), BitmapFont.class);
    font60 = game.assetManager.get(Resources.FONTS_JAPONESA60.getPath(), BitmapFont.class);

    background = new Sprite(game.assetManager.get(Resources.BACKGROUNDS_POTATOES.getPath(), Texture.class));
    background.setPosition(0, 0);

    backToMenu = new MenuButton(game, "", MenuButton.Type.BACKTOMENU, game.assetManager.get(
            Resources.UI_BUTTONS_JSON.getPath(), Skin.class), "menu-back");
    backToMenu.setPosition(0, 0);

    sound = new MenuButton(game, "", MenuButton.Type.SOUNDONOFF, game.assetManager.get(
            Resources.UI_BUTTONS_JSON.getPath(), Skin.class), "soundOn");
    sound.setPosition(game.VIRTUAL_WIDTH - sound.getWidth() * 3.f / 2.f, game.VIRTUAL_HEIGHT - sound.getHeight()
            * 3.f / 2.f);

    stage.addActor(backToMenu);
    stage.addActor(sound);

    multiplexer.addProcessor(stage);
    multiplexer.addProcessor(this);
}
项目:DungeonCrawler    文件:GameScreen.java   
public GameScreen() {
    DungeonGenerator dungeonGenerator = DungeonGeneratorFactory.getDungeonGenerator(1);
    Dungeon dungeon = dungeonGenerator.generateDungeon();
    Dungeon.setActiveDungeon(dungeon);
    GameInputHandler gameInputHandler = new GameInputHandler();
    PlayerCharacterEntity player = PlayerCharacterEntity.getInstance();
    player.placeCharacterIn(dungeon);
    player.respawn();
    PlayerInputHandler playerInputHandler = new PlayerInputHandler(PlayerCharacterEntity.getInstance());

    camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.zoom = 0.5f;

    batch = new SpriteBatch();

    ui = new UserInterface();

    inputMultiplexer = new InputMultiplexer();
    inputMultiplexer.addProcessor(playerInputHandler);
    inputMultiplexer.addProcessor(ui.getInputProcessor());
    inputMultiplexer.addProcessor(gameInputHandler);
}
项目:bladecoder-adventure-engine    文件:DefaultSceneScreen.java   
@Override
public void show() {

    final InputMultiplexer multiplexer = new InputMultiplexer();
    multiplexer.addProcessor(stage);
    multiplexer.addProcessor(inputProcessor);
    Gdx.input.setInputProcessor(multiplexer);

    if (World.getInstance().isDisposed()) {
        try {
            World.getInstance().load();
        } catch (Exception e) {
            EngineLogger.error("ERROR LOADING GAME", e);

            dispose();
            Gdx.app.exit();
        }
    }

    World.getInstance().resume();
}