public ScreenExtensions(GameManager gameManager) { this.gameManager = gameManager; manager = ManagerAssets.getInstance(); addExtensions = this; camera = new PerspectiveCamera(40, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.position.set(0, 0, Gdx.graphics.getHeight() * 0.183f);//initial 180 camera.lookAt(0, 0, 0); camera.far = 2500; camera.near = 1; camera.update(); controller = new CameraInputController(camera); cam = new OrthographicCamera(); batchsprite = new SpriteBatch(); renderer = new ImmediateModeRenderer20(false, true, 1); gd = new GestureDetector(this); }
@Override public void show() { SequenceAction sq = new SequenceAction( Actions.alpha(0), Actions.fadeIn(.5f) ); addAction(sq); renderList.clear(); controller.reset(); cameraMode = CameraMode.fixed; inputMultiplexer = new InputMultiplexer(); inputMultiplexer.addProcessor(new GestureDetector(this)); inputMultiplexer.addProcessor(hud.stage); inputMultiplexer.addProcessor(this); hud.setVisible(true); Gdx.input.setInputProcessor(inputMultiplexer); }
@Override public void show() { this.box2DDebugRenderer = new Box2DDebugRenderer(true, true, false, true, false, true); this.camera = new OrthographicCamera(level.getWidth(), level.getWidth() * camera.viewportHeight / camera.viewportWidth); this.particlesStage.getViewport().setCamera(camera); this.bordersStage.getViewport().setCamera(camera); this.othersStage.getViewport().setCamera(camera); this.startColor = this.particlesStage.getBatch().getColor(); this.xMin = level.getXMin(); this.xMax = level.getXMax(); this.yMin = level.getYMin(); this.yMax = level.getYMax(); Graphics.setCurrentCamera(camera); this.box2DDebugRenderer.SHAPE_AWAKE.set(0, 0, 0, 0.5f); GDXGameGP.currentGame.inputMultiplexer.addProcessor(this); GDXGameGP.currentGame.inputMultiplexer.addProcessor(new GestureDetector(this)); }
@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); }
@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); }
/** * * @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); }
@Override public void create() { camera = new OrthographicCamera(1280, 720); worldBatch = new SpriteBatch(); worldTexture = new Texture(Gdx.files.internal("sc_map.png")); worldTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); worldSprite = new Sprite(worldTexture); worldSprite.setOrigin(0,0); worldSprite.setPosition(-worldSprite.getWidth()/2,-worldSprite.getHeight()/2); uiBatch = new SpriteBatch(); uiTexture = new Texture(Gdx.files.internal("link.png")); uiSprite = new Sprite(uiTexture); uiSprite.setOrigin(0,0); uiSprite.setPosition(0,0); mMap = new Map(100,100,20); mMap.generate(); Gdx.input.setInputProcessor(new GestureDetector(new InputHandler(camera))); }
public Universe() { addedParticle = true; panning = true; particles = new Array<Particle>(); sr = new ShapeRenderer(); touchPos = new Vector3(); initPos = new Vector3(); ctouchPos = new Vector3(); cinitPos = new Vector3(); protoParticle = (new Particle()).radius(minRadius); camera = new OrthographicCamera(); controller = new CameraController(); gestureDetector = new GestureDetector(20, 0.5f, 0.5f, 0.15f, controller); bottomBar = new Rectangle(); settings = new Settings(); resize(); }
@Override public void show() { //add Listener Gdx.input.setInputProcessor(new InputMultiplexer(new InputProcMainScr(), new GestureDetector(new GestureHandlerMainScr()))); //load Resource -- Music; res.LoadMusic("menu","THlib/music/menu.mp3"); audio.PlayMusic("menu", 0.1); //load Resource -- Image; res.LoadImageFromFile("bk_main", "THlib/ui/main_back/menu_bg_2.png"); //load Resource -- Font; res.LoadFont("menu_font", "THlib/ui/font/segoe.fnt"); res.LoadFont("menu_fontRED", "THlib/ui/font/segoeRED.fnt"); //assign data beginLocY = 600; scene = 0; mouseOpt = -1; recOrder = -1; recScene = -1; mainData = new MainData(); }
@Override public void create() { float w = Gdx.graphics.getWidth(); float h = Gdx.graphics.getHeight(); camera = new OrthographicCamera(1, h/w); batch = new SpriteBatch(); texture = new Texture(Gdx.files.internal("data/libgdx.png")); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); TextureRegion region = new TextureRegion(texture, 0, 0, 512, 275); sprite = new Sprite(region); sprite.setSize(0.9f, 0.9f * sprite.getHeight() / sprite.getWidth()); sprite.setOrigin(sprite.getWidth()/2, sprite.getHeight()/2); sprite.setPosition(-sprite.getWidth()/2, -sprite.getHeight()/2); cameraMover = new CameraMover(camera); gestureHandler = new GestureHandler(camera); Gdx.input.setInputProcessor(new GestureDetector(gestureHandler)); }
@Override public void show() { CameraGroupStrategy cameraGroupStrategy = new CameraGroupStrategy(camera); decalBatch = new DecalBatch(cameraGroupStrategy); stagefordialog = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())); stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight())) { @Override public boolean keyDown(int keyCode) { if (keyCode == Input.Keys.BACK) { if (InformationProfile.getInstance().getDateUserGame().getEnklaveCombatId() == -1) gameManager.setScreen(gameManager.screenEnklave); else dialogExit("You can't out from combat!"); } return super.keyDown(keyCode); } }; drawtopcombat(); drawmap(); drawdefenders(); drawAttachers(); addBtnStartCombat(); combatFight = new CombatFitght(this, WIDTH * 0.6f); addcomponenttostage(); progressBarEnergy.FadeIn(); Gdx.input.setCatchBackKey(true); InputMultiplexer inputmulti = new InputMultiplexer(); GestureDetector gd = new GestureDetector(this); inputmulti.addProcessor(stage); inputmulti.addProcessor(gd); inputmulti.addProcessor(this); Gdx.input.setInputProcessor(inputmulti); }
public void setcontrollerMap(boolean onlystage){ if(!onlystage){ InputMultiplexer inputmulti = new InputMultiplexer(); GestureDetector gd = new GestureDetector(this); inputmulti.addProcessor(gd); inputmulti.addProcessor(this); inputmulti.addProcessor(stage); Gdx.input.setInputProcessor(inputmulti); }else{ Gdx.input.setInputProcessor(stage); } }
private void setMultiplexer() { behavior = new LevelSelectGesture(this); detector = new GestureDetector(behavior); InputMultiplexer inputMultiplexer = new InputMultiplexer(); inputMultiplexer.addProcessor(getStage()); inputMultiplexer.addProcessor(detector); Gdx.input.setInputProcessor(inputMultiplexer); }
private void setMultiplexer() { behavior = new PlayScreenGestureBehavior(this); detector = new GestureDetector(behavior); InputMultiplexer inputMultiplexer = new InputMultiplexer(); inputMultiplexer.addProcessor(getStage()); inputMultiplexer.addProcessor(detector); Gdx.input.setInputProcessor(inputMultiplexer); }
public GameplayScreen(ScreenManager manager, int lvl) { super(manager); audio = AudioManager.getInstance(); audio.setNewState(State.IDLE); this.lvl = lvl; switch (lvl) { case 0: world = new World("levels/testMap.tmx"); audio.playRandomGameLowLoop(); break; case 1: world = new World("levels/level_1.tmx"); audio.playRandomGameLowLoop(); break; case 2: world = new World("levels/level_2.tmx"); audio.playRandomGameLowLoop(); break; case 100: world = new World("levels/oneBunnyLevel.tmx"); } world.level = lvl; renderer = new WorldRenderer(world); audio = AudioManager.getInstance(); world.setRenderer(renderer); world.setAudio(audio); world.setManager(manager); initGestures(); Gdx.input.setInputProcessor(new GestureDetector(new at.ggjg.evg.gestures.SequenceGestureListener(world, sequenceHolder, Gdx.graphics.getHeight(), Gdx.graphics.getWidth()))); }
@Override public void create () { r = new Random(); camera = new OrthographicCamera(1080, 1920); batch = new SpriteBatch(); BGImg = new Texture[8]; vegitation = new Sprite[20]; for(int i = 0; i < BGImg.length; i++) { BGImg[i] = new Texture("Background.png"); } compassFactor = (WORLD_WIDTH + BGImg[0].getWidth()) / 360 ; for(int i = 0; i < vegitation.length; i++){ if(i % 2 == 0){ vegitation[i] = new Sprite(new Texture("kelpo no. 1.gif")); vegitation[i].setPosition(r.nextFloat() * WORLD_WIDTH, r.nextFloat() * WORLD_HEIGHT / 4 - WORLD_HEIGHT / 2); vegitation[i].scale(7); } else { vegitation[i] = new Sprite(new Texture("kelpono.2.gif")); vegitation[i].setPosition(r.nextFloat() * WORLD_WIDTH, r.nextFloat() * WORLD_HEIGHT / 4 - WORLD_HEIGHT / 2); vegitation[i].scale(7); } } Gdx.input.setInputProcessor(new GestureDetector(this)); keySprite = new Sprite(new Texture("key.gif")); keySprite.scale((float) 5); chestSprite = new Sprite(new Texture("treasurechest.gif")); chestSprite.scale((float) 7); NPCSprite = new Sprite(new Texture("Mermaid.png")); NPCSprite.scale((float) 5); monsterSprite = new Sprite(new Texture("monsterone.png")); key = new Key(keySprite.getRegionWidth(), keySprite.getRegionHeight()); chest = new Chest(chestSprite.getRegionWidth(), chestSprite.getRegionHeight()); friend = new NPC(NPCSprite.getRegionWidth(), NPCSprite.getRegionHeight()); monster = new Monster(monsterSprite.getRegionWidth(), monsterSprite.getRegionHeight(), key, chest); }
private void createMapInputHandler() { GestureDetector gestureDetector = new GestureDetector(new GestureHandlerImpl(map)); MapMotionHandler motionHandler = new MapMotionHandler(map, mapStateButton); MapInputHandler inputHandler = new MapInputHandler(map, mapStateButton); mapInputHandler = new InputMultiplexer(); mapInputHandler.addProcessor(gestureDetector); mapInputHandler.addProcessor(motionHandler); mapInputHandler.addProcessor(inputHandler); }
@Override public void create() { mCurrentScreen = new MainScreen(mSystemSelectedCallback, mLastCamPosition); if (mMapData != null) { mCurrentScreen.setMapData(mMapData); // don't keep unnecessary references mMapData = null; } setScreen(mCurrentScreen); mGestureDetector = new GestureDetector(this); Gdx.input.setInputProcessor(mGestureDetector); }
@Override public void show() { engine = GameManager.initEngine(); createWorld(256, 256);; multiplexer = engine.getSystem(InputSystem.class).getMultiplexer(); multiplexer.addProcessor(engine.getSystem(GUISystem.class).getStage()); multiplexer.addProcessor(new GestureDetector( new DesktopGestureListener(engine))); if (GameConfig.build == BUILD.DEV) { multiplexer.addProcessor(new DeveloperInputProcessor()); } }
private void create() { batch = new SpriteBatch(); font = AssetManager.loadFont( "Sprites/Unpacked/font.ttf", 12, new Color( 1f, 0.9f, 0.8f, 1 ), 1, Color.BLACK, false ); hightlightfont = AssetManager.loadFont( "Sprites/Unpacked/font.ttf", 12, new Color( 1f, 1f, 0.9f, 1 ), 1, Color.BLACK, false ); blank = AssetManager.loadTextureRegion( "Sprites/blank.png" ); white = AssetManager.loadTextureRegion( "Sprites/white.png" ); bag = AssetManager.loadSprite( "Oryx/uf_split/uf_items/satchel" ); bag.drawActualSize = true; border = AssetManager.loadSprite( "GUI/frame" ); speechBubbleArrow = AssetManager.loadTextureRegion( "Sprites/GUI/SpeechBubbleArrow.png" ); speechBubbleBackground = new NinePatch( AssetManager.loadTextureRegion( "Sprites/GUI/SpeechBubble.png" ), 10, 10, 10, 10 ); fogSprite = new TilingSprite( "fog", "Masks/fog", "Masks/fog" ); gestureDetector = new GestureDetector( this ); gestureDetector.setLongPressSeconds( 0.5f ); inputMultiplexer = new InputMultiplexer(); LoadUI(); InputProcessor inputProcessorOne = this; InputProcessor inputProcessorTwo = stage; inputMultiplexer.addProcessor( inputProcessorTwo ); inputMultiplexer.addProcessor( gestureDetector ); inputMultiplexer.addProcessor( inputProcessorOne ); }
@Override public void create () { inputMultiplexer=new InputMultiplexer(); inputMultiplexer.addProcessor(new GestureDetector(this)); inputMultiplexer.addProcessor(this); Gdx.input.setInputProcessor(inputMultiplexer); this.mapScreen=new MapScreen(); this.interfaceScreen=new InterfaceScreen(); this.mapScreen.show(); this.interfaceScreen.show(); }
@Override public void create() { super.create(); /** * Overwrite input handler, using own GdxMap.create() method didn't work :-( */ final InputMultiplexer mux = new InputMultiplexer(); if (!Parameters.MAP_EVENT_LAYER2) { mGestureDetector = new GestureDetector(new GestureHandlerImpl(mMap)); mux.addProcessor(mGestureDetector); } mux.addProcessor(new InputHandlerMT(this)); mux.addProcessor(new MotionHandler(mMap)); Gdx.input.setInputProcessor(mux); mMap.events.bind(new UpdateListener() { @Override public void onMapEvent(final Event e, final MapPosition mapPosition) { _map25View.fireSyncMapEvent(mapPosition, 0); } }); }
public InputManager(OrthographicCamera camera) { commandQueue = new LinkedList<Command>(); gesture = new GestureDetector(new GestureDetectorController(camera, this)); zoomInputProcessor = new ZoomInputProcessor(camera); manager = new InputMultiplexer(gesture, zoomInputProcessor); Gdx.input.setInputProcessor(manager); }
@Override public void create () { texture = new Texture("data/stones.jpg"); batch = new SpriteBatch(); camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); controller = new CameraController(); gestureDetector = new GestureDetector(20, 0.5f, 2, 0.15f, controller); Gdx.input.setInputProcessor(gestureDetector); }
@Override public void create () { if (this.app == null) { this.app = Gdx.app; Box2DTest test = tests[testIndex]; test.create(); } InputMultiplexer multiplexer = new InputMultiplexer(); multiplexer.addProcessor(this); multiplexer.addProcessor(new GestureDetector(this)); Gdx.input.setInputProcessor(multiplexer); }
/** * Setzt den Input-Prozessor der auf Berührungen des Screens reagiert. */ public void setInputProcessor() { listener = new GestureDetector(new GameInputListener( (IGameObjectLogicFuerGameInputListener) logic, (IGameFieldFuerGameInputListener) gameField)); inputMultiplexer = new InputMultiplexer(); inputMultiplexer.addProcessor(Gdx.input.getInputProcessor()); inputMultiplexer.addProcessor(new StageGestureDetector(gameField .getStage(), true, ControlMode.HORIZONTAL)); inputMultiplexer.addProcessor(listener); Gdx.input.setInputProcessor(inputMultiplexer); }
@Override public void initialize() { initInstructions(); initControls(); gestureDetector = new GestureDetector(new InstructionsGestureListener(this)); }
@Override public void initialize() { Sprite background = game.graphicsService.getSprite( Assets.GraphicFiles.ATLAS_BACKGROUNDS, Assets.Backgrounds.MENU); setBackgroundImage(new Image(background)); Table table = new Table(); table.setFillParent(true); LabelStyle titleStyle = new LabelStyle(); titleStyle.font = game.graphicsService.getFont(game.deviceSettings.rulesTitleFont); titleStyle.fontColor = Constants.ScreenConstants.TEXT_COLOR; LabelStyle style = new LabelStyle(); style.font = game.graphicsService.getFont(game.deviceSettings.rulesFont); style.fontColor = Constants.ScreenConstants.TEXT_COLOR; createInfo(table, titleStyle, style); createCredit(table, titleStyle, style); createRules(table, titleStyle, style); if (Constants.GameConstants.DEBUG) { table.debug(); } stage.addActor(table); initControls(); gestureDetector = new GestureDetector(new ChangeScreenGestureListener(this)); }
@Override public void create() { mapManager = new MapManager(new MapQuestTileFactoryInfo(), null, new MemoryCache(), 512, 512, 0, 0); listener = new MapListener(mapManager); Gdx.input.setInputProcessor(new InputMultiplexer(new GestureDetector(this))); // Tile maps updatePin(); pin = new Texture(Gdx.files.internal("assets/pin.png")); batch = new SpriteBatch(); camera = mapManager.getCamera(); }
@Override public boolean keyDown(int keycode) { boolean value = false; for (GestureDetector detector : detectors) { if (detector.keyDown(keycode)) { value = true; } } return value; }
@Override public boolean keyUp(int keycode) { boolean value = false; for (GestureDetector detector : detectors) { if (detector.keyUp(keycode)) { value = true; } } return value; }
@Override public boolean keyTyped(char character) { boolean value = false; for (GestureDetector detector : detectors) { if (detector.keyTyped(character)) { value = true; } } return value; }
@Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { boolean value = false; for (GestureDetector detector : detectors) { if (detector.touchDown(screenX, screenY, pointer, button)) { value = true; } } return value; }
@Override public boolean touchUp(int screenX, int screenY, int pointer, int button) { boolean value = false; for (GestureDetector detector : detectors) { if (detector.touchUp(screenX, screenY, pointer, button)) { value = true; } } return value; }
@Override public boolean touchDragged(int screenX, int screenY, int pointer) { boolean value = false; for (GestureDetector detector : detectors) { if (detector.touchDragged(screenX, screenY, pointer)) { value = true; } } return value; }
@Override public boolean mouseMoved(int screenX, int screenY) { boolean value = false; for (GestureDetector detector : detectors) { if (detector.mouseMoved(screenX, screenY)) { value = true; } } return value; }
@Override public boolean scrolled(int amount) { boolean value = false; for (GestureDetector detector : detectors) { if (detector.scrolled(amount)) { value = true; } } return value; }
@Override public void create() { camera = new OrthographicCamera(); camera.setToOrtho(false, 640, 640); batch = new SpriteBatch(); coveredTexture = new Texture(Gdx.files.internal("covered.png")); blankTexture = new Texture(Gdx.files.internal("blank.png")); flagQuestionTexture = new Texture( Gdx.files.internal("flag_question.png")); flagTexture = new Texture(Gdx.files.internal("flag.png")); mineTexture = new Texture(Gdx.files.internal("mine.png")); bangTexture = new Texture(Gdx.files.internal("bang.png")); oneTexture = new Texture(Gdx.files.internal("one.png")); twoTexture = new Texture(Gdx.files.internal("two.png")); threeTexture = new Texture(Gdx.files.internal("three.png")); shapeRenderer = new ShapeRenderer(); tiles = new HashMap<Integer, Rectangle>(); tileGrid = new int[10][10]; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { initTiles(i, j); } } mineGrid = generateMines(10, 10, 12); MyGestureListener mgl = new MyGestureListener(); mgl.setGame(this); GestureDetector gd = new GestureDetector(mgl); Gdx.input.setInputProcessor(gd); }
public void changeScene(AbstractScene scene) { if (activeScene != null) activeScene.dispose(); activeScene = scene; InputMultiplexer multiplexer = new InputMultiplexer(); multiplexer.addProcessor(new GestureDetector(activeScene)); multiplexer.addProcessor(activeScene); Gdx.input.setInputProcessor(multiplexer); }