public static void main(String[] args) { AmidakujiMain amidakuji = new AmidakujiMain(); AmidakujiMain.width = 1080; AmidakujiMain.height = 720; LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); cfg.title = "Amidakuji Version 0.4.3"; // cfg.useGL20 = true; cfg.width = AmidakujiMain.width; cfg.height = AmidakujiMain.height; if(System.getProperty("os.name").toLowerCase().indexOf("mac os x") != -1) { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Amidakuji"); Application app = Application.getApplication(); app.setDockIconImage(Toolkit.getDefaultToolkit().getImage(Main.class.getResource("/amidakuji_mac.png"))); } else { cfg.addIcon("amidakuji.png", FileType.Internal); cfg.addIcon("amidakuji_lin.png", FileType.Internal); } new LwjglApplication(amidakuji, cfg); }
/** Returns a writer for writing to this file. Parent directories will be created if necessary. * @param append If false, this file will be overwritten if it exists, otherwise it will be appended. * @param charset May be null to use the default charset. * @throws GdxRuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or * {@link FileType#Internal} file, or if it could not be written. */ public Writer writer (boolean append, String charset) { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot write to a classpath file: " + file); if (type == FileType.Internal) throw new GdxRuntimeException("Cannot write to an internal file: " + file); parent().mkdirs(); try { FileOutputStream output = new FileOutputStream(file(), append); if (charset == null) return new OutputStreamWriter(output); else return new OutputStreamWriter(output, charset); } catch (IOException ex) { if (file().isDirectory()) throw new GdxRuntimeException("Cannot open a stream to a directory: " + file + " (" + type + ")", ex); throw new GdxRuntimeException("Error writing file: " + file + " (" + type + ")", ex); } }
/** Returns a stream for reading this file as bytes. * @throw GdxRuntimeException if the file handle represents a directory, doesn't exist, or could not be read. */ public InputStream read () { if (type == FileType.Classpath || (type == FileType.Internal && !file.exists()) || (type == FileType.Local && !file.exists())) { InputStream input = FileWrapper.class.getResourceAsStream("/" + file.getPath().replace('\\', '/')); if (input == null) throw new GdxRuntimeException("File not found: " + file + " (" + type + ")"); return input; } try { return new FileInputStream(file()); } catch (Exception ex) { if (file().isDirectory()) throw new GdxRuntimeException("Cannot open a stream to a directory: " + file + " (" + type + ")", ex); throw new GdxRuntimeException("Error reading file: " + file + " (" + type + ")", ex); } }
/** Returns a writer for writing to this file. Parent directories will be created if necessary. * @param append If false, this file will be overwritten if it exists, otherwise it will be appended. * @param charset May be null to use the default charset. * @throw GdxRuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or * {@link FileType#Internal} file, or if it could not be written. */ public Writer writer (boolean append, String charset) { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot write to a classpath file: " + file); if (type == FileType.Internal) throw new GdxRuntimeException("Cannot write to an internal file: " + file); parent().mkdirs(); try { FileOutputStream output = new FileOutputStream(file(), append); if (charset == null) return new OutputStreamWriter(output); else return new OutputStreamWriter(output, charset); } catch (IOException ex) { if (file().isDirectory()) throw new GdxRuntimeException("Cannot open a stream to a directory: " + file + " (" + type + ")", ex); throw new GdxRuntimeException("Error writing file: " + file + " (" + type + ")", ex); } }
public FileHandle[] list (FileFilter filter) { if (type == FileType.Internal) { try { String[] relativePaths = assets.list(file.getPath()); FileHandle[] handles = new FileHandle[relativePaths.length]; int count = 0; for (int i = 0, n = handles.length; i < n; i++) { String path = relativePaths[i]; FileHandle child = new AndroidFileHandle(assets, new File(file, path), type); if (!filter.accept(child.file())) continue; handles[count] = child; count++; } if (count < relativePaths.length) { FileHandle[] newHandles = new FileHandle[count]; System.arraycopy(handles, 0, newHandles, 0, count); handles = newHandles; } return handles; } catch (Exception ex) { throw new GdxRuntimeException("Error listing children: " + file + " (" + type + ")", ex); } } return super.list(filter); }
public FileHandle[] list (String suffix) { if (type == FileType.Internal) { try { String[] relativePaths = assets.list(file.getPath()); FileHandle[] handles = new FileHandle[relativePaths.length]; int count = 0; for (int i = 0, n = handles.length; i < n; i++) { String path = relativePaths[i]; if (!path.endsWith(suffix)) continue; handles[count] = new AndroidFileHandle(assets, new File(file, path), type); count++; } if (count < relativePaths.length) { FileHandle[] newHandles = new FileHandle[count]; System.arraycopy(handles, 0, newHandles, 0, count); handles = newHandles; } return handles; } catch (Exception ex) { throw new GdxRuntimeException("Error listing children: " + file + " (" + type + ")", ex); } } return super.list(suffix); }
public boolean exists () { if (type == FileType.Internal) { String fileName = file.getPath(); try { assets.open(fileName).close(); // Check if file exists. return true; } catch (Exception ex) { // This is SUPER slow! but we need it for directories. try { return assets.list(fileName).length > 0; } catch (Exception ignored) { } return false; } } return super.exists(); }
public void build (Array<FileHandle> favorites, FileHandle file) { sortingPopupMenu.build(); this.file = file; clearChildren(); addItem(newDirectory); addItem(sortBy); addItem(refresh); addSeparator(); if (file.type() == FileType.Absolute || file.type() == FileType.External) addItem(delete); if (file.type() == FileType.Absolute) { addItem(showInExplorer); if (file.isDirectory()) { if (favorites.contains(file, false)) addItem(removeFromFavorites); else addItem(addToFavorites); } } }
@Override public boolean applicationDidFinishLaunching() { FileUtils.getInstance().addSearchPath("/Users/xujun/remoteProject/Cocos2dJavaImages", FileType.Absolute, true); FileUtils.getInstance().addSearchPath("Resource", FileType.Internal, true); Director.getInstance().getOpenGLView().setDesignResolutionSize(1136, 640, ResolutionPolicy.EXACT_FIT); _testController = TestController.getInstance(); _testController.start(); return true; }
@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(); }
@Override public FileHandleResolver newResolver (FileType fileType) { switch (fileType) { case Absolute: return new AbsoluteFileHandleResolver(); case Classpath: return new ClasspathFileHandleResolver(); case External: return new ExternalFileHandleResolver(); case Internal: return new InternalFileHandleResolver(); case Local: return new LocalFileHandleResolver(); } return null; // Should never happen }
public ArchiveFileHandle (FileHandle zipfilehandle, String filePath, boolean init) { super(filePath, FileType.Classpath); this.zipfilehandle = zipfilehandle; if (filePath.startsWith("/")) filePath = filePath.substring(1); if (init) { ZipInputStream stream = new ZipInputStream(zipfilehandle.read()); try { ZipEntry entry; while ((entry = stream.getNextEntry()) != null) if (entry.getName().replace('\\', '/').equals(filePath)) { entrystream = stream; break; } } catch (Exception e) { e.printStackTrace(); } } this.filePath = filePath; }
public static void main(String[] arg) { if (Assets.rebuildAtlas) { Settings settings = new Settings(); settings.maxWidth = 2048; settings.maxHeight = 2048; settings.debug = Assets.drawDebugOutline; try { TexturePacker.process(settings, "assets-raw", "../android/assets", "assets"); } catch (Exception e) { e.printStackTrace(); } } LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.width = 1280; config.height = 720; config.addIcon("icon128.png", FileType.Internal); config.addIcon("icon32.png", FileType.Internal); config.addIcon("icon16.png", FileType.Internal); new LwjglApplication(new Main(), config); }
/** * @throws InitException If a fatal error occurs during initialization. */ public void start() throws InitException { DesktopGdxFileSystem gdxFileSystem = openResourceFileSystem(new File(".")); IWritableFileSystem outputFileSystem = new DesktopOutputFileSystem(FileType.Local, "save/"); final Launcher launcher = new Launcher(gdxFileSystem, outputFileSystem) { @Override public void create() { DesktopGraphicsUtil.setWindowIcon(gdxFileSystem); windowedSize = DesktopGraphicsUtil.limitInitialWindowSize(Gdx.graphics); super.create(); } @Override public void resize(int width, int height) { super.resize(width, height); if (!Gdx.graphics.isFullscreen()) { windowedSize = Dim.of(width, height); } } @Override protected void handleInput(INativeInput input) { super.handleInput(input); DesktopLauncher.this.handleInput(input); } }; NovelPrefsStore prefs = launcher.loadPreferences(); handleCommandlineOptions(prefs); Lwjgl3ApplicationConfiguration config = createConfig(launcher, prefs); Lwjgl3Application app = new Lwjgl3Application(launcher, config); app.addLifecycleListener(new LifecycleListener() { @Override public void resume() { LOG.info("App resume"); } @Override public void pause() { LOG.info("App pause"); } @Override public void dispose() { LOG.info("App dispose"); } }); }
public static void main(String[] arg) throws FileNotFoundException, IOException { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.title = GameConstants.WINDOW_TITLE; config.addIcon("gameicon.png", FileType.Internal); config.width = GameConstants.GAME_WIDTH; config.height = GameConstants.GAME_HEIGHT; config.fullscreen = false; readConfigFromPreference(config); config.vSyncEnabled = config.fullscreen; // check debug/run configuration ENVIRONMENT tab // if the "DEVEOPMENT" flag is true, then the graphics will be packed together // set the flag to false before exporting the jar String getenv = System.getenv("DEVELOPMENT"); if (getenv != null && "true".equals(getenv)) { Settings settings = new Settings(); settings.combineSubdirectories = true; TexturePacker.process(settings, "../core/assets/graphics/hud", "../core/assets/packedGraphics", "hud"); TexturePacker.process(settings, "../core/assets/graphics/game", "../core/assets/packedGraphics", "gameGraphics"); TexturePacker.process(settings, "../core/assets/graphics/menu", "../core/assets/packedGraphics", "menuGraphics"); } new LwjglApplication(new GDXGame(), config); }
@Override public void processField(final Field field, final LmlMacro annotation, final Object component, final Context context, final ContextInitializer initializer, final ContextDestroyer contextDestroyer) { try { final Object macroData = Reflection.getFieldValue(field, component); final LmlParser parser = interfaceService.get().getParser(); final FileType fileType = annotation.fileType(); if (macroData instanceof String) { parser.parseTemplate(Gdx.files.getFileHandle((String) macroData, fileType)); } else if (macroData instanceof String[]) { for (final String macroPath : (String[]) macroData) { parser.parseTemplate(Gdx.files.getFileHandle(macroPath, fileType)); } } else { throw new GdxRuntimeException("Invalid type of LML macro definition in component: " + component + ". String or String[] expected, received: " + macroData + "."); } } catch (final ReflectionException exception) { throw new GdxRuntimeException( "Unable to extract macro paths from field: " + field + " of component: " + component + ".", exception); } }
@Override public void processField(final Field field, final LmlMacro annotation, final Object component, final Context context, final ContextInitializer initializer, final ContextDestroyer contextDestroyer) { try { final Object macroData = Reflection.getFieldValue(field, component); final FileType fileType = annotation.fileType(); if (macroData instanceof String) { macros.add(Gdx.files.getFileHandle((String) macroData, fileType)); } else if (macroData instanceof String[]) { for (final String macroPath : (String[]) macroData) { macros.add(Gdx.files.getFileHandle(macroPath, fileType)); } } else { throw new GdxRuntimeException("Invalid type of LML macro definition in component: " + component + ". String or String[] expected, received: " + macroData + "."); } } catch (final ReflectionException exception) { throw new GdxRuntimeException( "Unable to extract macro paths from field: " + field + " of component: " + component + ".", exception); } }
@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(); }
/** Returns the paths to the children of this directory with the specified suffix. Returns an empty list if this file handle * represents a file and not a directory. On the desktop, an {@link FileType#Internal} handle to a directory on the classpath * will return a zero length array. * @throws GdxRuntimeException if this file is an {@link FileType#Classpath} file. */ public FileHandle[] list (String suffix) { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot list a classpath directory: " + file); String[] relativePaths = file().list(); if (relativePaths == null) return new FileHandle[0]; FileHandle[] handles = new FileHandle[relativePaths.length]; int count = 0; for (int i = 0, n = relativePaths.length; i < n; i++) { String path = relativePaths[i]; if (!path.endsWith(suffix)) continue; handles[count] = child(path); count++; } if (count < relativePaths.length) { FileHandle[] newHandles = new FileHandle[count]; System.arraycopy(handles, 0, newHandles, 0, count); handles = newHandles; } return handles; }
/** Moves this file to the specified file, overwriting the file if it already exists. * @throws GdxRuntimeException if the source or destination file handle is a {@link FileType#Classpath} or * {@link FileType#Internal} file. */ public void moveTo (FileHandle dest) { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot move a classpath file: " + file); if (type == FileType.Internal) throw new GdxRuntimeException("Cannot move an internal file: " + file); copyTo(dest); delete(); if (exists() && isDirectory()) deleteDirectory(); }
/** Returns the length in bytes of this file, or 0 if this file is a directory, does not exist, or the size cannot otherwise be * determined. */ public long length () { if (type == FileType.Classpath || (type == FileType.Internal && !file.exists())) { InputStream input = read(); try { return input.available(); } catch (Exception ignored) { } finally { StreamUtils.closeQuietly(input); } return 0; } return file().length(); }
/** Returns a stream for writing to this file. Parent directories will be created if necessary. * @param append If false, this file will be overwritten if it exists, otherwise it will be appended. * @throw GdxRuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or * {@link FileType#Internal} file, or if it could not be written. */ public OutputStream write (boolean append) { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot write to a classpath file: " + file); if (type == FileType.Internal) throw new GdxRuntimeException("Cannot write to an internal file: " + file); parent().mkdirs(); try { return new FileOutputStream(file(), append); } catch (Exception ex) { if (file().isDirectory()) throw new GdxRuntimeException("Cannot open a stream to a directory: " + file + " (" + type + ")", ex); throw new GdxRuntimeException("Error writing file: " + file + " (" + type + ")", ex); } }
/** Returns the paths to the children of this directory with the specified suffix. Returns an empty list if this file handle * represents a file and not a directory. On the desktop, an {@link FileType#Internal} handle to a directory on the classpath * will return a zero length array. * @throw GdxRuntimeException if this file is an {@link FileType#Classpath} file. */ public FileWrapper[] list (String suffix) { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot list a classpath directory: " + file); String[] relativePaths = file().list(); if (relativePaths == null) return new FileWrapper[0]; FileWrapper[] handles = new FileWrapper[relativePaths.length]; int count = 0; for (int i = 0, n = relativePaths.length; i < n; i++) { String path = relativePaths[i]; if (!path.endsWith(suffix)) continue; handles[count] = child(path); count++; } if (count < relativePaths.length) { FileWrapper[] newHandles = new FileWrapper[count]; System.arraycopy(handles, 0, newHandles, 0, count); handles = newHandles; } return handles; }
/** Moves this file to the specified file, overwriting the file if it already exists. * @throw GdxRuntimeException if the source or destination file handle is a {@link FileType#Classpath} or * {@link FileType#Internal} file. */ public void moveTo (FileWrapper dest) { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot move a classpath file: " + file); if (type == FileType.Internal) throw new GdxRuntimeException("Cannot move an internal file: " + file); copyTo(dest); delete(); }
@Override public File file () { if (type == FileType.Internal) return new File(IOSFiles.internalPath, file.getPath()); if (type == FileType.External) return new File(IOSFiles.externalPath, file.getPath()); if (type == FileType.Local) return new File(IOSFiles.localPath, file.getPath()); return file; }
public FileHandle[] list (FilenameFilter filter) { if (type == FileType.Internal) { try { String[] relativePaths = assets.list(file.getPath()); FileHandle[] handles = new FileHandle[relativePaths.length]; int count = 0; for (int i = 0, n = handles.length; i < n; i++) { String path = relativePaths[i]; if (!filter.accept(file, path)) continue; handles[count] = new AndroidFileHandle(assets, new File(file, path), type); count++; } if (count < relativePaths.length) { FileHandle[] newHandles = new FileHandle[count]; System.arraycopy(handles, 0, newHandles, 0, count); handles = newHandles; } return handles; } catch (Exception ex) { throw new GdxRuntimeException("Error listing children: " + file + " (" + type + ")", ex); } } return super.list(filter); }
public boolean isDirectory () { if (type == FileType.Internal) { try { return assets.list(file.getPath()).length > 0; } catch (IOException ex) { return false; } } return super.isDirectory(); }
public long length () { if (type == FileType.Internal) { AssetFileDescriptor fileDescriptor = null; try { fileDescriptor = assets.openFd(file.getPath()); return fileDescriptor.getLength(); } catch (IOException ignored) { } finally { if (fileDescriptor != null) { try { fileDescriptor.close(); } catch (IOException e) { } ; } } } return super.length(); }
@Override public void create () { Gdx.input.setInputProcessor(new InputAdapter() { public boolean touchDown (int x, int y, int pointer, int newParam) { renderMode = (renderMode + 1) % 6; return false; } }); spriteBatch = new SpriteBatch(); texture = new Texture(Gdx.files.internal("data/badlogic.jpg")); logoSprite = new Sprite(texture); logoSprite.setColor(1, 1, 1, 0.6f); logoSprite.setBounds(50, 100, 400, 100); font = new BitmapFont(Gdx.files.getFileHandle("data/verdana39.fnt", FileType.Internal), Gdx.files.getFileHandle( "data/verdana39.png", FileType.Internal), false); cache = new BitmapFontCache(font); }
public static void main(String[] args) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.width = 1024; config.height = 768; config.resizable = false; config.title = "Möbius"; config.addIcon("icons/icon128.png", FileType.Internal); config.addIcon("icons/icon32.png", FileType.Internal); config.addIcon("icons/icon16.png", FileType.Internal); boolean debug = false; for (String s : args) { if ("--debug".equals(s)) { debug = true; } else if ("--check-levels".equals(s)) { LevelEntityFactory.VERBOSE_LOAD = true; } } new LwjglApplication(new MobiusListingGame(debug), config); }
public static void main(String[] argc) { final LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); Scene.configJson = Scene.jsonReader.parse(Main.class.getClassLoader().getResourceAsStream("config")); if(Scene.configJson.getBoolean("hasIcon")) cfg.addIcon("icon.png", FileType.Internal); String[] screen = Scene.configJson.getString("screenSize").split("x"); String[] target = Scene.configJson.getString("targetSize").split("x"); cfg.width = Integer.parseInt(screen[0]); cfg.height = Integer.parseInt(screen[1]); Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); cfg.x = (int) ((dimension.getWidth() - cfg.width) / 2); cfg.y = (int) ((dimension.getHeight() - cfg.height) / 2); cfg.resizable = Scene.configJson.getBoolean("resize"); cfg.forceExit = Scene.configJson.getBoolean("forceExit"); cfg.fullscreen = Scene.configJson.getBoolean("fullScreen"); cfg.useGL20 = Scene.configJson.getBoolean("useGL20"); cfg.vSyncEnabled = Scene.configJson.getBoolean("vSync"); cfg.audioDeviceBufferCount = Scene.configJson.getInt("audioBufferCount"); LwjglApplicationConfiguration.disableAudio = Scene.configJson.getBoolean("disableAudio"); Scene.targetWidth = Integer.parseInt(target[0]); Scene.targetHeight = Integer.parseInt(target[1]); new LwjglApplication(Scene.app, cfg); }
public static void main(final String[] args) { LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); cfg.title = "Adventure Editor v" + Versions.getVersion(); cfg.resizable = true; cfg.vSyncEnabled = true; // cfg.samples = 2; // cfg.useGL30 = true; if (Main.class.getResource("/images/ic_app64.png") != null) cfg.addIcon("images/ic_app64.png", FileType.Internal); if (Main.class.getResource("/images/ic_app32.png") != null) cfg.addIcon("images/ic_app32.png", FileType.Internal); if (Main.class.getResource("/images/ic_app16.png") != null) cfg.addIcon("images/ic_app16.png", FileType.Internal); parseArgs(args); new Main(new Editor(), cfg); }
public static void main(String[] args) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); double width = screenSize.getWidth(); double height = screenSize.getHeight(); LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); cfg.title = "Snappy Frog"; cfg.fullscreen = true; cfg.width = (int)width; cfg.height = (int)height; cfg.addIcon("icon32.png", FileType.Internal); /* cfg.width = 960; cfg.height = 640;*/ new LwjglApplication(new Game(new DesktopServices()), cfg); }
public static void main(String[] arg) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.title = "Horses in Space"; config.width = Toolkit.getDefaultToolkit().getScreenSize().width / 2; config.height = Toolkit.getDefaultToolkit().getScreenSize().height / 2; float ratio = (float) config.width / (float) config.height; if (ratio < 1.7) { config.height = 675; config.width = 1200; } config.addIcon("data/gfx/his_logo2_128.png", FileType.Internal); config.addIcon("data/gfx/his_logo2_32.png", FileType.Internal); config.addIcon("data/gfx/his_logo2_16.png", FileType.Internal); new LwjglApplication(new HorseGame(HorseGame.Platform.DESKTOP), config); }
public FullFilePath(String path, FileType type) { if(path.length() > 0 && path.charAt(path.length() - 1) != '/') { this.path = path + '/'; //补充分隔符 } else { this.path = path; } this.type = type; }
/** * Add search path. */ public void addSearchPath( String path, FileType type, boolean front) { if(front) { pushSearchPath(path, type); } else { this._searchPathArray.add(new FullFilePath(path, type)); } }
@Override public boolean applicationDidFinishLaunching() { Director director = Director.getInstance(); // turn on display FPS director.setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this director.setAnimationInterval(1.0f / 60); // create a scene. it's an autorelease object Scene scene = new HelloWorldScene(); // // run // System.out.println("start up"); director.runWithScene(scene); // FileUtils.getInstance().setDefaultResourceRootPath("", FileType.Classpath); FileUtils.getInstance().addSearchPath("/Users/xujun/remoteProject/Cocos2dJavaImages", FileType.Absolute, false); FileHandle fh = FileUtils.getInstance().getFileHandle("assetMgrBackground2.png"); System.out.println("fh = " + fh.exists()); System.out.println("fh direct = " + FileUtils.instance().isFileExist("assetMgrBackground2.png")); // new Base(); // new Base1(); // new Base1("hahahahaha"); // new Base1("ddddddddd"); return true; }
@Override public boolean applicationDidFinishLaunching() { FileUtils.getInstance().addSearchPath("/Users/xujun/remoteProject/Cocos2dJavaImages", FileType.Absolute, true); FileUtils.getInstance().addSearchPath("Resource", FileType.Internal, true); Director.getInstance().getOpenGLView().setDesignResolutionSize(1136, 640, ResolutionPolicy.EXACT_FIT); Director.getInstance().runWithScene(GdxuiScene.create()); return true; }