当前位置: 首页>>代码示例>>Java>>正文


Java Controllers类代码示例

本文整理汇总了Java中com.badlogic.gdx.controllers.Controllers的典型用法代码示例。如果您正苦于以下问题:Java Controllers类的具体用法?Java Controllers怎么用?Java Controllers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Controllers类属于com.badlogic.gdx.controllers包,在下文中一共展示了Controllers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: preLoad

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
public void preLoad()
{
	input = new InputManager(se);
	Controllers.addListener(input);
	
	atlas = new TextureAtlas("main.atlas");
	titleScreenAtlas = new TextureAtlas("titlescreen.atlas");
	menuControlsAtlas = new TextureAtlas("menu.atlas");
	menuFont = new BitmapFont(Gdx.files.internal("data/cgcfont.fnt"), atlas.findRegion("cgcfont"), false);
	titleFont = new BitmapFont(Gdx.files.internal("data/cgctitlefont.fnt"), atlas.findRegion("cgctitlefont"), false);
	sBatch = new SpriteBatch(1625);
	shapes = new ShapeRenderer();
	tManager = new TweenManager();

	FileHandle baseFileHandle = Gdx.files.internal("i18n/CGCLang");
	I18NBundle myBundle = I18NBundle.createBundle(baseFileHandle, locale);

	lang = myBundle;
	ChaseApp.alert("lang loaded");
}
 
开发者ID:ChainGangChase,项目名称:cgc-game,代码行数:21,代码来源:ChaseApp.java

示例2: InputHandlerOld

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
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);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:22,代码来源:InputHandlerOld.java

示例3: dispatchStickInputs

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
private void dispatchStickInputs() {
    Array<Controller> availableControllers = Controllers.getControllers();

    for (int id = 0; id < availableControllers.size; id++) {
        Controller controller = availableControllers.get(id);

        if (controller != null) {
            Array<NhgInput> stickInputs = stickInputsMap.get(id);

            if (stickInputs != null) {
                for (NhgInput input : stickInputs) {
                    if (input != null && isValidInput(input)) {
                        processStickInput(id, controller, input);
                        dispatchStickInput(input);
                    }
                }
            }
        }
    }
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:21,代码来源:InputHandlerOld.java

示例4: unmappedAnalog

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
@Override
protected long unmappedAnalog(int unmappedAnalogNr) {
    Array<com.badlogic.gdx.controllers.Controller> controllers = Controllers.getControllers();
    float axisValue = 0;
    float axisValueAbs = 0;
    float currentAxis;
    float currentAxisAbs;
    for (int i = controllers.size - 1; i >= 0; i--) {
        com.badlogic.gdx.controllers.Controller c = controllers.get(i);
        currentAxis = c.getAxis(unmappedAnalogNr);
        currentAxisAbs = Math.abs(currentAxis);
        //Gdx.app.log("unmappedAnalog","Nr: "+unmappedAnalogNr+" Value: "+currentAxis);
        if (currentAxisAbs > axisValueAbs) { // select biggest absolute value on this axis
            axisValue = currentAxis;
            axisValueAbs = currentAxisAbs;
        }
    }
    if (axisValueAbs >= CONTROLLER_THRESHOLD) {
        return (long) (axisValue * 0x7fffffff);
    }
    return 0; // else
}
 
开发者ID:ulno,项目名称:libni,代码行数:23,代码来源:GdxReceiverMultiplexer.java

示例5: create

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
@Override
public void create () {
	Array<Controller> controllers = Controllers.getControllers();
	if (controllers.size > 0) {
		controller = controllers.first();
	}
	Controllers.addListener(controllerListener);

	setScreen(new MainMenu(this));
	music = Gdx.audio.newMusic(Gdx.files.getFileHandle("data/8.12.mp3", FileType.Internal));
	music.setLooping(true);
	music.play();
	Gdx.input.setInputProcessor(new InputAdapter() {
		@Override
		public boolean keyUp (int keycode) {
			if (keycode == Keys.ENTER && Gdx.app.getType() == ApplicationType.WebGL) {
				Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
			}
			return true;
		}
	});

	fps = new FPSLogger();
}
 
开发者ID:Motsai,项目名称:neblina-libgdx3d,代码行数:25,代码来源:Invaders.java

示例6: create

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
public void create() {
//		Texture.setEnforcePotImages(false);
		MyInputProcessor iP = new MyInputProcessor();
		Gdx.input.setInputProcessor(iP);
		Controllers.addListener(iP);

		res.loadTextures();
		res.loadMusic();
		res.loadScriptList(Gdx.files.internal("assets/scripts"));
		res.loadLevelNames();
		res.loadEventToTexture();

		cam = new Camera();
		cam.setToOrtho(false, width/scale, height/scale);
		hudCam = new OrthographicCamera();
		hudCam.setToOrtho(false, width/2, height/2);
		b2dCam = new Camera();
		b2dCam.setToOrtho(false, width/scale/PPM, height/scale/PPM);
		sb = new FadingSpriteBatch();
		gsm = new GameStateManager(this);
		
        if(Controllers.getControllers().size == 0)
            hasControllers = false;
        else hasControllers = true;
	}
 
开发者ID:JayKEm,项目名称:Aftamath,代码行数:26,代码来源:Game.java

示例7: create

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
@Override
public void create () {
	Array<Controller> controllers = Controllers.getControllers();
	if (controllers.size > 0) {
		controller = controllers.first();
	}
	Controllers.addListener(controllerListener);

	setScreen(new MainMenu(this));
	music = Gdx.audio.newMusic(Gdx.files.getFileHandle("data/8.12.mp3", FileType.Internal));
	music.setLooping(true);
	music.play();
	Gdx.input.setInputProcessor(new InputAdapter() {
		@Override
		public boolean keyUp (int keycode) {
			if (keycode == Keys.ENTER && Gdx.app.getType() == ApplicationType.WebGL) {
				if (!Gdx.graphics.isFullscreen()) Gdx.graphics.setDisplayMode(Gdx.graphics.getDisplayModes()[0]);
			}
			return true;
		}
	});

	fps = new FPSLogger();
}
 
开发者ID:konsoletyper,项目名称:teavm-libgdx,代码行数:25,代码来源:Invaders.java

示例8: create

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
@Override
public void create() {
    Gdx.app.setLogLevel(Application.LOG_DEBUG);
    batch = new SpriteBatch();
    hero = new Hero(screenWidth, screenHeight);
    score = new Score(screenWidth, screenHeight);
    finalScore = new FinalScore(screenWidth, screenHeight);
    bullets = new ArrayList<Bullet>();
    clouds = new ArrayList<Cloud>();
    if (Controllers.getControllers().size > 0) {
        controller = Controllers.getControllers().first();
    }
    websocketHelper = new WebsocketHelper();
    websocketHelper.connectWebSocket();

    camera = new OrthographicCamera();
    camera.setToOrtho(true, screenWidth, screenHeight);

    lastTime = TimeUtils.nanoTime();
    lastTimeSpawnedCloud = lastTime;
}
 
开发者ID:futurice,项目名称:sanko-game,代码行数:22,代码来源:CloudsGame.java

示例9: exit

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
@Override
public void exit() {
    Console console = app.getConsole();
    
    console.removeCommand("disconnect");        
    console.removeCommand("say");                
    console.removeCommand("team_say");        
    console.removeCommand("change_team");
    console.removeCommand("rcon");
    console.removeCommand("ai");
    
    Controllers.removeListener(this.controllerInput);
    
    this.dialog.destroy();
    this.sayTxtBx.destroy();
    this.teamSayTxtBx.destroy();
}
 
开发者ID:tonysparks,项目名称:seventh,代码行数:18,代码来源:InGameScreen.java

示例10: createNinjaRabbit

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
/**
 * Creates a new instance of {@link NinjaRabbit}, defining its graphical, audio and physical
 * properties.
 *
 * @param world
 *            The Box2D {@link World} onto which to create the {@link Body} and {@link Fixture}
 *            of the {@link Entity}.
 * @param loader
 *            A {@link BodyEditorLoader} to handle creation of the Entity body and fixtures.
 * @param assets
 *            The {@link AssetManager} from where to extract the graphical and audio resources.
 *            Those resources should be loaded in the manager before calling this method and
 *            won't be disposed.
 * @param status
 *            A reference to the global status of the player to be updated from the changes in
 *            the returned entity inner state.
 * @param observers
 *            An array of event receivers. Events will fire when the active player status
 *            changes (such as losing lives, collecting items, etc.).
 * @return A ready to use instance of a new {@link NinjaRabbit}.
 */
public static Entity createNinjaRabbit(final World world, final BodyEditorLoader loader, final AssetManager assets,
		final CurrentPlayerStatus status, final PlayerStatusObserver... observers) {
	PhysicsProcessor physics = new NinjaRabbitPhysicsProcessor();
	CONTACT_LISTENER.add(physics);
	world.setContactListener(CONTACT_LISTENER);
	GraphicsProcessor graphics = new NinjaRabbitGraphicsProcessor(assets);
	BodyProcessor bodyProcessor = new NinjaRabbitBodyProcessor(world, loader);
	AudioProcessor audio = new NinjaRabbitAudioProcessor(assets);
	PlayerStatusProcessor player = new NinjaRabbitPlayerStatusProcessor(status);
	if (observers != null) {
		for (PlayerStatusObserver o : observers) {
			player.addObserver(o);
		}
	}
	NinjaRabbit ninjaRabbit = new NinjaRabbit(player, bodyProcessor, graphics, physics, audio);

	if (Ouya.isRunningOnOuya()) {
		Controllers.clearListeners();
		Controllers.addListener(new NinjaRabbitControllerProcessor(ninjaRabbit));
	} else {
		Gdx.input.setInputProcessor(new NinjaRabbitInputProcessor(ninjaRabbit));
	}
	return ninjaRabbit;
}
 
开发者ID:nfantone,项目名称:ninja-rabbit,代码行数:46,代码来源:EntityFactory.java

示例11: testForBindingController

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
private Controller testForBindingController() {
	for (Controller c : Controllers.getControllers()) {
		for (int i = 0; i < 10; i++) {
			if (c.getButton(i)) {
				return c;
			}
		}
		for (int i = 0; i < 4; i++) {
			if (Math.abs(c.getAxis(i)) > 0.75f) {
				return c;
			}
		}
		if (c.getPov(0) != PovDirection.center)
			return c;
	}
	return null;
}
 
开发者ID:underclocker,项目名称:Blob-Game,代码行数:18,代码来源:MenuView.java

示例12: connected

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
@Override
public void connected(Controller controller) {
	if (controllers.contains(controller, true)) {
		return;
	}

	controller.addListener(this);
	controllers.add(controller);
	if (Controllers.getControllers().contains(controller, true)) {
		controllersAuto.add(controller);
	}

	for (Mapping mapping : mappings) {
		if (mapping.map(controller, this)) {
			break;
		}
	}

	refreshKeymap();
}
 
开发者ID:0x0ade,项目名称:shadow-engine,代码行数:21,代码来源:ControllerHelper.java

示例13: create

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
@Override
public void create () {
	Array<Controller> controllers = Controllers.getControllers();
	if (controllers.size > 0) {
		controller = controllers.first();
	}
	Controllers.addListener(controllerListener);

	setScreen(new MainMenu(this));
	music = Gdx.audio.newMusic(Gdx.files.getFileHandle("data/8.12.mp3", FileType.Internal));
	music.setLooping(true);
	music.play();
	Gdx.input.setInputProcessor(new InputAdapter() {
		@Override
		public boolean keyUp (int keycode) {
			if (keycode == Keys.ENTER && Gdx.app.getType() == ApplicationType.WebGL) {
				if (!Gdx.graphics.isFullscreen()) Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayModes()[0]);
			}
			return true;
		}
	});

	fps = new FPSLogger();
}
 
