Rectangle & Ellipse Module in Ruby

Post any examples or modules that you want to share here
User avatar
chackl
Posts: 233
Joined: Tue Aug 17, 2010 8:46 pm
Location: Austria / Salzburg

Rectangle & Ellipse Module in Ruby

Post by chackl »

Hello!

Today a was making some GUI in ruby and as a "Lession" i did a port of the old Rectangle & Ellipse Modules from Synthmaker V3 / FlowStone V2
rect&ell.png
rect&ell.png (112.4 KiB) Viewed 34684 times


As you see i also did properties for config

What is new is the Hatch-Brush.

If you have any ideas for updates/upgrades please write here ;)

Base-Module - Free4Use in any Project.

For all Ruby nerds - please take a look how i did port all variables from te properties to the main module - maybe there is a better solution - if someone could do that ;)


Best Regards
Attachments
rect&ell_v1.1.fsm
(5.32 KiB) Downloaded 1471 times
Last edited by chackl on Tue Nov 05, 2013 3:46 pm, edited 1 time in total.
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
Jay
Posts: 276
Joined: Tue Jul 13, 2010 5:42 pm

Re: Rectangle & Ellipse Module in Ruby

Post by Jay »

very nice m8! cheers for these they will come in really handy! more please! :)

Best Regards
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: Rectangle & Ellipse Module in Ruby

Post by RJHollins »

Very nice modules and coding chackl !

Thanks for sharing your work. These are items needed for most any project.

Thanks again !!
8-)
billv
Posts: 1165
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia
Contact:

Re: Rectangle & Ellipse Module in Ruby

Post by billv »

Very handy at the moment...Thanks for sharing.
Cheers.
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Rectangle & Ellipse Module in Ruby

Post by trogluddite »

Hi chackl - nice stuff, bringing some of the new Ruby graphics options to a simple module. :)

Here's my version of the "options hasher". The @vals data is stored using the saveState/loadState methods, so there's no need for the 'input scanner, so there are far fewer events and triggers kicking about...
Options Hasher.fsm
(1.31 KiB) Downloaded 1550 times


PS) Ruby instance variables (NOT local variables) can always be read, even before they are declared - returning nil if undefined. And there is a shorthand method for testing nils, ".nil?"
So...

Code: Select all

defined?(@vars) == nil

...can be simply written as...

Code: Select all

@vars.nil?


The "||=" that's used in my code is also very handy in situations like this. It's usually known as "OR-equals" - if the variable is undefined, nil or false, it gets assigned the right hand value, otherwise the old value is kept. Just take care if the variable is holding a boolean (true/false) value, though, as 'false' would be overwritten!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
chackl
Posts: 233
Joined: Tue Aug 17, 2010 8:46 pm
Location: Austria / Salzburg

Re: Rectangle & Ellipse Module in Ruby

Post by chackl »

Thanks for the example i'll update it within the next version :D

And thanks for the little ruby lesson :D - I've just began to understand ruby and i'm now experimenting with custom objects and classes.

Thank you :D
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
billv
Posts: 1165
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia
Contact:

Re: Rectangle & Ellipse Module in Ruby

Post by billv »

@chackl..... may have a little bug...
if change fill style to 'solid'
.no color changes possible.... no hatching either... ??..
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: Rectangle & Ellipse Module in Ruby

Post by nix »

love the hatching brushes mr. Hackl
is it possible somehow to define the size of the hatches?
User avatar
chackl
Posts: 233
Joined: Tue Aug 17, 2010 8:46 pm
Location: Austria / Salzburg

Re: Rectangle & Ellipse Module in Ruby

Post by chackl »

nix wrote:love the hatching brushes mr. Hackl
is it possible somehow to define the size of the hatches?

Thanks ;)
Well i did not find anything - if someone finds a metode i can add it ;)
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
User avatar
chackl
Posts: 233
Joined: Tue Aug 17, 2010 8:46 pm
Location: Austria / Salzburg

Re: Rectangle & Ellipse Module in Ruby

Post by chackl »

billv wrote:@chackl..... may have a little bug...
if change fill style to 'solid'
.no color changes possible.... no hatching either... ??..


Well a hatch allways needs 2 colors ;)
So Hatch is an addition to solid/Linear/Radial.
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
Post Reply