if (JmeSystem.isLowPermissions()){ url = ClasspathLocator.class.getResource("/" + name); }else{
public static void main(String[] args){ AssetManager assetManager = JmeSystem.newAssetManager(); assetManager.registerLocator("/", ClasspathLocator.class); assetManager.registerLoader(TextLoader.class, "fnt"); System.out.println(assetManager.loadAsset("Interface/Fonts/Console.fnt")); } }
public void create(boolean waitFor) { if (actualContext != null){ throw new IllegalStateException("Already created"); } actualContext = JmeSystem.newContext(settings, Type.OffscreenSurface); actualContext.setSystemListener(new AwtPanelsListener()); actualContext.create(waitFor); }
/** * Creates a new program cache associated with the specified context and * devices. * The cached programs are built against the specified device and also * only the binaries linked to that device are stored. * @param context the OpenCL context * @param device the OpenCL device */ public ProgramCache(Context context, Device device) { this.context = context; this.device = device; if (JmeSystem.isLowPermissions()) { tmpFolder = null; } else { tmpFolder = JmeSystem.getStorageFolder(); } }
private void initAssetManager(){ URL assetCfgUrl = null; if (settings != null){ String assetCfg = settings.getString("AssetConfigURL"); if (assetCfg != null){ try { assetCfgUrl = new URL(assetCfg); } catch (MalformedURLException ex) { } if (assetCfgUrl == null) { assetCfgUrl = LegacyApplication.class.getClassLoader().getResource(assetCfg); if (assetCfgUrl == null) { logger.log(Level.SEVERE, "Unable to access AssetConfigURL in asset config:{0}", assetCfg); return; } } } } if (assetCfgUrl == null) { assetCfgUrl = JmeSystem.getPlatformAssetConfigURL(); } if (assetManager == null){ assetManager = JmeSystem.newAssetManager(assetCfgUrl); } }
if (JmeSystem.isLowPermissions()) { throw new UnsupportedOperationException("JVM is running under " + "reduced permissions. Cannot load native libraries."); Platform platform = JmeSystem.getPlatform(); NativeLibrary library = nativeLibraryMap.get(new NativeLibrary.Key(name, platform));
public static synchronized File getStorageFolder() { return getStorageFolder(StorageFolderType.External); }
public IosHarness(long appDelegate) { super(appDelegate); JmeSystem.setSystemDelegate(new JmeIosSystem()); }
private void initAudio(){ if (settings.getAudioRenderer() != null && context.getType() != Type.Headless){ audioRenderer = JmeSystem.newAudioRenderer(settings); audioRenderer.initialize(); AudioContext.setAudioRenderer(audioRenderer); listener = new Listener(); audioRenderer.setListener(listener); } }
@Override public void start() { // set some default settings in-case // settings dialog is not shown boolean loadSettings = false; if (settings == null) { setSettings(new AppSettings(true)); loadSettings = true; } // show settings dialog if (showSettings) { if (!JmeSystem.showSettingsDialog(settings, loadSettings)) { return; } } //re-setting settings they can have been merged from the registry. setSettings(settings); super.start(); }
File userCacheFolder = null; switch (JmeSystem.getPlatform()) { case Linux32: case Linux64:
Savable sav = null; try { File baseFolder = JmeSystem.getStorageFolder(storageType); if (baseFolder == null) { Logger.getLogger(SaveGame.class.getName()).log(Level.SEVERE, "Error reading base storage folder!");
/** * Creates a new program cache associated with the specified context and * devices. * The cached programs are built against the specified device and also * only the binaries linked to that device are stored. * @param context the OpenCL context * @param device the OpenCL device */ public ProgramCache(Context context, Device device) { this.context = context; this.device = device; if (JmeSystem.isLowPermissions()) { tmpFolder = null; } else { tmpFolder = JmeSystem.getStorageFolder(); } }
private void initAssetManager(){ URL assetCfgUrl = null; if (settings != null){ String assetCfg = settings.getString("AssetConfigURL"); if (assetCfg != null){ try { assetCfgUrl = new URL(assetCfg); } catch (MalformedURLException ex) { } if (assetCfgUrl == null) { assetCfgUrl = LegacyApplication.class.getClassLoader().getResource(assetCfg); if (assetCfgUrl == null) { logger.log(Level.SEVERE, "Unable to access AssetConfigURL in asset config:{0}", assetCfg); return; } } } } if (assetCfgUrl == null) { assetCfgUrl = JmeSystem.getPlatformAssetConfigURL(); } if (assetManager == null){ assetManager = JmeSystem.newAssetManager(assetCfgUrl); logger.config("Created asset manager from "+assetCfgUrl); } }
if (JmeSystem.isLowPermissions()) { throw new UnsupportedOperationException("JVM is running under " + "reduced permissions. Cannot load native libraries."); Platform platform = JmeSystem.getPlatform(); NativeLibrary library = nativeLibraryMap.get(new NativeLibrary.Key(name, platform));
@Test public void testLoadShaderSource() { JmeSystem.setSystemDelegate(new MockJmeSystemDelegate()); AssetManager assetManager = new DesktopAssetManager(); assetManager.registerLocator(null, ClasspathLocator.class); assetManager.registerLoader(GLSLLoader.class, "frag"); assetManager.registerLoader(GLSLLoader.class, "glsllib"); String showNormals = (String) assetManager.loadAsset("Common/MatDefs/Misc/ShowNormals.frag"); System.out.println(showNormals); }
private void initAudioPlayer(){ AppSettings settings = new AppSettings(true); settings.setRenderer(null); // disable rendering settings.setAudioRenderer("LWJGL"); ar = JmeSystem.newAudioRenderer(settings); ar.initialize(); ar.setListener(listener); AudioContext.setAudioRenderer(ar); }
if (!JmeSystem.showSettingsDialog(settings, loadSettings)) { logger.config("Starting application [SUCCESS]"); return;
if (JmeSystem.getPlatform() == Platform.Windows32 || JmeSystem.getPlatform() == Platform.Windows64){
@Before public void init() { assetManager = JmeSystem.newAssetManager( TestMaterialWrite.class.getResource("/com/jme3/asset/Desktop.cfg")); }