[Newbies] Porting BallonMorph to Processing (Java)

Werner Gaisbauer werner.gaisbauer at gmail.com
Mon Aug 13 19:23:16 UTC 2012


Ben, thanks I'll look into this.

Cheers, Werner

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 [1] & [2]).  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.  
> 
> [1] http://squeak.preeminent.org/tut2007/html/095.html
> [2] http://marianopeck.wordpress.com/2012/05/19/pharo-tips-and-tricks/
> 
> cheers -ben
> 
> Werner Gaisbauer wrote:
>> 
>> Hello,
>> 
>> 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
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>   
> 
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20120813/77f836fb/attachment.htm


More information about the Beginners mailing list