开发者ID:jadref,项目名称:buffer_bci,代码行数:25,代码来源:Invaders.java

示例14: initialise

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
@Override
public void initialise(GameContainer gc) {
	uiContainer = new UiContainer(gc, assetManager);
	uiContainer.setKeyboardNavigationEnabled(UATApplication.USE_KEYBOARD_NAVIGATION);
	gc.addResizeListener(this);
	initialiseUi();
	
	if(Controllers.getControllers().size > 0) {
		try {
			System.out.println(uiContainer.getId());
			controllerInput = UiUtils.setUpControllerInput(Controllers.getControllers().get(0), uiContainer);
			if(controllerInput != null) {
				controllerInput.disable();
			}
		} catch (ControllerPlatformException e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:mini2Dx,项目名称:mini2Dx,代码行数:20,代码来源:UiUAT.java

示例15: logControllers

import com.badlogic.gdx.controllers.Controllers; //导入依赖的package包/类
private void logControllers() {
    Array<Controller> controllers = Controllers.getControllers();
    Gdx.app.log(getClass().getSimpleName(), "****** Controller Names *********");
    for(Controller controller: controllers) {
        Gdx.app.log(getClass().getSimpleName(), controller.getName());
    }
    Gdx.app.log(getClass().getSimpleName(), "********************************");
}
 
开发者ID:gradualgames,项目名称:ggvm,代码行数:9,代码来源:KeyboardInputProcessor.java


注:本文中的com.badlogic.gdx.controllers.Controllers类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。