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


Java SharedLibraryLoader类代码示例

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


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

示例1: onCreateView

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.setLogLevel(100);

    //initialize platform bitmap factory
    org.oscim.android.canvas.AndroidGraphics.init();

    GdxAssets.init("");
    GLAdapter.init(new AndroidGL());

    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    config.stencil = 8;
    config.numSamples = 2;
    new SharedLibraryLoader().load("vtm-jni");

    View view = initializeForView(new CacheboxMain(), config);

    //initialize platform connector
    PlatformConnector.init(new AndroidPlatformConnector(this));

    return view;
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:25,代码来源:AndroidLauncherfragment.java

示例2: main

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
public static void main (String[] arg) {
	String version = DesktopLauncher.class.getPackage().getSpecificationVersion();
	if (version == null) {
		version = "1.0";
	}
	LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();

	if (SharedLibraryLoader.isMac) {
		config.preferencesDirectory = "Library/Application Support/Pixel Dungeon/";
	} else if (SharedLibraryLoader.isLinux) {
		config.preferencesDirectory = ".watabou/pixel-dungeon/";
	} else if (SharedLibraryLoader.isWindows) {
		config.preferencesDirectory = "Saved Games/Pixel Dungeon/";
	}
	// FIXME: This is a hack to get access to the preferences before we have an application setup
	com.badlogic.gdx.Preferences prefs = new LwjglPreferences(Preferences.FILE_NAME, config.preferencesDirectory);

	boolean isFullscreen = prefs.getBoolean(Preferences.KEY_WINDOW_FULLSCREEN, false);
	config.fullscreen = isFullscreen;
	if (!isFullscreen) {
		config.width = prefs.getInteger(Preferences.KEY_WINDOW_WIDTH, Preferences.DEFAULT_WINDOW_WIDTH);
		config.height = prefs.getInteger(Preferences.KEY_WINDOW_HEIGHT, Preferences.DEFAULT_WINDOW_HEIGHT);
	}

	config.addIcon( "ic_launcher_128.png", Files.FileType.Internal );
	config.addIcon( "ic_launcher_32.png", Files.FileType.Internal );
	config.addIcon( "ic_launcher_16.png", Files.FileType.Internal );

	// TODO: It have to be pulled from build.gradle, but I don't know how it can be done
	config.title = "Pixel Dungeon";

	new LwjglApplication(new PixelDungeon(
			new DesktopSupport(version, config.preferencesDirectory, new DesktopInputProcessor())
	), config);
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:36,代码来源:DesktopLauncher.java

示例3: onInit

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
@Override
protected void onInit() {
    logger.info("initializing physics");
    new SharedLibraryLoader().load("gdx");
    Bullet.init();
    createPhysicsWorld();
    rayTestSolver.setWorld(mainWorld);
}
 
开发者ID:WarpOrganization,项目名称:warp,代码行数:9,代码来源:PhysicsTask.java

示例4: initVtm

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
public static void initVtm() {
    // load native library
    new SharedLibraryLoader().load("vtm-jni");
    // init globals
    AwtGraphics.init();
    GdxAssets.init("assets/");
    GLAdapter.init(new LwjglGL20());
    GLAdapter.GDX_DESKTOP_QUIRKS = true;
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:10,代码来源:TouchLauncher.java

示例5: copyToTempFile

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
@Override
protected File copyToTempFile(String resourcePath) {
    File file = super.copyToTempFile(resourcePath);
    if (file == null) return null;

    if (SharedLibraryLoader.isLinux || SharedLibraryLoader.isMac) {
        try {
            // Change access permission for temp file
            System.out.println("Call \"chmod\" for a temp file");
            Process process = Runtime.getRuntime().exec("chmod +x " + file.getAbsolutePath());

            InputStream is = process.getInputStream();
            BufferedReader br = new BufferedReader(new InputStreamReader(is));
            String line = null;
            while ((line = br.readLine()) != null) {
                System.out.println(line);
            }
            int result = process.waitFor(); // Let the process finish.

            if (result != 0) {
                throw new RuntimeException("\"chmod\" call finished with error");
            }
        } catch (IOException | InterruptedException e) {
            throw new RuntimeException("Error changing file access permission for: " + file.getAbsolutePath(), e);
        }
    }
    return file;
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:29,代码来源:KTXProcessor.java

示例6: load

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
/** Extracts the LWJGL native libraries from the classpath and sets the "org.lwjgl.librarypath" system property. */
static public synchronized void load(boolean disableOpenAL) {
	if (!load) return;

	SharedLibraryLoader loader = new SharedLibraryLoader();
	File nativesDir = null;
	try {
		if (isWindows) {
			nativesDir = loader.extractFile(is64Bit ? "lwjgl.dll" : "lwjgl32.dll", null).getParentFile();
			if (!disableOpenAL)
				loader.extractFile(is64Bit ? "OpenAL.dll" : "OpenAL32.dll", nativesDir.getName());
			loader.extractFile("libglfw.dll", nativesDir.getName());
		} else if (isMac) {
			nativesDir = loader.extractFile("liblwjgl.dylib", null).getParentFile();
			if (!disableOpenAL) loader.extractFile("libopenal.dylib", nativesDir.getName());
			loader.extractFile("libglfw.dylib", nativesDir.getName());
		} else if (isLinux) {
			nativesDir = loader.extractFile(is64Bit ? "liblwjgl.so" : "liblwjgl32.so", null).getParentFile();
			if (!disableOpenAL)
				loader.extractFile(is64Bit ? "libopenal.so" : "libopenal32.so", nativesDir.getName());
			loader.extractFile("libglfw.so", nativesDir.getName());
		}
	} catch (Throwable ex) {
		throw new RuntimeException("Unable to extract LWJGL natives.", ex);
	}
	System.setProperty("org.lwjgl.librarypath", nativesDir.getAbsolutePath());
	load = false;
}
 
开发者ID:Arcnor,项目名称:gdx-backend-jglfw,代码行数:29,代码来源:JglfwNativesLoader.java

示例7: main

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
public static void main (String[] arg) {
	String version = DesktopLauncher.class.getPackage().getSpecificationVersion();
	if (version == null) {
		version = "???";
	}
	LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();

	if (SharedLibraryLoader.isMac) {
		config.preferencesDirectory = "Library/Application Support/BravePixel/Pixel Dungeon/";
	} else if (SharedLibraryLoader.isLinux) {
		config.preferencesDirectory = ".bravepixel/pixel-dungeon/";
	} else if (SharedLibraryLoader.isWindows) {
		config.preferencesDirectory = "Saved Games/BravePixel/PixelDungeon";
	}
	// FIXME: This is a hack to get access to the preferences before we have an application setup
	com.badlogic.gdx.Preferences prefs = new LwjglPreferences(Preferences.FILE_NAME, config.preferencesDirectory);

	boolean isFullscreen = prefs.getBoolean(Preferences.KEY_WINDOW_FULLSCREEN, false);
	config.fullscreen = isFullscreen;
	if (!isFullscreen) {
		config.width = prefs.getInteger(Preferences.KEY_WINDOW_WIDTH, Preferences.DEFAULT_WINDOW_WIDTH);
		config.height = prefs.getInteger(Preferences.KEY_WINDOW_HEIGHT, Preferences.DEFAULT_WINDOW_HEIGHT);
	}

	config.addIcon( "ic_launcher_128.png", Files.FileType.Internal );
	config.addIcon( "ic_launcher_32.png", Files.FileType.Internal );
	config.addIcon( "ic_launcher_16.png", Files.FileType.Internal );


	// TODO: It have to be pulled from build.gradle, but I don't know how it can be done
	config.title = "Pixel Dungeon";

	new LwjglApplication(new PixelDungeon(
			new DesktopSupport(version, config.preferencesDirectory, new DesktopInputProcessor())
	), config);
}
 
开发者ID:skynet67,项目名称:pixel-dungeon-rebirth,代码行数:37,代码来源:DesktopLauncher.java

示例8: load

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
/** Extracts the LWJGL native libraries from the classpath and sets the "org.lwjgl.librarypath" system property. */
static public void load () {
	GdxNativesLoader.load();
	if (GdxNativesLoader.disableNativesLoading) return;
	if (!load) return;

	SharedLibraryLoader loader = new SharedLibraryLoader();
	File nativesDir = null;
	try {
		if (isWindows) {
			nativesDir = loader.extractFile(is64Bit ? "lwjgl64.dll" : "lwjgl.dll", null).getParentFile();
			if (!LwjglApplicationConfiguration.disableAudio)
				loader.extractFile(is64Bit ? "OpenAL64.dll" : "OpenAL32.dll", nativesDir.getName());
		} else if (isMac) {
			File extractedFile = loader.extractFile("liblwjgl.jnilib", null);
			nativesDir = extractedFile.getParentFile();
			new FileHandle(extractedFile).copyTo(new FileHandle(new File(nativesDir, "liblwjgl.dylib")));
			if (!LwjglApplicationConfiguration.disableAudio) loader.extractFile("openal.dylib", nativesDir.getName());
		} else if (isLinux) {
			nativesDir = loader.extractFile(is64Bit ? "liblwjgl64.so" : "liblwjgl.so", null).getParentFile();
			if (!LwjglApplicationConfiguration.disableAudio)
				loader.extractFile(is64Bit ? "libopenal64.so" : "libopenal.so", nativesDir.getName());
		}
	} catch (Throwable ex) {
		throw new GdxRuntimeException("Unable to extract LWJGL natives.", ex);
	}
	System.setProperty("org.lwjgl.librarypath", nativesDir.getAbsolutePath());
	load = false;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:30,代码来源:LwjglNativesLoader.java

示例9: main

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
public static void main (String[] argv) {
	// this is only here for me to debug native code faster
	new SharedLibraryLoader("../../extensions/gdx-audio/libs/gdx-audio-natives.jar").load("gdx-audio");
	new SharedLibraryLoader("../../extensions/gdx-image/libs/gdx-image-natives.jar").load("gdx-image");
	new SharedLibraryLoader("../../extensions/gdx-freetype/libs/gdx-freetype-natives.jar").load("gdx-freetype");
	new SharedLibraryLoader("../../extensions/gdx-controllers/gdx-controllers-desktop/libs/gdx-controllers-desktop-natives.jar")
		.load("gdx-controllers-desktop");
	new SharedLibraryLoader("../../gdx/libs/gdx-natives.jar").load("gdx");

	GdxTest test = new SuperKoalio();
	JglfwApplicationConfiguration config = new JglfwApplicationConfiguration();
	config.vSync = true;
	new JglfwApplication(test, config);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:15,代码来源:JglfwDebugStarter.java

示例10: onCreate

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	AndroidGraphics.init();
	GdxAssets.init("");
	GLAdapter.init(new AndroidGL());
	Tile.SIZE = 400;

	AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();

	new SharedLibraryLoader().load("vtm-jni");

	initialize(new GdxMapAndroid(), cfg);
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:16,代码来源:MainActivity.java

示例11: init

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
public static void init() {
	// load native library
	new SharedLibraryLoader().load("vtm-jni");
	// init globals
	AwtGraphics.init();
	GdxAssets.init("assets/");
	GLAdapter.init(new GdxGL());
	GLAdapter.GDX_DESKTOP_QUIRKS = true;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:10,代码来源:GdxMapApp.java

示例12: initialize

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
private void initialize(ApplicationListener listener, LwjglApplicationConfiguration config) {
    LwjglNativesLoader.load();
    this.setApplicationLogger(new LwjglApplicationLogger());
    this.canvas = new Canvas() {
        private final Dimension minSize = new Dimension(1, 1);

        public final void addNotify() {
            super.addNotify();
            if (SharedLibraryLoader.isMac) {
                EventQueue.invokeLater(new Runnable() {
                    public void run() {
                        MyLwjglCanvas.this.create();
                    }
                });
            } else {
                MyLwjglCanvas.this.create();
            }

        }

        public final void removeNotify() {
            MyLwjglCanvas.this.stop();
            super.removeNotify();
        }

        public Dimension getMinimumSize() {
            return this.minSize;
        }
    };
    this.canvas.setSize(1, 1);
    this.canvas.setIgnoreRepaint(true);
    this.graphics = new LwjglGraphics(this.canvas, config) {
        public void setTitle(String title) {
            super.setTitle(title);
            MyLwjglCanvas.this.setTitle(title);
        }

        public boolean setWindowedMode(int width, int height, boolean fullscreen) {
            if (!super.setWindowedMode(width, height)) {
                return false;
            } else {
                if (!fullscreen) {
                    MyLwjglCanvas.this.setDisplayMode(width, height);
                }

                return true;
            }
        }

        public boolean setFullscreenMode(DisplayMode displayMode) {
            if (!super.setFullscreenMode(displayMode)) {
                return false;
            } else {
                MyLwjglCanvas.this.setDisplayMode(displayMode.width, displayMode.height);
                return true;
            }
        }
    };
    this.graphics.setVSync(config.vSyncEnabled);

    this.files = new LwjglFiles();
    this.input = new LwjglInput();
    this.net = new LwjglNet();
    this.listener = listener;
    Gdx.app = this;
    Gdx.graphics = this.graphics;
    Gdx.files = this.files;
    Gdx.input = this.input;
    Gdx.net = this.net;
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:71,代码来源:MyLwjglCanvas.java

示例13: isFullscreenEnabled

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
@Override
public boolean isFullscreenEnabled() {
	//	return Display.getPixelScaleFactor() == 1f;
	return !SharedLibraryLoader.isMac;
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:6,代码来源:DesktopLauncher.java

示例14: initialize

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
private void initialize (ApplicationListener listener, LwjglApplicationConfiguration config) {
	LwjglNativesLoader.load();

	canvas = new Canvas() {
		private final Dimension minSize = new Dimension(1, 1);

		public final void addNotify () {
			super.addNotify();
			if (SharedLibraryLoader.isMac) {
				EventQueue.invokeLater(new Runnable() {
					public void run () {
						create();
					}
				});
			} else
				create();
		}

		public final void removeNotify () {
			stop();
			super.removeNotify();
		}

		public Dimension getMinimumSize () {
			return minSize;
		}
	};
	canvas.setSize(1, 1);
	canvas.setIgnoreRepaint(true);

	graphics = new LwjglGraphics(canvas, config) {
		public void setTitle (String title) {
			super.setTitle(title);
			LwjglCanvas.this.setTitle(title);
		}

		public boolean setDisplayMode (int width, int height, boolean fullscreen) {
			if (!super.setDisplayMode(width, height, fullscreen)) return false;
			if (!fullscreen) LwjglCanvas.this.setDisplayMode(width, height);
			return true;
		}

		public boolean setDisplayMode (DisplayMode displayMode) {
			if (!super.setDisplayMode(displayMode)) return false;
			LwjglCanvas.this.setDisplayMode(displayMode.width, displayMode.height);
			return true;
		}
	};
	graphics.setVSync(config.vSyncEnabled);
	if (!LwjglApplicationConfiguration.disableAudio) audio = new OpenALAudio();
	files = new LwjglFiles();
	input = new LwjglInput();
	net = new LwjglNet();
	this.listener = listener;

	Gdx.app = this;
	Gdx.graphics = graphics;
	Gdx.audio = audio;
	Gdx.files = files;
	Gdx.input = input;
	Gdx.net = net;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:63,代码来源:LwjglCanvas.java

示例15: initFreeType

import com.badlogic.gdx.utils.SharedLibraryLoader; //导入依赖的package包/类
public static Library initFreeType() {
	new SharedLibraryLoader().load("gdx-freetype");
	long address = initFreeTypeJni();
	if(address == 0) throw new GdxRuntimeException("Couldn't initialize FreeType library");
	else return new Library(address);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:7,代码来源:FreeType.java


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