Module: RPG::Cache

Defined in:
docs/0_Dependencies.rb

Overview

Script that cache bitmaps when they are reusable.

Author:

  • Nuri Yuri

Constant Summary collapse

LOADS =

Array of load methods to call when the game starts

%i[load_animation load_autotile load_ball load_battleback load_battler load_character load_fog load_icon load_panorama load_particle load_pc load_picture load_pokedex load_title load_tileset load_transition load_interface load_foot_print load_b_icon load_poke_front load_poke_back]
GIF_EXTENSION =

Extension of gif files

'.gif'
Common_filename =

Common filename of the image to load

'Graphics/%s/%s'
Common_filename_format =

Common filename with .png

format('%s.png', Common_filename)
Notification_title =

Notification message when an image couldn't be loaded properly

'Failed to load graphic'
Autotiles_Path =

Path where autotiles are stored from Graphics

'autotiles'
Animations_Path =

Path where animations are stored from Graphics

'animations'
Ball_Path =

Path where ball are stored from Graphics

'ball'
BattleBacks_Path =

Path where battlebacks are stored from Graphics

'battlebacks'
Battlers_Path =

Path where battlers are stored from Graphics

'battlers'
Characters_Path =

Path where characters are stored from Graphics

'characters'
Fogs_Path =

Path where fogs are stored from Graphics

'fogs'
Icons_Path =

Path where icons are stored from Graphics

'icons'
Interface_Path =

Path where interface are stored from Graphics

'interface'
Panoramas_Path =

Path where panoramas are stored from Graphics

'panoramas'
Particles_Path =

Path where particles are stored from Graphics

'particles'
PC_Path =

Path where pc are stored from Graphics

'pc'
Pictures_Path =

Path where pictures are stored from Graphics

'pictures'
Pokedex_Path =

Path where pokedex images are stored from Graphics

'pokedex'
Titles_Path =

Path where titles are stored from Graphics

'titles'
Tilesets_Path =

Path where tilesets are stored from Graphics

'tilesets'
Transitions_Path =

Path where transitions are stored from Graphics

'transitions'
Windowskins_Path =

Path where windowskins are stored from Graphics

'windowskins'
Pokedex_FootPrints_Path =

Path where footprints are stored from Graphics

'pokedex/footprints'
Pokedex_PokeIcon_Path =

Path where pokeicon are stored from Graphics

'pokedex/pokeicon'
Pokedex_PokeFront_Path =

Path where pokefront are stored from Graphics

['pokedex/pokefront', 'pokedex/pokefrontshiny']
Pokedex_PokeBack_Path =

Path where pokeback are stored from Graphics

['pokedex/pokeback', 'pokedex/pokebackshiny']

Class Method Summary collapse

Class Method Details

.animation(filename, _hue = 0) ⇒ Texture

Load an animation image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2062
2063
# File 'docs/0_Dependencies.rb', line 2062

def animation(filename, _hue = 0)
end

.animation_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2056
2057
# File 'docs/0_Dependencies.rb', line 2056

def animation_exist?(filename)
end

.autotile(filename, _hue = 0) ⇒ Texture

Load an autotile image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2077
2078
# File 'docs/0_Dependencies.rb', line 2077

def autotile(filename, _hue = 0)
end

.autotile_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2071
2072
# File 'docs/0_Dependencies.rb', line 2071

def autotile_exist?(filename)
end

.b_icon(filename, _hue = 0) ⇒ Texture

Load a Pokemon icon image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2357
2358
# File 'docs/0_Dependencies.rb', line 2357

def b_icon(filename, _hue = 0)
end

.b_icon_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2351
2352
# File 'docs/0_Dependencies.rb', line 2351

def b_icon_exist?(filename)
end

.ball(filename, _hue = 0) ⇒ Texture

Load ball animation image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2092
2093
# File 'docs/0_Dependencies.rb', line 2092

def ball(filename, _hue = 0)
end

.ball_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2086
2087
# File 'docs/0_Dependencies.rb', line 2086

def ball_exist?(filename)
end

.battleback(filename, _hue = 0) ⇒ Texture

Load a battle back image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2107
2108
# File 'docs/0_Dependencies.rb', line 2107

def battleback(filename, _hue = 0)
end

.battleback_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2101
2102
# File 'docs/0_Dependencies.rb', line 2101

def battleback_exist?(filename)
end

.battler(filename, _hue = 0) ⇒ Texture

