public void load(PGraphics graphics, string path, Action <JSONObject> onComplete = null) { graphics.loadStringText(path, strings => { onLoadComplete(strings); onComplete(this); }); }
public void init(PGraphics graphics) { normal.set(Color.white, Color.black, Color.white, 2); active.set(Color.black, Color.white, Color.white, 4); textAlignX = CENTER; textAlignY = CENTER; textX = textY = 0.0f; groupName = "none"; }
public void load(PGraphics graphics, string path, Action <JSONArray> onComplete = null) { graphics.loadStringText(path, strings => { onLoadComplete(strings); if (onComplete != null) { onComplete(this); } }); }
public void create(int width, int height, TextureFormat texFormat = TextureFormat.ARGB32) { this.width = width; this.height = height; texture = new Texture2D(width, height, texFormat, false); if (texture == null) { PGraphics.debuglogWaring("create: new Texture2D <failed>"); return; } clear(new Color(0, 0, 0, 0)); }
public void init(PGraphics graphics) { g = graphics; g.beginKeep(); obj = g.prefab("unitychanP5"); //obj = g.box (1); //obj.addRigid(); obj.transform.Rotate(0, 90, 0); obj.rigidBody.constraints |= RigidbodyConstraints.FreezePositionZ; g.endKeep(); }
public bool save(PGraphics graphics, string path) { if (data == null) { return(false); } string text = PMiniJSON.Json.Serialize(data); if (text == null) { return(false); } graphics.saveStringText(path, text); return(true); }
public void load(PGraphics g, string path) { this.path = path; if (path.StartsWith("http://") || path.StartsWith("file://")) { StartCoroutine("loadFromURL", path); PGraphics.debuglog("loadImage:loadFromURL " + path); } else { if (!loadFromResources(g, path)) { loadFromLocalFile(path); } } }
public bool loadPixels() { if (!texture) { return(false); } pixels = texture.GetPixels32(); if (pixels == null) { PGraphics.debuglogWaring("loadPixels:GetPixels32 <failed>"); return(false); } else { return(true); } }
bool loadFromLocalFile(string path) { if (!File.Exists(path)) { PGraphics.debuglogWaring("loadImage:loadFromLocalFile <NotFound> " + path);; return(false); } byte[] bytes = null; FileStream fs = new FileStream(path, FileMode.Open); using (BinaryReader bin = new BinaryReader(fs)) { bytes = bin.ReadBytes((int)bin.BaseStream.Length); } Texture2D tex = new Texture2D(0, 0); tex.LoadImage(bytes); set(tex); if (tex != null) { PGraphics.debuglog("loadImage:loadFromLocalFile " + path); if (width == 0) { width = texWidth; } if (height == 0) { height = texHeight; } } else { PGraphics.debuglogWaring("loadImage:loadFromLocalFile <Failed> " + path); } return(tex != null); }
bool loadFromResources(PGraphics g, string path) { string resPath = g.getResourceName(path); Texture2D tex = Resources.Load(resPath) as Texture2D; set(tex); if (tex != null) { PGraphics.debuglog("loadImage:loadFromResources " + resPath); if (width == 0) { width = texWidth; } if (height == 0) { height = texHeight; } } else { PGraphics.debuglogWaring("loadImage:loadFromResources <Failed> " + resPath); } return(tex != null); }
public void stroke(int r, int g, int b, int a = 255) { stroke(PGraphics.color(r, g, b, a)); }
public void stroke(int gray, int alpha = 255) { stroke(PGraphics.color(gray, alpha)); }
public void fill(int r, int g, int b, int a = 255) { fill(PGraphics.color(r, g, b, a)); }
public void fill(int gray, int alpha = 255) { fill(PGraphics.color(gray, alpha)); }
public void tint(int r, int g, int b, int a = 255) { tint(PGraphics.color(r, g, b, a)); }
public void tint(int gray, int alpha = 255) { tint(PGraphics.color(gray, alpha)); }
bool loadFromResources(PGraphics g, string path) { string resPath = g.getResourceName(path); Texture2D tex = Resources.Load(resPath) as Texture2D; set(tex); if (tex != null) { PGraphics.debuglog("loadImage:loadFromResources " + resPath); if (width == 0) width = texWidth; if (height == 0) height = texHeight; } else { PGraphics.debuglogWaring("loadImage:loadFromResources <Failed> " + resPath); } return tex != null; }