Java Code Examples for processing.core.PApplet#loadStrings()

The following examples show how to use processing.core.PApplet#loadStrings() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DwGeometryShader.java    From PixelFlow with MIT License 5 votes vote down vote up
public DwGeometryShader(PApplet papplet, String filename_vert, String filename_geom, String filename_frag) {
  super(papplet, filename_vert, filename_frag);
  
  this.filename_geom = filename_geom;
  
  this.src_geom = papplet.loadStrings(filename_geom);
  for(int i = 0; i < src_geom.length; i++){
    src_geom[i] += DwUtils.NL;
  }
}
 
Example 2
Source File: PShaderCompiler.java    From haxademic with MIT License 5 votes vote down vote up
protected static String[] loadVertexShader(URL url) {
	try {
		return PApplet.loadStrings(url.openStream());
	} catch (IOException e) {
		PGraphics.showException("Cannot load vertex shader " + url.getFile());
	}
	return null;
}
 
Example 3
Source File: Manifest.java    From APDE with GNU General Public License v2.0 5 votes vote down vote up
public static void loadPermissions(Context context) {
	//TODO this is probably a grossly incorrect method of doing this...
	
	//Load the raw list of permissions
	InputStream rawPermissionsStream = context.getResources().openRawResource(context.getResources().getIdentifier("raw/permissions_list", "raw", context.getPackageName()));
	String[] rawPermissions = PApplet.loadStrings(rawPermissionsStream);
	
	permissions = new ArrayList<>(rawPermissions.length);
	
	//Add the permissions
	for(int i = 0; i < rawPermissions.length; i ++) {
		String raw = rawPermissions[i];
		//Get the description from the String resources
		String desc = context.getResources().getString(context.getResources().getIdentifier(raw, "string", context.getPackageName()));
		//Add the permission
		addPermission(PERMISSION_PREFIX, raw, desc, false);
	}
	
	//Add user's custom permissions
	
	SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
	String perms = prefs.getString("user_perms", "");
	String[] parts = perms.split(",");
	
	for(String part : parts)
		if(part.length() > 0)
			addPermission(PERMISSION_PREFIX, part, context.getResources().getString(R.string.permissions_custom_perm), true);
	
	//Sort the permissions (custom permissions are unsorted, even though the loaded ones are sorted)
	sortPermissions();
}
 
Example 4
Source File: MathUtils.java    From PapARt with GNU Lesser General Public License v3.0 3 votes vote down vote up
/**
 * Load a PMatrix3D from a file. Really simple file format, using
 * loadStrings.
 *
 * @param pa
 * @param filename
 * @return
 * @throws FileNotFoundException
 */
public static PMatrix3D loadPMatrix3D(PApplet pa, String filename) throws FileNotFoundException {
    String[] lines = pa.loadStrings(filename);
    if (lines == null) {
        throw new FileNotFoundException(filename);
    }
    PMatrix3D mat = new PMatrix3D(Float.parseFloat(lines[0]), Float.parseFloat(lines[1]), Float.parseFloat(lines[2]), Float.parseFloat(lines[3]), Float.parseFloat(lines[4]), Float.parseFloat(lines[5]), Float.parseFloat(lines[6]), Float.parseFloat(lines[7]), Float.parseFloat(lines[8]), Float.parseFloat(lines[9]), Float.parseFloat(lines[10]), Float.parseFloat(lines[11]), Float.parseFloat(lines[12]), Float.parseFloat(lines[13]), Float.parseFloat(lines[14]), Float.parseFloat(lines[15]));
    return mat;
}