Module: OR2D
- Defined in:
- lib/or2d.rb,
lib/or2d/scene.rb,
lib/or2d/camera.rb,
lib/or2d/entity.rb,
lib/or2d/console.rb,
lib/or2d/instance.rb,
lib/or2d/animation.rb,
lib/or2d/composite.rb
Overview
The top-level module for the OR2D gem.
Defined Under Namespace
Modules: Animations, Cameras, Composites, Resource, Scenes Classes: Animation, Camera, Composite, Console, Entity, Instance, Scene
Class Method Summary collapse
-
.debug? ⇒ Boolean
Is debug mode enabled?.
-
.game ⇒ OR2D::Instance
The game instance.
-
.lowest_font_size ⇒ Integer
The lowest font size that can be used.
-
.lowest_scalable_height ⇒ Integer
The lowest height that the game window can be scaled to.
-
.lowest_scalable_width ⇒ Integer
The lowest width that the game window can be scaled to.
-
.scale ⇒ Integer
The scale of the game window and all of its contents.
Class Method Details
.debug? ⇒ Boolean
Is debug mode enabled?
57 58 59 |
# File 'lib/or2d.rb', line 57 def self.debug? ENV['OR2D_DEBUG'] && %w[1 true yes].include?(ENV['OR2D_DEBUG'].downcase) end |
.game ⇒ OR2D::Instance
The game instance.
97 98 99 |
# File 'lib/or2d.rb', line 97 def self.game OR2D::Instance.instance end |
.lowest_font_size ⇒ Integer
The lowest font size that can be used.
79 80 81 |
# File 'lib/or2d.rb', line 79 def self.lowest_font_size 8 end |
.lowest_scalable_height ⇒ Integer
The lowest height that the game window can be scaled to.
-
It is not recommended to scale the game window below this height.
-
It is also not recommended to change this value.
73 74 75 |
# File 'lib/or2d.rb', line 73 def self.lowest_scalable_height 360 end |
.lowest_scalable_width ⇒ Integer
The lowest width that the game window can be scaled to.
-
It is not recommended to scale the game window below this width.
-
It is also not recommended to change this value.
65 66 67 |
# File 'lib/or2d.rb', line 65 def self.lowest_scalable_width 640 end |
.scale ⇒ Integer
The scale of the game window and all of its contents.
-
This value is calculated by dividing the game window’s width and height by the lowest scalable width and height.
86 87 88 89 90 91 92 93 |
# File 'lib/or2d.rb', line 86 def self.scale ENV['OR2D_SCALE']&.to_i || if ENV['OR2D_WIDTH']&.to_i && ENV['OR2D_HEIGHT']&.to_i [ENV['OR2D_WIDTH'].to_i / lowest_scalable_width, ENV['OR2D_HEIGHT'].to_i / lowest_scalable_height].max else 1 end end |