本文整理汇总了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);
}
});
}
示例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;
}
示例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");
}
示例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);
}
示例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();
}
}
示例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());
}
}
示例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());
}
}
示例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];
}
示例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];
}
示例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();
}
示例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();
}