/** * Loads the music located at path * * @param path */ private static void LoadMusic(final String path) { AssetManager assetManager = VictusLudusGame.engine.assetManager; FileHandle musicFolder = VFile.getFileHandle(path); FileHandle[] files = VFile.getFiles(musicFolder); for (FileHandle file : files) { if (file.exists() && file.extension().toLowerCase().equals("wav")) { assetManager.load(file.path(), Music.class); System.out.println("queueing " + file.path()); } } }
/** * Loads the 3d meshes located at path * * @param path */ private static void Load3DMeshes(final String path) { AssetManager assetManager = VictusLudusGame.engine.assetManager; FileHandle meshFolder = VFile.getFileHandle(path); FileHandle[] files = VFile.getFiles(meshFolder); for (FileHandle file : files) { if (file.exists() && (file.extension().toLowerCase().equals("obj") || file.extension().toLowerCase().equals("g3db") || file.extension().toLowerCase().equals("g3dj"))) { assetManager.load(file.path(), Model.class); System.out.println("queueing " + file.path()); } } }
/** * Reads the star color chart and loads them into a hash * * @param starColorChart * @param starColorMap */ private static void ReadStarColorChart( final String starColorChart, final ArrayList<StarColorTuple> starColorMap) { int minColor = 0; int maxColor = 33000; Texture starColorImage = new Texture(VFile.getFileHandle(starColorChart)); starColorImage.getTextureData().prepare(); Pixmap pixelData = starColorImage.getTextureData().consumePixmap(); for (int i = 1; i < starColorImage.getWidth(); i += 5) { Color color = new Color(); Color.rgba8888ToColor(color, pixelData.getPixel(starColorImage.getWidth() - i, 0)); color.a = 1.0F; StarColorTuple tuple = new StarColorTuple( (int) ((float) (starColorImage.getWidth() - i) / starColorImage.getWidth() * (maxColor - minColor)), color); // System.err.println("added tuple: " + tuple.getTemperature() + " " + // tuple.getColor()); starColorMap.add(tuple); } Color color = new Color(); Color.rgba8888ToColor(color, pixelData.getPixel(starColorImage.getWidth(), 0)); color.a = 1.0F; starColorMap.add(new StarColorTuple(Integer.MIN_VALUE, color)); starColorImage.dispose(); }
private boolean createFile(String rawPath, boolean tmp) { String parent = new File(rawPath).getParent(); boolean created = createFolder(parent); if (!created) { return false; } VFolder folder = (VFolder) findFSObject(parent); VFile file = new VFile(rawPath, folder); folder.addChild(file); if (!tmp) { markAccessedFile(file.getPath()); } return true; }
/** * Read line items into an array list * * @param path the path of the file * @param array the arraylist to populate */ private static void SimpleReadAndLoad( final String path, final ArrayList<String> array, final ISimpleReader reader) { FileHandle folder = VFile.getFileHandle(path); FileHandle[] listOfFiles = VFile.getFiles(folder); for (FileHandle f : listOfFiles) { if (f.exists()) { reader.ReadAndLoad(f, array); if (VictusLudusGame.engine.IS_DEBUGGING) { Gdx.app.log("info", "loaded " + f.path()); } } else { Gdx.app.log("severe", "<ERROR> Cannot read file [" + f.path() + "]"); throw new VictusRuntimeException("Could not read resource folder for " + path); } } }
public static VFileSoap toSoapModel(VFile model) { VFileSoap soapModel = new VFileSoap(); soapModel.setFileId(model.getFileId()); soapModel.setFullname(model.getFullname()); soapModel.setPhone(model.getPhone()); soapModel.setAddress(model.getAddress()); soapModel.setBirthday(model.getBirthday()); soapModel.setPosition(model.getPosition()); soapModel.setStatus(model.getStatus()); return soapModel; }