mymain sketch has a method to hide some of the UI, if any instance of another class does something. Now, from within my class instances I manage to call this method in the main sketch with PApplet.method(), but I struggle to find a straight forward way of calling this main sketch method with arguments. Ideally, the argument I'd like to pass in is the instance of my class itself.
The problem is because I use the Processing IDE when I pass "this" to the Foobar instance on creation I can actually only access it as a PApplet instance, and thus there is no way of calling "parent.hideUI(this)" directly, because PApplet does not have such a function. Do I need to switch to coding this with Eclipse and making my main sketch a class that extends PApplet or is there a way around it and doing this with the Processing IDE?
Even if I store the reference to "this" in a variable in the main sketch, and then assign it and pass it in the class instantiation, the problem is the same, no? In the other class I can only cast it as PApplet, and consequently only use PApplet methods, like "method("")". And this won't change that my custom functions from the main sketch are not available to the "this" object, as it is still just a PApplet, not my extended main sketch.
I understand your skepticism about the PApplet, but the executeCommand function changes nothing per se, it's just a method in my main sketch like my "pseudo" hideUI() - of course I could combine different actions into one "executeCommand" routine, but I need to anyway separate the actions they take (when they are more complex).
So I am still looking for a solution to this that let's me pass arguments back to the main sketch. For now, one workaround for at least differentiating the instances of my class on calling goes as follows:
Use a single instance of a new class, call it "Delegator". This single instance get's passed to every instance of the "Foobar" class in the constructor in the main sketch. The "Delegator" then has a method, which calls the main sketch with ".method()", like before, but in this method it also stores the caller (which get's passed in, i.e. the instance of Foobar that's calling". Delegator further has a function to retrieve the last stored caller.
Like this, in whatever function I have in my main sketch, when it get's called by proxy from Foobar via Delegator, I can query the single Delegator instance and check which instance of Foobar was the last caller.
Obviously, this isn't very clean. Any better suggestions on how to do this? This workaround I could somehow pass arguments still in as an array of object or something, but it would get more and more obscure.
I just assumed (read: was blind enough) in accordance with OOP that I cannot simply call some global method from my main sketch in any other processing class I got. When in fact, they are all "nested" under it, so all processing classes got access to the main sketch's methods as they are public.
Then again, I was staying more true to the OOP paradigm than Processing itself (which is good for beginners and quick prototyping, I suppose); it just didn't occur to me that my sketch main class would somehow be "in global" space - I tried to force pass in a reference to it when really it is "all there is around" the processing classes you create. I suppose this would only be different if I create my classes as actual "Foobar.java" documents, and they then lose this comfortable "processing padding" of being able to access the main sketch methods from global.
Oh yea, exactly my thinking; ergo you need a reference to "cyclist" available to execute the method on inside your Car code, which I didn't. (There "is" no main sketch instance I could pass in, because passing in "this" from the main sketch you can only cast to PApplet, not actually reference my extended class of PApplet with all the methods you define in the main scope.)
By default all classes we define in Processing's IDE (PDE) are nested to the sketch.
Which in turn is the only actual top PApplet class for our whole program.
We can escape from that by creating tabs w/ suffix ".java" though.
Indeed for OOP it is "sinful" to directly access some unrelated class from another class.
But as you had found out by now, all classes we define in PDE automatically pseudo-inherits everything from the enclosing sketch class, which behaves very similar to those famous JS closures.
However, if we implement new methods, like your hideUI(), PApplet isn't enough to access that.
We're gonna need the exact name of the PApplet subclass. Which is always the name of the 1st tab in the PDE.
thanks for the answer still! This is in fact what I was looking for, even though it's quite crude to hardcode the name of the Sketch into the other classes; but it does what I was trying to do indeed!
Glad you've liked. A last tip: Hit CTRL+SHIFT+E to export the saved sketch.
Then take a look at the generated ".java" file there.
You're gonna see the actual valid Java source which corresponds to all our ".pde" tabs. :D
LinkedIn and 3rd parties use essential and non-essential cookies to provide, secure, analyze and improve our Services, and to show you relevant ads (including professional and job ads) on and off LinkedIn. Learn more in our Cookie Policy.
The 10x10 Sketch Method is a technique for making early concept generation sketching more efficient in use of time than a method that stresses finished sketches early in the design process. This technique allows more time to explore ideas and so stresses the quality of thinking and the final solution. The 10x10 Sketch Method involves creating ten or more sketches (per team) to solve the design challenge. It's all about creating a bunch of cool ideas to solve your design challenge.
There are many styles in which you can sketch with a pencil, all ranging from simplistic lines to complex drawings and sketches. Learning a variety of different sketching techniques can take your pencil drawings to a whole new level, bringing greater depth and refinement to the artwork you create. Here, we share a variety of pencil sketching techniques to try in your next creation. Read on to discover our top sketching tips and techniques.
The shades, textures and shadows you are able to create on the page are not entirely limited by your breadth of techniques. Without proper knowledge of your equipment, you could be limiting yourself significantly. Generally, softer graphite pencils will allow a darker, softer tone, while harder graphite will offer a harder line and a more pointed end. For most effective work, having a few pencil options in your sketching tool kit is essential.
Everyone has created idle scribbles on a piece of paper when waiting on hold during a telephone call. But scribbling is actually a drawing technique that can be very effective. The characteristics of a scribbled sketch can be identified by the erratic, uneven and definitely not straight lines within the piece. Using random movements across the paper will result in a somewhat deconstructed image, and the more irregular lines created closer together, the darker it will appear.
To add a cleaner shading element to your drawing, you can try smooth shading. This can be done in a number of ways, including using your finger or a rolled-up piece of paper to blend in hatching or cross-hatching This will give your sketch a smoother appearance. You can also blend simply by angling your pencil to utilise the wider edge, creating thicker lines that create the appearance of shadows and shading.
Just as you would add shading to create depth and shadows to your sketch, you can also create highlights. Highlights can help indicate where your light source is coming from and add extra detail, showing reflective surfaces. One great way to create this effect is by using an eraser to remove some of the pigment or shading to create lighter areas to indicate the absence of darkness.
We stock drawing pencils from leading art brands like Faber-Castell, Daler-Rowney and more. We also offer a fantastic selection of erasers and sketching pads and paper. Shop our range to experiment with your pencil drawing technique!
Sketching is a distinctive form of drawing which designers use to propose, explore, refine and communicate ideas. As a UX designer, you too can use sketching as your first line of attack to crack a design problem.
Sketches are easy, fast, and cheap to create, iterate, and if needed, even discard without much effort. Unlike written or verbal communication, sketches sidestep rules of grammar and help clearly communicate ideas, all but eliminating misunderstandings. And the best part, they are a joy to create and document!
The design funnel below illustrates the iterative and exploratory nature of sketches during the ideation stage of the design process. As the right design comes clearer into focus (the narrowing shaded trapezium), the costs of the product development cycle (arrow) increase. Increased costs prevent you from fundamentally altering your design choices. Use sketches during the initial, ideation phases. Towards the later stages of the design process, apply usability engineering on more refined and costly prototypes that can simulate the expected functionality.
The design funnel illustrates the use of sketching to identify the right design, and the application of usability methods to refine the design. As investment increases (arrow), you lose the ability to make major changes to the design selected.
Use sketching in the early stages of the design funnel to explore multiple design directions at low cost. Refrain from developing low- or high-fidelity prototypes at this stage. Discard promising leads that, upon closer inspection, are unable to meet your problem requirements.
In the early stages of the design process, you should explore multiple design ideas simultaneously to identify the right design. Sketching out alternatives is the fastest and cheapest way to explore ideas.
3a8082e126