Class: Scruffy::Renderers::Cubed3d

Inherits:
Empty
  • Object
show all
Defined in:
lib/scruffy/renderers/cubed3d.rb

Overview

Scruffy::Renderers::Cubed3d

Author

Brasten Sager

Date

August 17th, 2006

A 3-dimensional cube effect.

Constant Summary collapse

VIEWPORT_SIZE =
[25, 45]
VIEWPORTS =
{ :top_left => [10, 25],
:top_right => [55, 25],
:bottom_left => [10, 65],
:bottom_right => [55, 65] }

Instance Attribute Summary

Attributes inherited from Base

#options

Attributes included from Helpers::Canvas

#components

Instance Method Summary collapse

Methods inherited from Base

#before_render, #initialize, #method_missing, #render

Methods included from Helpers::Canvas

#component, #remove, #reset_settings!

Constructor Details

This class inherits a constructor from Scruffy::Renderers::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Scruffy::Renderers::Base

Instance Method Details

#define_layoutObject

Returns a Cubed instance.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/scruffy/renderers/cubed3d.rb', line 16

def define_layout
  super do |components|
    components << Scruffy::Components::Title.new(:title, :position => [5, 2], :size => [90, 7])
                  
    components << Scruffy::Components::Viewport.new(:one, :position => [10, 50], 
                                                    :size => VIEWPORT_SIZE, :skewY => '-25', 
                                                    &graph_block(:one))
    components << Scruffy::Components::Viewport.new(:two, :position => [30, 50], 
                                                    :size => VIEWPORT_SIZE, :skewY => '-25', 
                                                    &graph_block(:two))
    components << Scruffy::Components::Viewport.new(:three, :position => [50, 50], 
                                                    :size => VIEWPORT_SIZE, :skewY => '-25', 
                                                    &graph_block(:three))
    components << Scruffy::Components::Viewport.new(:four, :position => [70, 50], 
                                                    :size => VIEWPORT_SIZE, :skewY => '-25', 
                                                    &graph_block(:four))


    components << Scruffy::Components::Legend.new(:legend, :position => [5, 13], :size => [90, 5])
  end
end