Class: Input::Prompt

Inherits:
Text show all
Defined in:
mygame/lib/sprite_kit/vendor/input.rb

Constant Summary

Constants inherited from Base

Base::CURSOR_FLASH_TICKS, Base::CURSOR_FULL_TICKS, Base::CURSOR_HOT_TICKS

Constants included from Keyboard

Keyboard::ALT_KEYS, Keyboard::CTRL_KEYS, Keyboard::IGNORE_KEYS, Keyboard::META_KEYS, Keyboard::SHIFT_KEYS

Instance Attribute Summary

Attributes inherited from Base

#content_h, #content_w, #cursor_x, #cursor_y, #font_height, #readonly, #scroll_h, #scroll_w, #scroll_x, #scroll_y, #selection_end, #selection_start, #value, #value_changed

Attributes included from Keyboard

#shift_lock

Instance Method Summary collapse

Methods inherited from Text

#draw_override, #find_index_at_x, #handle_keyboard, #handle_mouse, #initialize, #prepare_render_target

Methods inherited from Base

#append, #blur, #content_rect, #copy, #current_selection, #current_word, #cut, #delete_forward, #draw_cursor, #draw_override, #find, #find_next, #find_prev, #find_word_break_left, #find_word_break_right, #focus, #focussed?, #initialize, #insert, #insert_at, #move_char_left, #move_char_right, #move_to_end, #move_to_start, #move_word_left, #move_word_right, #paste, #rect, #scroll_rect, #select_all, #select_char_left, #select_char_right, #select_to_end, #select_to_start, #select_word_left, #select_word_right, #size_enum, #size_px, #value_changed?

Methods included from Keyboard

#initialize_keyboard, #prepare_special_keys

Methods included from Util

#parse_color, #parse_color_nilable, #position_in_window

Constructor Details

This class inherits a constructor from Input::Text

Instance Method Details

#clear ⇒ Object



2005
2006
2007
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 2005

def clear
  self.value = ''
end

#delete_back ⇒ Object



2019
2020
2021
2022
2023
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 2019

def delete_back
  @selection_start -= 1 if @selection_start == @selection_end
  @selection_end -= 1 if @shift_lock # override so delete behaves in a way that makes sense
  insert('')
end

#render(args, x:, y:) ⇒ Object



1994
1995
1996
1997
1998
1999
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 1994

def render(args, x:, y:)
  @x = x
  @y = y
  @args = args
  args.outputs.reserved << self
end

#str_len ⇒ Object



2001
2002
2003
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 2001

def str_len
  101 # to short circuit hint logic
end

#tick ⇒ Object



2009
2010
2011
2012
2013
2014
2015
2016
2017
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 2009

def tick
  super

  # prevent keys from reaching game
  @args.inputs.text.clear
  @args.inputs.keyboard.key_down.clear
  @args.inputs.keyboard.key_up.clear
  @args.inputs.keyboard.key_held.clear
end