Class: DebugShell::Caret

Inherits:
Moon::RenderContainer show all
Defined in:
lib/moon/packages/debug/debug_shell.rb

Instance Attribute Summary

Attributes inherited from Moon::RenderContext

#id

Attributes included from Moon::RenderPrimitive::DataAttributes

#data_attrs

Attributes included from Moon::RenderPrimitive::Rectangular

#position

Attributes included from Moon::RenderPrimitive::Containable

#parent

Instance Method Summary collapse

Methods inherited from Moon::RenderContainer

#add, #clear_elements, #each, #h=, #on_resize, #ppd_rc, #remove, #w=

Methods inherited from Moon::RenderContext

#apply_position_modifier, #post_initialize, #pre_initialize, #render?, #render_abs, #render_content, #screen_bounds, #screen_position

Methods included from Moon::RenderPrimitive::DataAttributes

#initialize_data_attrs

Methods included from Moon::RenderPrimitive::Rectangular

#align!, #bounds, #contains?, #cx, #cx=, #cy, #cy=, #move, #on_resize, #resize, #to_rect, #x, #x2, #x2=, #x=, #y, #y2, #y2=, #y=, #z, #z=

Methods included from Moon::RenderPrimitive::Containable

#containerize, #disown

Methods included from Moon::RenderPrimitive::Visibility

#hide, #invisible?, #show, #visible?

Methods included from Moon::RenderPrimitive::Renderable

#render?

Methods included from Moon::RenderPrimitive::ScreenElement

#contains_pos?, #relative_contains_pos?, #relative_to_screen, #screen_to_relative

Methods included from Moon::Eventable

#allow_event?, #clear_events, #each_listener, #each_typed_listener, filter_from_options, #has_events?, #initialize_eventable, #off, #on, #ppd_ev, #trigger, #typing

Methods included from Moon::Transitionable

#key_transition, #remove_transitions, #transition

Methods included from Moon::TransitionHost

#add_transition, #finish_transitions, #remove_transition, #remove_transitions, #update_transitions

Constructor Details

#initializeCaret

Returns a new instance of Caret.


3
4
5
6
7
8
9
# File 'lib/moon/packages/debug/debug_shell.rb', line 3

def initialize
  super
  @index = 0
  @spritesheet = Moon::Spritesheet.new("resources/ui/caret_8x16_ffffffff.png", 8, 16)
  #@phase = -1
  #@opacity = 255
end

Instance Method Details

#hObject


15
16
17
# File 'lib/moon/packages/debug/debug_shell.rb', line 15

def h
  @h ||= @spritesheet.cell_h
end

#render(x = 0, y = 0, z = 0, options = {}) ⇒ Object


19
20
21
22
23
24
# File 'lib/moon/packages/debug/debug_shell.rb', line 19

def render(x=0, y=0, z=0, options={})
  px, py, pz = *(@position + [x, y, z])
  @spritesheet.render(px, py, pz, @index)
  #@spritesheet.render(px, py, pz, @index, options.merge(opacity: @opacity))
  super
end

#update(delta) ⇒ Object


26
27
28
29
30
31
32
33
# File 'lib/moon/packages/debug/debug_shell.rb', line 26

def update(delta)
  super
  #@opacity += 255 * @phase * delta
  #if @opacity < 0 || @opacity > 255
  #  @phase = [email protected]
  #  @opacity = [[@opacity, 0].max, 255].min
  #end
end

#wObject


11
12
13
# File 'lib/moon/packages/debug/debug_shell.rb', line 11

def w
  @w ||= @spritesheet.cell_w
end