Load a battler image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2122
2123
# File 'docs/0_Dependencies.rb', line 2122

def battler(filename, _hue = 0)
end

.battler_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2116
2117
# File 'docs/0_Dependencies.rb', line 2116

def battler_exist?(filename)
end

.character(filename, _hue = 0) ⇒ Texture

Load a character image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2137
2138
# File 'docs/0_Dependencies.rb', line 2137

def character(filename, _hue = 0)
end

.character_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2131
2132
# File 'docs/0_Dependencies.rb', line 2131

def character_exist?(filename)
end

.default_bitmap

Note:

Should be used in scripts that require a bitmap be doesn't perform anything on the bitmap

Gets the default bitmap



2018
2019
# File 'docs/0_Dependencies.rb', line 2018

def default_bitmap
end

.dispose_bitmaps_from_cache_tab(cache_tab)

Dispose every bitmap of a cache table

Parameters:

  • cache_tab (Hash{String => Texture}) —

    cache table where bitmaps should be disposed



2022
2023
# File 'docs/0_Dependencies.rb', line 2022

def dispose_bitmaps_from_cache_tab(cache_tab)
end

.fog(filename, _hue = 0) ⇒ Texture

Load a fog image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2152
2153
# File 'docs/0_Dependencies.rb', line 2152

def fog(filename, _hue = 0)
end

.fog_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2146
2147
# File 'docs/0_Dependencies.rb', line 2146

def fog_exist?(filename)
end

.foot_print(filename, _hue = 0) ⇒ Texture

Load a foot print image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2342
2343
# File 'docs/0_Dependencies.rb', line 2342

def foot_print(filename, _hue = 0)
end

.foot_print_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2336
2337
# File 'docs/0_Dependencies.rb', line 2336

def foot_print_exist?(filename)
end

.icon(filename, _hue = 0) ⇒ Texture

Load an icon

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2167
2168
# File 'docs/0_Dependencies.rb', line 2167

def icon(filename, _hue = 0)
end

.icon_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2161
2162
# File 'docs/0_Dependencies.rb', line 2161

def icon_exist?(filename)
end

.interface(filename, _hue = 0) ⇒ Texture

Load an interface image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2182
2183
# File 'docs/0_Dependencies.rb', line 2182

def interface(filename, _hue = 0)
end

.interface_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2176
2177
# File 'docs/0_Dependencies.rb', line 2176

def interface_exist?(filename)
end

.interface_image(filename) ⇒ Image

Load an interface "Image" (to perform some background process)

Parameters:

  • filename (String) —

    name of the image in the folder

Returns:



2187
2188
# File 'docs/0_Dependencies.rb', line 2187

def interface_image(filename)
end

.load_animation(flush_it = false)

Load/unload the animation cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2051
2052
# File 'docs/0_Dependencies.rb', line 2051

def load_animation(flush_it = false)
end

.load_autotile(flush_it = false)

Load/unload the autotile cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2066
2067
# File 'docs/0_Dependencies.rb', line 2066

def load_autotile(flush_it = false)
end

.load_b_icon(flush_it = false)

Load/unload the pokemon icon cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2346
2347
# File 'docs/0_Dependencies.rb', line 2346

def load_b_icon(flush_it = false)
end

.load_ball(flush_it = false)

Load/unload the ball cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2081
2082
# File 'docs/0_Dependencies.rb', line 2081

def load_ball(flush_it = false)
end

.load_battleback(flush_it = false)

Load/unload the battleback cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2096
2097
# File 'docs/0_Dependencies.rb', line 2096

def load_battleback(flush_it = false)
end

.load_battler(flush_it = false)

Load/unload the battler cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2111
2112
# File 'docs/0_Dependencies.rb', line 2111

def load_battler(flush_it = false)
end

.load_character(flush_it = false)

Load/unload the character cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2126
2127
# File 'docs/0_Dependencies.rb', line 2126

def load_character(flush_it = false)
end

.load_fog(flush_it = false)

Load/unload the fog cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2141
2142
# File 'docs/0_Dependencies.rb', line 2141

def load_fog(flush_it = false)
end

.load_foot_print(flush_it = false)

Load/unload the foot print cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2331
2332
# File 'docs/0_Dependencies.rb', line 2331

def load_foot_print(flush_it = false)
end

.load_icon(flush_it = false)

Load/unload the icon cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2156
2157
# File 'docs/0_Dependencies.rb', line 2156

def load_icon(flush_it = false)
end

