processing

Java Processing 2.0 (Using Eclipse) : Switching from window to fullscreen and back

若如初见. 提交于 2019-12-01 06:19:08
问题 I am using Processing 2.0 in Eclipse and have a question regarding the transition between windowed mode and fullscreen for a running application (not selecting windowed or fullscreen at startup, which is easily solved). This question solves the problem of going from the fullscreen mode in Java Processing to windowed mode. However, I would also like to know how to transition from windowed mode back to fullscreen using Processing. Does anyone have a solution to this problem? 回答1: A bit hacky,

Pass an Array to a Constructor without declaring it?

蹲街弑〆低调 提交于 2019-12-01 06:12:02
问题 In processing, I have defined the following class: class SomeClass { SomeClass(int[] someArray) { println(someArray); } } Now I would like to create an instance of that class, but I am having trouble getting the array passed to the constructor: SomeClass myVar = new SomeClass({ 12, 10 }); But this always gives me an error "unexpected token: {". So apparently defining the array "on the fly" does not work. However, this will work: int[] dummy = {12, 10}; SomeClass myVar = new SomeClass(dummy);

Transform screen coordinates to model coordinates

只愿长相守 提交于 2019-12-01 00:21:58
I've got some sort of newbie question. In my application (processingjs) i use scale() and translate() to allow the user to zoom and scroll through the scene. As long as i keep the scale set to 1.0 i've got no issues. BUT whenever i use the scale (i.e. scale(0.5)) i'm lost... I need the mouseX and mouseY translated to the scene coordinates, which i use to determine the mouseOver state of the object I draw on the scene. Can anybody help me how to translate these coordinates? Thanks in advance! /Richard Unfortunately for me this required a code modification. I'll look at submitting this to the

twitter4j how to get only statuses with location data from a twitter stream

心不动则不痛 提交于 2019-11-30 20:56:42
问题 I'm getting high numbers of "onTrackLimitationNotice". I'd like to narrow my predicate by only searching for statuses with geo location, but all geo locations? Can this be done? Im coding in Processing, using twitter4j-2.2.6. EDIT: it was an answer... moved. 回答1: i found that querying the stream for a global bounding box, returns only status withs geo location. So this worked: // cb is an instace of ConfigurationBuilder TwitterStream twitter = new TwitterStreamFactory(cb.build()).getInstance(

Transform screen coordinates to model coordinates

醉酒当歌 提交于 2019-11-30 19:14:35
问题 I've got some sort of newbie question. In my application (processingjs) i use scale() and translate() to allow the user to zoom and scroll through the scene. As long as i keep the scale set to 1.0 i've got no issues. BUT whenever i use the scale (i.e. scale(0.5)) i'm lost... I need the mouseX and mouseY translated to the scene coordinates, which i use to determine the mouseOver state of the object I draw on the scene. Can anybody help me how to translate these coordinates? Thanks in advance!

Can Processing handle multi-touch?

99封情书 提交于 2019-11-30 18:59:35
问题 I am new to Processing and I would like to run my sketch in Android mode. I want it to support multiple touches simultaneously. I was wondering if someone can guide me on this question: How can I make my sketch support multiple touches? 回答1: Here is a full example: /* * * androidMultiTouch.pde * Shows the basic use of MultiTouch Events * */ //----------------------------------------------------------------------------------------- // IMPORTS import android.view.MotionEvent; //----------------

Processing 'It looks like you're mixing “active” and “static” modes.'

三世轮回 提交于 2019-11-30 17:43:07
Processing keeps giving me this error when I run it even though it is just a print command. When I delete the comment block it works fine. Here's the code: /* float[] cortToPolar(int xcorr, int ycorr) { float returns[] = new float[2]; returns[0]= degrees(tan(ycorr/xcorr)); returns[1]= sqrt(pow(xcorr,2)+pow(ycorr,2)); return returns; } float lawCos(int a, int b, int c) { return degrees( acos( (pow(a,2)+pow(b,2)-pow(c,2))/ (2*a*b) ) ); } */ print(0); Why doesn't it like my comment? Processing runs in two separate modes: static or active Static mode simply means it's a list of instructions/calls

Getting Multiple Audio Inputs in Processing

故事扮演 提交于 2019-11-30 16:02:09
问题 I'm currently writing a Processing sketch that needs to access multiple audio inputs, but Processing only allows access to the default line in. I have tried getting Lines straight from the Java Mixer (accessed within Processing), but I still only get the signal from whichever line is currently set to default on my machine. I've started looking at sending the sound via OSC from SuperCollider, as recommended here. However, since I'm very new to SuperCollider and their documentation and support

Getting Multiple Audio Inputs in Processing

China☆狼群 提交于 2019-11-30 15:54:44
I'm currently writing a Processing sketch that needs to access multiple audio inputs, but Processing only allows access to the default line in. I have tried getting Lines straight from the Java Mixer (accessed within Processing), but I still only get the signal from whichever line is currently set to default on my machine. I've started looking at sending the sound via OSC from SuperCollider, as recommended here . However, since I'm very new to SuperCollider and their documentation and support is more focused on generating sound than on accessing inputs, my next step will probably be to play

Dynamically “unload” a Processing JS sketch from canvas

╄→尐↘猪︶ㄣ 提交于 2019-11-30 15:13:31
问题 I'm using some javascript to allow users to dynamically load a sketch on click to a canvas element using: Processing.loadSketchFromSources('canvas_id', ['sketch.pde']); If I call Processing.loadSketchFromSources(...) a second (or third...) time, it loads a second (or third...) .pde file onto the canvas, which is what I would expect. I'd like for the user to be able to click another link to load a different sketch, effectively unloading the previous one. Is there a method I can call (or a