Class: UI::SpriteStack
- Defined in:
- docs/4_Systems_000_General_4_UI_Generics.rb
Overview
Class that helps to define a single object constitued of various sprites. With this class you can move the sprites as a single sprite, change the data that generate the sprites and some other cool stuff
Direct Known Subclasses
BattleUI::AbilityBar, BattleUI::ExpDistribution, BattleUI::ExpDistribution::PokemonInfo, BattleUI::ExpDistribution::Statistics, BattleUI::GenericChoice, BattleUI::InfoBar, BattleUI::PlayerChoice::ItemInfo, BattleUI::PlayerChoice::SpecialButton, BattleUI::PlayerChoice::SubChoice, BattleUI::SkillChoice::MoveButton, BattleUI::SkillChoice::MoveDescription, BattleUI::SkillChoice::MoveInfo, BattleUI::SkillChoice::SpecialButton, BattleUI::SkillChoice::SubChoice, BattleUI::TargetSelection, BattleUI::TargetSelection::Button, BattleUI::TrainerPartyBalls, GTS::Button, GTS::LoadingScreen, Bag::ButtonList::ItemButton, Bag::InfoCompact, Bag::InfoWide, Bag::PocketList, Bag::ScrollBar, Bag::SearchBar, Bag::WinPocket, Casino::NumberDisplay, ContestJudge, ContestSkillChoice::ContestMoveButton, ContestSkillChoice::ContestMoveDescription, ContestSkillChoice::ContestSpecialButton, ContestSkillChoice::ContestSubChoice, CoordinatorWithContestantSprite, DexButton, DexSeenGot, DexWinInfo, DexWinMap, DexWinSprite, GenericBase, GenericBase::ControlButton, HMBarScene::HMBarAnimation, Hall_of_Fame::Congratulation_Text_Box, Hall_of_Fame::Dead_Pokemon_Text, Hall_of_Fame::End_Stars_Animation, Hall_of_Fame::Graveyard_Animation_Stack, Hall_of_Fame::League_Champion_Text_Box, Hall_of_Fame::Party_Battler_Stack, Hall_of_Fame::Pokemon_Battler_Stack, Hall_of_Fame::Pokemon_Stars_Animation, Hall_of_Fame::Pokemon_Text_Box, Hall_of_Fame::Trainer_Infos_Text_Box, Hall_of_Fame::Type_Background, InfoBox, InfoBox::ScoreBar, InputNumber, KeyBindingViewer, MapPanel, MegaEvolveAnimation, MiningGame::Diggable_Stack, MiningGame::Hit_Counter_Stack, MiningGame::Tiles_Stack, MiningGame::Tool_Buttons, MoveTeaching::BaseBackground, MoveTeaching::NewSkill, MoveTeaching::PokemonInfos, MoveTeaching::Skill, MoveTeaching::SkillDescription, Options::Button, Options::Description, PSDKMenuButtonBase, Quest::CategoryDisplay, Quest::Composition, Quest::ObjectiveList, Quest::QuestButton, Quest::QuestList, Quest::RewardButton, Quest::RewardScreen, Quest::ScrollBar, QuestInformer, ResultBanner, RibbonSprite, SaveSign, UI::Shop::ItemDesc, UI::Shop::ItemList::ListButton, UI::Shop::MoneyWindow, UI::Shop::PkmDesc, UI::Shop::PkmList::ListButtonPkm, UI::Shop::PkmScrollBar, UI::Shop::ScrollBar, ShortcutElement, UI::Storage::BoxStack, UI::Storage::Composition, UI::Storage::DetailedSearch, UI::Storage::PartyStack, UI::Storage::RapidSearch, UI::Storage::Summary, Summary_Memo, Summary_Ribbons, Summary_Skill, Summary_Skills, Summary_Stat, Summary_Top, TeamButton, TextScroller, TitleControls, VoltorbFlip::Animation, VoltorbFlip::BoardCounter, VoltorbFlip::BoardTile, VoltorbFlip::Texts
Constant Summary collapse
- NO_INITIAL_IMAGE =
Constant specifiying the sprite will have no image during initialization
nil
Instance Attribute Summary collapse
-
#animated ⇒ Boolean
Section from Yuki::Sprite <<< If the sprite has a self animation.
-
#data
Data used by the sprites of the sprite stack to generate themself.
-
#font_id
writeonly
Set the font id used by the sprite stack for text operations.
-
#moving ⇒ Boolean
If the sprite is moving.
-
#stack
readonly
Get the stack.
-
#viewport ⇒ Viewport
readonly
Get the viewport.
-
#x ⇒ Numeric
X coordinate of the sprite stack.
-
#y ⇒ Numeric
Y coordinate of the sprite stack.
Instance Method Summary collapse
-
#[](index) ⇒ Sprite, Text
Return an element of the stack.
-
#add_background(filename, type: Sprite, rect: nil) ⇒ Sprite
(also: #add_foreground)
Push a background image.
-
#add_line(line_index, str, align = 0, outlinesize = Text::Util::DEFAULT_OUTLINE_SIZE, type: Text, color: nil, dx: 0) ⇒ Text
Add a text inside the stack using metrics given by with_surface.
-
#add_text(x, y, width, height, str, align = 0, outlinesize = Text::Util::DEFAULT_OUTLINE_SIZE, type: Text, color: nil, sizeid: nil) ⇒ Text
Add a text inside the stack, the offset x/y will be adjusted.
-
#anime(arr, delta = 1)
Start an animation.
-
#anime_delta_set(v)
Change the time to wait between each animation message.
-
#dispose
Dispose each sprite of the sprite stack and clear the stack.
-
#each(&block)
yield a block on each sprite.
-
#execute_anime(n)
Force the execution of the n next animation message.
-
#initialize(viewport, x = 0, y = 0, default_cache: :interface) ⇒ SpriteStack
constructor
Create a new Sprite stack.
-
#move(delta_x, delta_y) ⇒ self
Move the sprite stack.
-
#move_to(x, y, nb_frame)
Move the sprite to a specific coordinate in a certain amount of frame.
-
#opacity ⇒ Integer
Gets the opacity of the SpriteStack.
-
#opacity=(value)
Sets the opacity of the SpriteStack.
-
#push(x, y, bmp, *args, rect: nil, type: Sprite, ox: 0, oy: 0) ⇒ Sprite
(also: #add_sprite)
Push a sprite to the stack.
-
#push_sprite(sprite) ⇒ sprite
(also: #add_custom_sprite)
Push a sprite object to the stack.
-
#set_origin(_ox, _oy)
Set the origin (does nothing).
-
#set_position(x, y) ⇒ self
Change the x and y coordinate of the sprite stack.
-
#simple_mouse_in?(mx = Mouse.x, my = Mouse.y) ⇒ Boolean
Detect if the mouse is in the first sprite of the stack.
-
#size ⇒ Integer
(also: #length)
Return the size of the stack.
-
#stop_animation
Stop the animation.
-
#translate_mouse_coords(mx = Mouse.x, my = Mouse.y) ⇒ Array(Numeric, Numeric)
Translate the mouse coordinate to mouse position inside the first sprite of the stack.
-
#update
Update sprite (+move & animation).
-
#update_animation(no_delta)
Update the animation.
-
#update_position
Update the movement.
-
#visible ⇒ Boolean
If the sprite stack is visible.
-
#visible=(value)
Change the visible property of each sprites.
-
#with_cache(cache)
Execute push operations with an alternative cache.
-
#with_font(font_id)
Execute add_text operation with an alternative font.
-
#with_surface(x, y, unit_width, size_id = 0, offset_width = 2)
Execute add_line with specific metrics info.
-
#z ⇒ Numeric
Gets the z of the SpriteStack.
-
#z=(value)
Sets the z of the SpriteStack.
Constructor Details
#initialize(viewport, x = 0, y = 0, default_cache: :interface) ⇒ SpriteStack
Create a new Sprite stack
81 82 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 81 def initialize(, x = 0, y = 0, default_cache: :interface) end |
Instance Attribute Details
#animated ⇒ Boolean
Section from Yuki::Sprite <<< If the sprite has a self animation
233 234 235 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 233 def animated @animated end |
#data
Data used by the sprites of the sprite stack to generate themself
67 68 69 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 67 def data @data end |
#font_id=(value) (writeonly)
Set the font id used by the sprite stack for text operations
75 76 77 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 75 def font_id=(value) @font_id = value end |
#moving ⇒ Boolean
If the sprite is moving
236 237 238 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 236 def moving @moving end |
#stack (readonly)
Get the stack
69 70 71 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 69 def stack @stack end |
#viewport ⇒ Viewport (readonly)
Get the viewport
72 73 74 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 72 def @viewport end |
#x ⇒ Numeric
X coordinate of the sprite stack
62 63 64 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 62 def x @x end |
#y ⇒ Numeric
Y coordinate of the sprite stack
65 66 67 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 65 def y @y end |
Instance Method Details
#[](index) ⇒ Sprite, Text
Return an element of the stack
165 166 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 165 def [](index) end |
#add_background(filename, type: Sprite, rect: nil) ⇒ Sprite Also known as: add_foreground
Push a background image
113 114 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 113 def add_background(filename, type: Sprite, rect: nil) end |
#add_line(line_index, str, align = 0, outlinesize = Text::Util::DEFAULT_OUTLINE_SIZE, type: Text, color: nil, dx: 0) ⇒ Text
Add a text inside the stack using metrics given by with_surface
160 161 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 160 def add_line(line_index, str, align = 0, outlinesize = Text::Util::DEFAULT_OUTLINE_SIZE, type: Text, color: nil, dx: 0) end |
#add_text(x, y, width, height, str, align = 0, outlinesize = Text::Util::DEFAULT_OUTLINE_SIZE, type: Text, color: nil, sizeid: nil) ⇒ Text
Add a text inside the stack, the offset x/y will be adjusted
106 107 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 106 def add_text(x, y, width, height, str, align = 0, outlinesize = Text::Util::DEFAULT_OUTLINE_SIZE, type: Text, color: nil, sizeid: nil) end |
#anime(arr, delta = 1)
Start an animation
252 253 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 252 def anime(arr, delta = 1) end |
#anime_delta_set(v)
Change the time to wait between each animation message
269 270 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 269 def anime_delta_set(v) end |
#dispose
Dispose each sprite of the sprite stack and clear the stack
228 229 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 228 def dispose end |
#each(&block)
yield a block on each sprite
225 226 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 225 def each(&block) end |
#execute_anime(n)
this method is used in animation message Array
Force the execution of the n next animation message
261 262 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 261 def execute_anime(n) end |
#move(delta_x, delta_y) ⇒ self
Move the sprite stack
190 191 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 190 def move(delta_x, delta_y) end |
#move_to(x, y, nb_frame)
Move the sprite to a specific coordinate in a certain amount of frame
244 245 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 244 def move_to(x, y, nb_frame) end |
#opacity ⇒ Integer
Gets the opacity of the SpriteStack
273 274 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 273 def opacity end |
#opacity=(value)
Sets the opacity of the SpriteStack
277 278 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 277 def opacity=(value) end |
#push(x, y, bmp, *args, rect: nil, type: Sprite, ox: 0, oy: 0) ⇒ Sprite Also known as: add_sprite
Push a sprite to the stack
92 93 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 92 def push(x, y, bmp, *args, rect: nil, type: Sprite, ox: 0, oy: 0) end |
#push_sprite(sprite) ⇒ sprite Also known as: add_custom_sprite
Push a sprite object to the stack
119 120 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 119 def push_sprite(sprite) end |
#set_origin(_ox, _oy)
this function is only for compatibility, it does nothing
Set the origin (does nothing)
196 197 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 196 def set_origin(_ox, _oy) end |
#set_position(x, y) ⇒ self
Change the x and y coordinate of the sprite stack
184 185 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 184 def set_position(x, y) end |
#simple_mouse_in?(mx = Mouse.x, my = Mouse.y) ⇒ Boolean
Detect if the mouse is in the first sprite of the stack
211 212 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 211 def simple_mouse_in?(mx = Mouse.x, my = Mouse.y) end |
#size ⇒ Integer Also known as: length
Return the size of the stack
169 170 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 169 def size end |
#stop_animation
this method is used in the animation message Array (because animation loops)
Stop the animation
265 266 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 265 def stop_animation end |
#translate_mouse_coords(mx = Mouse.x, my = Mouse.y) ⇒ Array(Numeric, Numeric)
Translate the mouse coordinate to mouse position inside the first sprite of the stack
217 218 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 217 def translate_mouse_coords(mx = Mouse.x, my = Mouse.y) end |
#update
Update sprite (+move & animation)
238 239 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 238 def update end |
#update_animation(no_delta)
Update the animation
256 257 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 256 def update_animation(no_delta) end |
#update_position
Update the movement
247 248 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 247 def update_position end |
#visible ⇒ Boolean
Return the visible property of the first sprite
If the sprite stack is visible
201 202 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 201 def visible end |
#visible=(value)
Change the visible property of each sprites
205 206 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 205 def visible=(value) end |
#with_cache(cache)
Execute push operations with an alternative cache
127 128 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 127 def with_cache(cache) end |
#with_font(font_id)
Execute add_text operation with an alternative font
134 135 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 134 def with_font(font_id) end |
#with_surface(x, y, unit_width, size_id = 0, offset_width = 2)
Execute add_line with specific metrics info
149 150 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 149 def with_surface(x, y, unit_width, size_id = 0, offset_width = 2) end |
#z ⇒ Numeric
Gets the z of the SpriteStack
281 282 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 281 def z end |
#z=(value)
Sets the z of the SpriteStack
284 285 |
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 284 def z=(value) end |