Skip to content

C++ Mode v0.6.0

Choose a tag to compare

@pepc84 pepc84 released this 23 Aug 23:16
· 18 commits to main since this release

What's new in 0.6.0

This is a big one. Lots of API gaps filled in, several platform bugs fixed, and a bunch of internal cleanup.

Bug fixes

  • macOS: ld: library 'glfw' not found is fixed. The bundled dylibs now include libglfw.dylib alongside libglfw.3.dylib so the linker can find it. If you were getting this error, delete your CppMode folder and reinstall fresh.
  • macOS: bundled dylibs are now copied next to the sketch binary so they're found at runtime without needing Homebrew on PATH.
  • Fixed ambiguous width/height/key errors when a sketch class explicitly inherits PApplet directly (e.g. in a multi-class sketch). The transpiler now skips injecting _PSketch proxies into classes that already inherit PApplet.
  • deltaTime now works in all contexts, including hoisted classes and multi-class sketches.
  • Fixed Processing_api.h corruption that caused expected unqualified-id before '/' token errors.
  • Fixed random() clashing with the C stdlib random().
  • Fixed filter() with POSTERIZE being unreachable.
  • Fixed strokeCap/strokeJoin — ROUND now enables GL_LINE_SMOOTH.
  • Fixed several constants that didn't match Processing Java's values (ROUND, POINTS, LINES, TRIANGLES, etc.).

New free functions

These now work anywhere in your sketch, including in helper classes:

  • Math: sq, mag, abs, floor, ceil, round, sqrt, pow, exp, log, norm, min/max (2 and 3 argument versions)
  • Trig: sin, cos, tan, asin, acos, atan, atan2, degrees, radians
  • Color: red, green, blue, alpha, hue, saturation, brightness, lerpColor, blendColor
  • String: toUpperCase, toLowerCase, parseInt, parseFloat, parseBoolean
  • Array: append, expand, shorten, subset, concat, reverse, sort, arrayCopy
  • Other: randomGaussian, sketchPath, dataPath, sketchFile, dataFile, deltaTime

New geometry

  • rect(x, y, w, h, tl, tr, br, bl) — four independent corner radii
  • bezierVertex(x2, y2, z2, x3, y3, z3, x4, y4, z4) — 3D version
  • curveVertex(x, y, z) — 3D version
  • quadraticVertex(cx, cy, cz, x, y, z) — 3D version

Java API additions

  • StringBuilder, Random, HashSet, LinkedList, TreeMap, TreeSet
  • Exception classes: RuntimeException, IllegalArgumentException, and the rest of the standard hierarchy
  • HashMap: getOrDefault, putAll, putIfAbsent, entrySet
  • ArrayList: toArray()
  • PShape: beginShape/endShape, createShape(kind, x, y, w, h), params field
  • JSONValue and XML: additional Processing Java interface methods
  • PFont: getSize(), getName(), isSmooth(), getWidth()
  • PImage: isLoaded(), getWidth(), getHeight(), format field
  • createImage now sets the format field correctly

Other

  • deltaTime field — seconds since last frame, updated every frame (like p5.js)
  • image(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2) — nine-argument form for sprite sheet cropping
  • loadPixels() was declared but never implemented — fixed
  • Added OPEN/CHORD/PIE arc mode constants
  • Added splitTokens(s) with no delimiter argument, defaulting to whitespace