當前位置: 首頁>>代碼示例>>Java>>正文


Java GestureDetector類代碼示例

本文整理匯總了Java中com.badlogic.gdx.input.GestureDetector的典型用法代碼示例。如果您正苦於以下問題:Java GestureDetector類的具體用法?Java GestureDetector怎麽用?Java GestureDetector使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GestureDetector類屬於com.badlogic.gdx.input包,在下文中一共展示了GestureDetector類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ScreenExtensions

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
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);
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:18,代碼來源:ScreenExtensions.java

示例2: show

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
@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);
}
 
開發者ID:CTrando,項目名稱:pmd,代碼行數:21,代碼來源:DungeonScreen.java

示例3: show

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
@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));
}
 
開發者ID:delphikettle,項目名稱:libgdxGP,代碼行數:19,代碼來源:LevelScreen.java

示例4: create

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
@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);
}
 
開發者ID:Matsemann,項目名稱:eamaster,代碼行數:26,代碼來源:BulletTestCollection.java

示例5: create

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
@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);
}
 
開發者ID:h-victor,項目名稱:elin-game,代碼行數:19,代碼來源:ElinApplication.java

示例6: ScrollMap

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
/**
 *
 * @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);
}
 
開發者ID:NaikSoftware,項目名稱:SaveUA,代碼行數:30,代碼來源:ScrollMap.java

示例7: create

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
@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)));
}
 
開發者ID:Nain57,項目名稱:FirstGame,代碼行數:23,代碼來源:MyGame.java

示例8: Universe

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
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();
}
 
開發者ID:KaeruCT,項目名稱:GLXY,代碼行數:22,代碼來源:Universe.java

示例9: show

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
@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();
}
 
開發者ID:tjumyk,項目名稱:touhou-java,代碼行數:26,代碼來源:HomeScreen.java

示例10: create

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
@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));
}
 
開發者ID:Arttuv,項目名稱:louhitemplate,代碼行數:24,代碼來源:Louhitemplate.java

示例11: show

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
@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);
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:34,代碼來源:ScreenCombat.java

示例12: setcontrollerMap

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
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);
    }

}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:14,代碼來源:MapsScreen.java

示例13: setMultiplexer

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
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);
}
 
開發者ID:MartensCedric,項目名稱:Hexpert,代碼行數:10,代碼來源:LevelSelectScreen.java

示例14: setMultiplexer

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
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);
}
 
開發者ID:MartensCedric,項目名稱:Hexpert,代碼行數:10,代碼來源:PlayScreen.java

示例15: GameplayScreen

import com.badlogic.gdx.input.GestureDetector; //導入依賴的package包/類
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())));

}
 
開發者ID:GGJG2016,項目名稱:EvilBunnyGod,代碼行數:33,代碼來源:GameplayScreen.java


注:本文中的com.badlogic.gdx.input.GestureDetector類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。