.load_image(cache_tab, filename, path, file_data = nil, image_class = Texture) ⇒ Texture

Note:

This function displays a desktop notification if the image is not found. The resultat bitmap is an empty 16x16 bitmap in this case.

Loads an image (from cache, disk or virtual directory)

Parameters:

  • cache_tab (Hash{String => Texture}) —

    cache table where bitmaps are being stored

  • filename (String) —

    filename of the image

  • path (String) —

    path of the image inside Graphics/

  • file_data (Yuki::VD) (defaults to: nil) —

    "virtual directory"

  • image_class (Class) (defaults to: Texture) —

    Texture or Image depending on the desired process

Returns:



2040
2041
# File 'docs/0_Dependencies.rb', line 2040

def load_image(cache_tab, filename, path, file_data = nil, image_class = Texture)
end

.load_image_from_file_data(filename, file_data, image_class) ⇒ Texture

Loads an image from virtual directory with the right encoding

Parameters:

  • filename (String) —

    filename of the image

  • file_data (Yuki::VD) —

    "virtual directory"

  • image_class (Class) —

    Texture or Image depending on the desired process

Returns:

  • (Texture) —

    the image loaded from the virtual directory



2047
2048
# File 'docs/0_Dependencies.rb', line 2047

def load_image_from_file_data(filename, file_data, image_class)
end

.load_interface(flush_it = false)

Load/unload the interface cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2171
2172
# File 'docs/0_Dependencies.rb', line 2171

def load_interface(flush_it = false)
end

.load_panorama(flush_it = false)

Load/unload the panorama cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2191
2192
# File 'docs/0_Dependencies.rb', line 2191

def load_panorama(flush_it = false)
end

.load_particle(flush_it = false)

Load/unload the particle cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2206
2207
# File 'docs/0_Dependencies.rb', line 2206

def load_particle(flush_it = false)
end

.load_pc(flush_it = false)

Load/unload the pc cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2221
2222
# File 'docs/0_Dependencies.rb', line 2221

def load_pc(flush_it = false)
end

.load_picture(flush_it = false)

Load/unload the picture cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2236
2237
# File 'docs/0_Dependencies.rb', line 2236

def load_picture(flush_it = false)
end

.load_poke_back(flush_it = false)

Load/unload the pokemon back cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2377
2378
# File 'docs/0_Dependencies.rb', line 2377

def load_poke_back(flush_it = false)
end

.load_poke_front(flush_it = false)

Load/unload the pokemon front cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2361
2362
# File 'docs/0_Dependencies.rb', line 2361

def load_poke_front(flush_it = false)
end

.load_pokedex(flush_it = false)

Load/unload the pokedex cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2251
2252
# File 'docs/0_Dependencies.rb', line 2251

def load_pokedex(flush_it = false)
end

.load_tileset(flush_it = false)

Load/unload the tileset cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2281
2282
# File 'docs/0_Dependencies.rb', line 2281

def load_tileset(flush_it = false)
end

.load_title(flush_it = false)

Load/unload the title cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2266
2267
# File 'docs/0_Dependencies.rb', line 2266

def load_title(flush_it = false)
end

.load_transition(flush_it = false)

Load/unload the transition cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2301
2302
# File 'docs/0_Dependencies.rb', line 2301

def load_transition(flush_it = false)
end

.load_windowskin(flush_it = false)

Load/unload the windoskin cache

Parameters:

  • flush_it (Boolean) (defaults to: false) —

    if we need to flush the cache



2316
2317
# File 'docs/0_Dependencies.rb', line 2316

def load_windowskin(flush_it = false)
end

.panorama(filename, _hue = 0) ⇒ Texture

Load a panorama image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2202
2203
# File 'docs/0_Dependencies.rb', line 2202

def panorama(filename, _hue = 0)
end

.panorama_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2196
2197
# File 'docs/0_Dependencies.rb', line 2196

def panorama_exist?(filename)
end

.particle(filename, _hue = 0) ⇒ Texture

Load a particle image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2217
2218
# File 'docs/0_Dependencies.rb', line 2217

def particle(filename, _hue = 0)
end

.particle_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2211
2212
# File 'docs/0_Dependencies.rb', line 2211

def particle_exist?(filename)
end

.pc(filename, _hue = 0) ⇒ Texture

Load a pc image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2232
2233
# File 'docs/0_Dependencies.rb', line 2232

def pc(filename, _hue = 0)
end

