MCPcopy Create free account
hub / github.com/benfry/processing4 / sendNewValue

Method sendNewValue

java/src/processing/mode/java/tweak/Handle.java:276–303  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

274
275
276 public void sendNewValue() {
277 int index = varIndex;
278 try {
279 if ("int".equals(type)) {
280 tweakClient.sendInt(index, newValue.intValue());
281 } else if ("hex".equals(type)) {
282 tweakClient.sendInt(index, newValue.intValue());
283 } else if ("webcolor".equals(type)) {
284 // If full opaque color, don't spend the cycles on string processing
285 // which does appear to matter at high frame rates. Otherwise take the
286 // hit and parse back from string value with transparency.
287 if (strNewValue.length() == 7) {
288 tweakClient.sendInt(index, newValue.intValue());
289 } else {
290 long target = Long.parseLong(
291 strNewValue.substring(1, strNewValue.length()),
292 16
293 );
294 tweakClient.sendInt(index, (int) target);
295 }
296
297 } else if ("float".equals(type)) {
298 tweakClient.sendFloat(index, newValue.floatValue());
299 }
300 } catch (Exception e) {
301 System.out.println("error sending new value!");
302 }
303 }
304
305
306 public String toString() {

Callers 1

setValueMethod · 0.95

Calls 4

sendIntMethod · 0.80
sendFloatMethod · 0.80
equalsMethod · 0.45
printlnMethod · 0.45

Tested by

no test coverage detected