Class: Text
- Inherits:
- LiteRGSS::Text show all
- Defined in:
- scripts/00000 Dependencies/00001 LiteRGSS2/00003 Drawable.rb,
scripts/00700 Ajout_PSDK/01800 XXX_simple_mouse_in_.rb
Overview
Class that describes a text shown on the screen or inside a viewport
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from LiteRGSS::Text
#__index__, #align, #bold, #draw_shadow, #fill_color, #height, #italic, #nchar_draw, #opacity, #outline_color, #outline_thickness, #real_width, #size, #text, #viewport, #visible, #width, #x, #y, #z
Instance Method Summary collapse
-
#simple_mouse_in?(mouse_x = Mouse.x, mouse_y = Mouse.y) ⇒ Boolean
Detect if the mouse is in the sprite (without rotation and stuff like that).
-
#translate_mouse_coords(mouse_x = Mouse.x, mouse_y = Mouse.y) ⇒ Array(Integer, Integer)
Convert mouse coordinate on the screen to mouse coordinates on the sprite.
Methods inherited from LiteRGSS::Text
#load_color, #multiline_text=, new, #set_position, #text_width
Methods inherited from LiteRGSS::Disposable
Instance Method Details
#simple_mouse_in?(mouse_x = Mouse.x, mouse_y = Mouse.y) ⇒ Boolean
Detect if the mouse is in the sprite (without rotation and stuff like that)
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'scripts/00700 Ajout_PSDK/01800 XXX_simple_mouse_in_.rb', line 62 def simple_mouse_in?(mouse_x = Mouse.x, mouse_y = Mouse.y) if return false unless .simple_mouse_in?(mouse_x, mouse_y) mouse_x, mouse_y = .translate_mouse_coords(mouse_x, mouse_y) end bx = x by = y return false if mouse_x < bx || mouse_y < by bx += width by += height return false if mouse_x >= bx || mouse_y >= by true end |
#translate_mouse_coords(mouse_x = Mouse.x, mouse_y = Mouse.y) ⇒ Array(Integer, Integer)
Convert mouse coordinate on the screen to mouse coordinates on the sprite
81 82 83 84 85 86 |
# File 'scripts/00700 Ajout_PSDK/01800 XXX_simple_mouse_in_.rb', line 81 def translate_mouse_coords(mouse_x = Mouse.x, mouse_y = Mouse.y) mouse_x, mouse_y = .translate_mouse_coords(mouse_x, mouse_y) if mouse_x -= x mouse_y -= y return mouse_x, mouse_y end |