[Newbies] Porting BallonMorph to Processing (Java)
werner.gaisbauer at gmail.com
Mon Aug 13 19:23:16 UTC 2012
Ben, thanks I'll look into this.
On Aug 12, 2012, at 1:26 PM, Ben Coman <btc at openInWorld.com> wrote:
> Since I am not familiar with BalloonMorph, I will answer generically, and how I would go about learning it...
> One way to try to understand this, insert the line "self haltOnce." in front of "corner :="
> then enable Halt Once (see  & ). The highlight and Inspect various bits of the code and single-step through the debugger watching how it does its stuff.
> The other main advantage of this as opposed to just trying to understand the code from reading it, is that you get to see what calls this method and in what context.
>  http://squeak.preeminent.org/tut2007/html/095.html
>  http://marianopeck.wordpress.com/2012/05/19/pharo-tips-and-tricks/
> cheers -ben
> Werner Gaisbauer wrote:
>> I really like the BallonMorph of Squeak (aka tooltip) and would like to port it to another programming language. But I’m a newbie in Smalltalk and Squeak so I’m having a hard time understanding e.g. the getVertices method. As far as I understand this method creates the vertices of the polygon that is the speech bubble?
>> It would really help me if someone could post this method in e.g. Java (my goal is to port BalloonMorph to Processing - see http://www.processing.org/) or give me some hints on how to read it.
>> Here is the method:
>> getVertices: bounds
>> "Construct vertices for a balloon up and to left of anchor"
>> | corners |
>> corners := bounds corners atAll: #(1 4 3 2).
>> ^ (Array
>> with: corners first + (0 - bounds width // 2 @ 0)
>> with: corners first + (0 - bounds width // 4 @ (bounds height // 2))) , corners
>> Thanks for helping,
>> Werner Gaisbauer
>> Beginners mailing list
>> Beginners at lists.squeakfoundation.org
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners