Re: Multiple includes

new topic     » topic index » view thread      » older message » newer message

kbochert at copper.net wrote:

>class Rect
>atom x1, x2, y1, y2
>endclass
>
>method Resize(atom way, atom perc)
>    if way = RECT_EXPAND_HORIZONTAL then
>       .x2 *= perc
>    elsif way = RECT_EXPAND_VERTICAL then
>       .y2 *= perc
>    else
>       .x2 *= perc
>       .y2 *= perc
>    end if
>end method
>
>1) the class declaration only contains the data.
>2) methods are attached to the most recently- refined class
>3) class members are referenced with a leading '.'
>4) a method may or may not return a value. A returned value
>may be ignored.
>
>More refinements:
>
>class Rect
>atom x1 = 0, x2 = 0, y1, y2
>constant HORIZONTAL = 1,
>              VERTICAL = 2
>endclass
>
>method Resize(atom perc, way = 0)
>    if way = .HORIZONTAL then
>       .x2 *= perc
>    elsif way = .VERTICAL then
>       .y2 *= perc
>    else
>       .x2 *= perc
>       .y2 *= perc
>    end if
>end method
>...
>Rect myrect   -- x1 and x2 are initialized to 0
>myrect.x2 = 3
>myrect.y2 = 3
>myrect.Resize(5)    -- resize both x and y
>myrect.Resize(3, Rect.VERTICAL)
>
>Karl Bochert
>  
>
Karl,

Do you provide a reasonable amount of sample code with the Bach 
download? I did see a screenshot of the graphics subsystem, but how 
about something more complicated? Also, is Bach x-plat?

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu