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:



1867
1868
# File 'docs/0_Dependencies.rb', line 1867

def animation(filename, _hue = 0)
end

.animation_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


1861
1862
# File 'docs/0_Dependencies.rb', line 1861

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:



1882
1883
# File 'docs/0_Dependencies.rb', line 1882

def autotile(filename, _hue = 0)
end

.autotile_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


1876
1877
# File 'docs/0_Dependencies.rb', line 1876

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:



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

def b_icon(filename, _hue = 0)
end

.b_icon_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


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

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:



1897
1898
# File 'docs/0_Dependencies.rb', line 1897

def ball(filename, _hue = 0)
end

.ball_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


1891
1892
# File 'docs/0_Dependencies.rb', line 1891

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:



1912
1913
# File 'docs/0_Dependencies.rb', line 1912

def battleback(filename, _hue = 0)
end

.battleback_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


1906
1907
# File 'docs/0_Dependencies.rb', line 1906

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:



1927
1928
# File 'docs/0_Dependencies.rb', line 1927

def battler(filename, _hue = 0)
end

.battler_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


1921
1922
# File 'docs/0_Dependencies.rb', line 1921

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:



1942
1943
# File 'docs/0_Dependencies.rb', line 1942

def character(filename, _hue = 0)
end

.character_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


1936
1937
# File 'docs/0_Dependencies.rb', line 1936

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



1823
1824
# File 'docs/0_Dependencies.rb', line 1823

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



1827
1828
# File 'docs/0_Dependencies.rb', line 1827

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:



1957
1958
# File 'docs/0_Dependencies.rb', line 1957

def fog(filename, _hue = 0)
end

.fog_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


1951
1952
# File 'docs/0_Dependencies.rb', line 1951

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:



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

def foot_print(filename, _hue = 0)
end

.foot_print_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


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

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:



1972
1973
# File 'docs/0_Dependencies.rb', line 1972

def icon(filename, _hue = 0)
end

.icon_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


1966
1967
# File 'docs/0_Dependencies.rb', line 1966

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:



1987
1988
# File 'docs/0_Dependencies.rb', line 1987

def interface(filename, _hue = 0)
end

.interface_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


1981
1982
# File 'docs/0_Dependencies.rb', line 1981

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:



1992
1993
# File 'docs/0_Dependencies.rb', line 1992

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



1856
1857
# File 'docs/0_Dependencies.rb', line 1856

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



1871
1872
# File 'docs/0_Dependencies.rb', line 1871

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



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

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



1886
1887
# File 'docs/0_Dependencies.rb', line 1886

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



1901
1902
# File 'docs/0_Dependencies.rb', line 1901

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



1916
1917
# File 'docs/0_Dependencies.rb', line 1916

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



1931
1932
# File 'docs/0_Dependencies.rb', line 1931

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



1946
1947
# File 'docs/0_Dependencies.rb', line 1946

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



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

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



1961
1962
# File 'docs/0_Dependencies.rb', line 1961

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:



1845
1846
# File 'docs/0_Dependencies.rb', line 1845

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



1852
1853
# File 'docs/0_Dependencies.rb', line 1852

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



1976
1977
# File 'docs/0_Dependencies.rb', line 1976

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



1996
1997
# File 'docs/0_Dependencies.rb', line 1996

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



2011
2012
# File 'docs/0_Dependencies.rb', line 2011

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



2026
2027
# File 'docs/0_Dependencies.rb', line 2026

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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:



2007
2008
# File 'docs/0_Dependencies.rb', line 2007

def panorama(filename, _hue = 0)
end

.panorama_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2001
2002
# File 'docs/0_Dependencies.rb', line 2001

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:



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

def particle(filename, _hue = 0)
end

.particle_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2016
2017
# File 'docs/0_Dependencies.rb', line 2016

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:



2037
2038
# File 'docs/0_Dependencies.rb', line 2037

def pc(filename, _hue = 0)
end

.pc_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


2031
2032
# File 'docs/0_Dependencies.rb', line 2031

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:



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

def picture(filename, _hue = 0)
end

.picture_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


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

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:



2194
2195
# File 'docs/0_Dependencies.rb', line 2194

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)


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

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:



2178
2179
# File 'docs/0_Dependencies.rb', line 2178

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)


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

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:



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

def pokedex(filename, _hue = 0)
end

.pokedex_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


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

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



1834
1835
# File 'docs/0_Dependencies.rb', line 1834

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:



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

def tileset(filename, _hue = 0)
end

.tileset_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


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

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:



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

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:



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

def title(filename, _hue = 0)
end

.title_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


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

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:



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

def transition(filename, _hue = 0)
end

.transition_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


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

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:



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

def windowskin(filename, _hue = 0)
end

.windowskin_exist?(filename) ⇒ Boolean

Test if the image exist in the folder

Parameters:

Returns:

  • (Boolean)


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

def windowskin_exist?(filename)
end