.pc_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2226
2227
# File 'docs/0_Dependencies.rb', line 2226

def pc_exist?(filename)
end

.picture(filename, _hue = 0) ⇒ Texture

Load a picture image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2247
2248
# File 'docs/0_Dependencies.rb', line 2247

def picture(filename, _hue = 0)
end

.picture_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2241
2242
# File 'docs/0_Dependencies.rb', line 2241

def picture_exist?(filename)
end

.poke_back(filename, hue = 0) ⇒ Texture

Load a pokemon back image

Parameters:

  • filename (String) —

    name of the image in the folder

  • hue (Integer) (defaults to: 0) —

    0 = normal, 1 = shiny

Returns:



2389
2390
# File 'docs/0_Dependencies.rb', line 2389

def poke_back(filename, hue = 0)
end

.poke_back_exist?(filename, hue = 0) ⇒ Boolean

Test if the image exist in the folder

Parameters:

  • filename (String)
  • hue (Integer) (defaults to: 0) —

    if the back is shiny or not

Returns:

  • (Boolean)


2383
2384
# File 'docs/0_Dependencies.rb', line 2383

def poke_back_exist?(filename, hue = 0)
end

.poke_front(filename, hue = 0) ⇒ Texture

Load a pokemon face image

Parameters:

  • filename (String) —

    name of the image in the folder

  • hue (Integer) (defaults to: 0) —

    0 = normal, 1 = shiny

Returns:



2373
2374
# File 'docs/0_Dependencies.rb', line 2373

def poke_front(filename, hue = 0)
end

.poke_front_exist?(filename, hue = 0) ⇒ Boolean

Test if the image exist in the folder

Parameters:

  • filename (String)
  • hue (Integer) (defaults to: 0) —

    if the front is shiny or not

Returns:

  • (Boolean)


2367
2368
# File 'docs/0_Dependencies.rb', line 2367

def poke_front_exist?(filename, hue = 0)
end

.pokedex(filename, _hue = 0) ⇒ Texture

Load a pokedex image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2262
2263
# File 'docs/0_Dependencies.rb', line 2262

def pokedex(filename, _hue = 0)
end

.pokedex_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2256
2257
# File 'docs/0_Dependencies.rb', line 2256

def pokedex_exist?(filename)
end

.test_file_existence(filename, path, file_data = nil) ⇒ Boolean

Test if a file exist

Parameters:

  • filename (String) —

    filename of the image

  • path (String) —

    path of the image inside Graphics/

  • file_data (Yuki::VD) (defaults to: nil) —

    "virtual directory"

Returns:

  • (Boolean) —

    if the image exist or not



2029
2030
# File 'docs/0_Dependencies.rb', line 2029

def test_file_existence(filename, path, file_data = nil)
end

.tileset(filename, _hue = 0) ⇒ Texture

Load a tileset image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2292
2293
# File 'docs/0_Dependencies.rb', line 2292

def tileset(filename, _hue = 0)
end

.tileset_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2286
2287
# File 'docs/0_Dependencies.rb', line 2286

def tileset_exist?(filename)
end

.tileset_image(filename) ⇒ Image

Load a tileset "Image" (to perform some background process)

Parameters:

  • filename (String) —

    name of the image in the folder

Returns:



2297
2298
# File 'docs/0_Dependencies.rb', line 2297

def tileset_image(filename)
end

.title(filename, _hue = 0) ⇒ Texture

Load a title image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2277
2278
# File 'docs/0_Dependencies.rb', line 2277

def title(filename, _hue = 0)
end

.title_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2271
2272
# File 'docs/0_Dependencies.rb', line 2271

def title_exist?(filename)
end

.transition(filename, _hue = 0) ⇒ Texture

Load a transition image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2312
2313
# File 'docs/0_Dependencies.rb', line 2312

def transition(filename, _hue = 0)
end

.transition_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2306
2307
# File 'docs/0_Dependencies.rb', line 2306

def transition_exist?(filename)
end

.windowskin(filename, _hue = 0) ⇒ Texture

Load a windowskin image

Parameters:

  • filename (String) —

    name of the image in the folder

  • _hue (Integer) (defaults to: 0) —

    ingored (compatibility with RMXP)

Returns:



2327
2328
# File 'docs/0_Dependencies.rb', line 2327

def windowskin(filename, _hue = 0)
end

.windowskin_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2321
2322
# File 'docs/0_Dependencies.rb', line 2321

def windowskin_exist?(filename)
end