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


Java XInputNotLoadedException類代碼示例

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


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

示例1: init

import com.ivan.xinput.exceptions.XInputNotLoadedException; //導入依賴的package包/類
@Override
public void init() throws XInputNotLoadedException
{
	this.device = XInputDevice.getDeviceFor(0);
	this.device.addListener(new XInputDeviceListener()
	{
		@Override
		public void disconnected()
		{
			// do nothing
		}

		@Override
		public void connected()
		{
			// do nothing
		}

		@Override
		public void buttonChanged(XInputButton arg0, boolean arg1)
		{
			MainDialog.resetActivityTimer(XBOX_CONTROLLER);
		}
	});
}
 
開發者ID:PolyphasicDevTeam,項目名稱:NoMoreOversleeps,代碼行數:26,代碼來源:IntegrationXboxController.java

示例2: findFirstConnectedXInputDevice

import com.ivan.xinput.exceptions.XInputNotLoadedException; //導入依賴的package包/類
/**
 * Returns a player number for the first connected XInput device or {@code -1} if nothing connected
 * @return the player number or {@code -1}
 */
private static int findFirstConnectedXInputDevice() {
	int firstConnectedDevice = -1;
	try {
		for (int i = 0; i < XInputDevice.getAllDevices().length; i++) {
			XInputDevice device = XInputDevice.getDeviceFor(i);
			device.poll();
			if (device.isConnected()) {
				firstConnectedDevice = i;
				break;
			}
		}
	} catch (XInputNotLoadedException e) {
		e.printStackTrace();
	}
	return firstConnectedDevice;
}
 
開發者ID:n0Live,項目名稱:BrickGame,代碼行數:21,代碼來源:Window.java

示例3: init

import com.ivan.xinput.exceptions.XInputNotLoadedException; //導入依賴的package包/類
@Override
public void init() throws XInputNotLoadedException
{
	File directory = new File(PlatformData.installationDirectory, "out");
	directory.mkdirs();
	scheduleNameFile = new File(directory, "scheduleName");
	scheduleStartedOnFile = new File(directory, "scheduleStartedOn");
	scheduleLastOversleepFile = new File(directory, "scheduleLastOversleep");
	schedulePersonalBestFile = new File(directory, "schedulePersonalBest");
	timeToNextSleepBlockFile = new File(directory, "timeToNextSleepBlock");
}
 
開發者ID:PolyphasicDevTeam,項目名稱:NoMoreOversleeps,代碼行數:12,代碼來源:IntegrationFileWriter.java

示例4: XInputDevicePolling

import com.ivan.xinput.exceptions.XInputNotLoadedException; //導入依賴的package包/類
XInputDevicePolling(final int playerNum, final XInputListener listener)
		throws XInputNotLoadedException {
	this.listener = listener;
	this.device = XInputDevice.getDeviceFor(playerNum);
	device.removeListener(listener);
	device.addListener(listener);
}
 
開發者ID:n0Live,項目名稱:BrickGame,代碼行數:8,代碼來源:Window.java

示例5: setXInputListener

import com.ivan.xinput.exceptions.XInputNotLoadedException; //導入依賴的package包/類
/**
 * Gets the XInput device for the specified player and sets an event
 * listener for it.
 * 
 * @param playerNum
 *            the player number
 * @param listener
 *            the event listener
 */
static void setXInputListener(final int playerNum,
		final XInputListener listener) {
	try {
		xInputPolling.execute(new XInputDevicePolling(playerNum, listener));
	} catch (XInputNotLoadedException e) {
		System.err.println("The XInput native library failed to load");
		e.printStackTrace();
	}
}
 
開發者ID:n0Live,項目名稱:BrickGame,代碼行數:19,代碼來源:Window.java

示例6: checkLibraryReady

import com.ivan.xinput.exceptions.XInputNotLoadedException; //導入依賴的package包/類
/**
 * Checks if the native library is loaded and ready for use.
 *
 * @throws XInputNotLoadedException if the native library is not loaded
 */
private static void checkLibraryReady() throws XInputNotLoadedException {
    if (!XInputNatives14.isLoaded()) {
        throw new XInputNotLoadedException("Native library failed to load", XInputNatives14.getLoadError());
    }
}
 
開發者ID:StrikerX3,項目名稱:JXInput,代碼行數:11,代碼來源:XInputDevice14.java

示例7: checkLibraryReady

import com.ivan.xinput.exceptions.XInputNotLoadedException; //導入依賴的package包/類
/**
 * Checks if the native library is loaded and ready for use.
 *
 * @throws XInputNotLoadedException if the native library is not loaded
 */
private static void checkLibraryReady() throws XInputNotLoadedException {
    if (!XInputNatives.isLoaded()) {
        throw new XInputNotLoadedException("Native library failed to load", XInputNatives.getLoadError());
    }
}
 
開發者ID:StrikerX3,項目名稱:JXInput,代碼行數:11,代碼來源:XInputDevice.java

示例8: getDeviceFor

import com.ivan.xinput.exceptions.XInputNotLoadedException; //導入依賴的package包/類
/**
 * Returns the XInput device for the specified player.
 * <p>
 * The returned object should not be shared among multiple threads.
 *
 * @param playerNum the player number
 * @return the XInput device for the specified player
 * @throws XInputNotLoadedException if the native library failed to load
 */
public static XInputDevice14 getDeviceFor(final int playerNum) throws XInputNotLoadedException {
    checkLibraryReady();
    if (playerNum < 0 || playerNum >= MAX_PLAYERS) {
        throw new IllegalArgumentException("Invalid player number: " + playerNum + ". Must be between 0 and " + (MAX_PLAYERS - 1));
    }
    return DEVICES[playerNum];
}
 
開發者ID:StrikerX3,項目名稱:JXInput,代碼行數:17,代碼來源:XInputDevice14.java

示例9: getDeviceFor

import com.ivan.xinput.exceptions.XInputNotLoadedException; //導入依賴的package包/類
/**
 * Returns the XInput device for the specified player. An instance is created for each of the four players in a system.
 * <p>
 * The returned object should not be shared among multiple threads.
 *
 * @param playerNum the player number
 * @return the XInput device for the specified player
 * @throws XInputNotLoadedException if the native library failed to load
 */
public static XInputDevice getDeviceFor(final int playerNum) throws XInputNotLoadedException {
    checkLibraryReady();
    if (playerNum < 0 || playerNum >= MAX_PLAYERS) {
        throw new IllegalArgumentException("Invalid player number: " + playerNum + ". Must be between 0 and " + (MAX_PLAYERS - 1));
    }
    return DEVICES[playerNum];
}
 
開發者ID:StrikerX3,項目名稱:JXInput,代碼行數:17,代碼來源:XInputDevice.java

示例10: getAllDevices

import com.ivan.xinput.exceptions.XInputNotLoadedException; //導入依賴的package包/類
/**
 * Returns an array containing all registered XInput devices.
 * <p>
 * The XInputDevice14 objects are not thread-safe.
 *
 * @return all XInput devices
 * @throws XInputNotLoadedException if the native library failed to load
 */
public static XInputDevice14[] getAllDevices() throws XInputNotLoadedException {
    checkLibraryReady();
    return DEVICES.clone();
}
 
開發者ID:StrikerX3,項目名稱:JXInput,代碼行數:13,代碼來源:XInputDevice14.java

示例11: getAllDevices

import com.ivan.xinput.exceptions.XInputNotLoadedException; //導入依賴的package包/類
/**
 * Returns an array containing all registered XInput devices.
 * <p>
 * The {@code XInputDevice} objects are not thread-safe.
 *
 * @return all XInput devices
 * @throws XInputNotLoadedException if the native library failed to load
 */
public static XInputDevice[] getAllDevices() throws XInputNotLoadedException {
    checkLibraryReady();
    return DEVICES.clone();
}
 
開發者ID:StrikerX3,項目名稱:JXInput,代碼行數:13,代碼來源:XInputDevice.java


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