Class: Processing::App
- Inherits:
-
PApplet
- Object
- PApplet
- Processing::App
- Includes:
- FastNoise, Math, MathTool, HelperMethods, Render
- Defined in:
- lib/picrate/app.rb
Overview
All sketches extend this class
Class Attribute Summary collapse
-
.arguments ⇒ Object
Handy getters and setters on the class go here:.
-
.height ⇒ Object
readonly
Returns the value of attribute height.
-
.library_loader ⇒ Object
Handy getters and setters on the class go here:.
-
.mode ⇒ Object
readonly
Returns the value of attribute mode.
-
.options ⇒ Object
Handy getters and setters on the class go here:.
-
.sketch_class ⇒ Object
Handy getters and setters on the class go here:.
-
.surface ⇒ Object
readonly
Returns the value of attribute surface.
-
.width ⇒ Object
readonly
Returns the value of attribute width.
Class Method Summary collapse
-
.inherited(subclass) ⇒ Object
Keep track of what inherits from the Processing::App, because we’re going to want to instantiate one.
- .library_loaded?(library_name) ⇒ Boolean
- .load_java_library(*args) ⇒ Object
- .load_libraries(*args) ⇒ Object (also: load_library)
- .load_ruby_library(*args) ⇒ Object
-
.method_added(method_name) ⇒ Object
When certain special methods get added to the sketch, we need to let Processing call them by their expected Java names.
Instance Method Summary collapse
- #data_path(dat) ⇒ Object
-
#initialize(options = {}, arguments = []) ⇒ App
constructor
A new instance of App.
- #library_loaded?(library_name) ⇒ Boolean
- #post_initialize(_args) ⇒ Object
- #size(*args) ⇒ Object
- #sketch_class ⇒ Object
- #sketch_title(title) ⇒ Object
Methods included from HelperMethods
#blend_color, #buffer, #color, #dist, #find_method, #frame_rate, #hsb_color, #int_to_ruby_colors, #java_self, #kamera, #key, #key_pressed?, #lerp_color, #load_strings, #max, #min, #mouse_pressed?, #perspektiv, #proxy_java_fields, #save_strings, #thread, #web_to_color_array
Constructor Details
#initialize(options = {}, arguments = []) ⇒ App
Returns a new instance of App.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/picrate/app.rb', line 119 def initialize( = {}, arguments = []) # Guard against invalid input. proxy_java_fields raise TypeError unless .is_a?(Hash) && arguments.is_a?(Array) # Set up the sketch. super() post_initialize() Processing.app = self @arguments = arguments = @surface = get_surface run_picrate end |
Class Attribute Details
.arguments ⇒ Object
Handy getters and setters on the class go here:
86 87 88 |
# File 'lib/picrate/app.rb', line 86 def arguments @arguments end |
.height ⇒ Object (readonly)
Returns the value of attribute height.
87 88 89 |
# File 'lib/picrate/app.rb', line 87 def height @height end |
.library_loader ⇒ Object
Handy getters and setters on the class go here:
86 87 88 |
# File 'lib/picrate/app.rb', line 86 def library_loader @library_loader end |
.mode ⇒ Object (readonly)
Returns the value of attribute mode.
87 88 89 |
# File 'lib/picrate/app.rb', line 87 def mode @mode end |
.options ⇒ Object
Handy getters and setters on the class go here:
86 87 88 |
# File 'lib/picrate/app.rb', line 86 def end |
.sketch_class ⇒ Object
Handy getters and setters on the class go here:
86 87 88 |
# File 'lib/picrate/app.rb', line 86 def sketch_class @sketch_class end |
.surface ⇒ Object (readonly)
Returns the value of attribute surface.
87 88 89 |
# File 'lib/picrate/app.rb', line 87 def surface @surface end |
.width ⇒ Object (readonly)
Returns the value of attribute width.
87 88 89 |
# File 'lib/picrate/app.rb', line 87 def width @width end |
Class Method Details
.inherited(subclass) ⇒ Object
Keep track of what inherits from the Processing::App, because we’re going to want to instantiate one.
74 75 76 77 |
# File 'lib/picrate/app.rb', line 74 def self.inherited(subclass) super(subclass) @sketch_class = subclass end |
.library_loaded?(library_name) ⇒ Boolean
94 95 96 |
# File 'lib/picrate/app.rb', line 94 def library_loaded?(library_name) library_loader.library_loaded?(library_name) end |
.load_java_library(*args) ⇒ Object
102 103 104 |
# File 'lib/picrate/app.rb', line 102 def load_java_library(*args) library_loader.load_java_library(*args) end |
.load_libraries(*args) ⇒ Object Also known as: load_library
88 89 90 91 |
# File 'lib/picrate/app.rb', line 88 def load_libraries(*args) library_loader ||= LibraryLoader.new library_loader.load_library(*args) end |
.load_ruby_library(*args) ⇒ Object
98 99 100 |
# File 'lib/picrate/app.rb', line 98 def load_ruby_library(*args) library_loader.load_ruby_library(*args) end |
.method_added(method_name) ⇒ Object
When certain special methods get added to the sketch, we need to let Processing call them by their expected Java names.
108 109 110 111 112 |
# File 'lib/picrate/app.rb', line 108 def method_added(method_name) #:nodoc: return unless METHODS_TO_ALIAS.key?(method_name) alias_method METHODS_TO_ALIAS[method_name], method_name end |
Instance Method Details
#data_path(dat) ⇒ Object
145 146 147 148 149 |
# File 'lib/picrate/app.rb', line 145 def data_path(dat) dat_root = File.join(SKETCH_ROOT, 'data') Dir.mkdir(dat_root) unless File.exist?(dat_root) File.join(dat_root, dat).to_java(:string) end |
#library_loaded?(library_name) ⇒ Boolean
115 116 117 |
# File 'lib/picrate/app.rb', line 115 def library_loaded?(library_name) self.class.library_loaded?(library_name) end |
#post_initialize(_args) ⇒ Object
143 |
# File 'lib/picrate/app.rb', line 143 def post_initialize(_args); end |
#size(*args) ⇒ Object
134 135 136 137 138 139 140 141 |
# File 'lib/picrate/app.rb', line 134 def size(*args) w, h, mode = *args @width ||= w @height ||= h @mode ||= mode import_opengl if /opengl/ =~ mode super(*args) end |
#sketch_class ⇒ Object
64 65 66 |
# File 'lib/picrate/app.rb', line 64 def sketch_class self.class.sketch_class end |
#sketch_title(title) ⇒ Object
68 69 70 |
# File 'lib/picrate/app.rb', line 68 def sketch_title(title) surface.set_title(title) end |