Sha256: 0923ec52efcb9ff8a89ac97f07a3bc28e9e8ad1cbf85023e411b3418b6e53e20

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

module PPCurses

  class Point

    attr_accessor :x, :y

    def initialize( x=0, y=0 )
      @x = x
      @y = y
    end

    def to_s
      "x=#{@x} y=#{@y}"
    end

    def Point.zeroPoint
      Point.new
    end

  end

# -------------------------------------------------------------------

  class Size
    attr_accessor :width, :height
    
    def initialize( width=0, height=0 )
      @width = width
      @height = height
    end
    
    def Size.zeroSize
      Size.new
    end
    
    def to_s
      "width=#{@width} height=#{@height}"
    end
    
  end

# -------------------------------------------------------------------

  class Rect
    attr_accessor :origin, :size
   
    def initialize ( origin, size )
      @origin = origin
      @size = size
    end
   
    def Rect.makeRect( x, y, w, h )
      origin = Point.new(x, y)
      size  = Size.new(w, h)
      
      rect = Rect.new( origin, size)
    end
   
    def Rect.zeroRect
      Rect.new( Point.zeroPoint, Size.zeroSize )
    end
   
    def to_s
      "origin[#{@origin}] size[#{@size}]"
    end
    
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ppcurses-0.1.2 lib/ppcurses/geometry.rb
ppcurses-0.1.1 lib/ppcurses/geometry.rb