feat: add a global asset system
This commit is contained in:
parent
c5c9f040bc
commit
5837fd8b51
11 changed files with 282 additions and 195 deletions
97
birb/core/assets.lua
Normal file
97
birb/core/assets.lua
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
-- core/assets :: a simple assets manager, aim to put every assets in a simple
|
||||||
|
-- serie of table in order to find them easily.
|
||||||
|
|
||||||
|
--[[
|
||||||
|
Copyright © 2019 Kazhnuz
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
]]
|
||||||
|
|
||||||
|
local AssetManager = Object:extend()
|
||||||
|
|
||||||
|
function AssetManager:new()
|
||||||
|
self.locals = {}
|
||||||
|
self.globals = {}
|
||||||
|
self.updatables = {}
|
||||||
|
|
||||||
|
self.isActive = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function AssetManager:update(dt)
|
||||||
|
if (self.isActive) then
|
||||||
|
for key, updatable in pairs(self.updatables) do
|
||||||
|
updatable:update(dt)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function AssetManager:add(name, asset, isGlobal)
|
||||||
|
if (isGlobal == true) then
|
||||||
|
self:addGlobal(name, asset)
|
||||||
|
else
|
||||||
|
self:addLocal(name, asset)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function AssetManager:addGlobal(name, asset)
|
||||||
|
self.globals[name] = asset
|
||||||
|
end
|
||||||
|
|
||||||
|
function AssetManager:addLocal(name, asset)
|
||||||
|
self.locals[name] = asset
|
||||||
|
end
|
||||||
|
|
||||||
|
function AssetManager:clear()
|
||||||
|
self.locals = {}
|
||||||
|
self.globals = {}
|
||||||
|
collectgarbage()
|
||||||
|
end
|
||||||
|
|
||||||
|
function AssetManager:clearLocal()
|
||||||
|
self.locals = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
function AssetManager:get(name)
|
||||||
|
if self.locals[name] ~= nil then
|
||||||
|
return self.locals[name]
|
||||||
|
end
|
||||||
|
return self.globals[name]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Specific functions
|
||||||
|
|
||||||
|
function AssetManager:playSFX(name)
|
||||||
|
local asset = self:get(name)
|
||||||
|
asset:play()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Activity Functions
|
||||||
|
|
||||||
|
function AssetManager:setActivity(isActive)
|
||||||
|
self.isActive = isActive
|
||||||
|
end
|
||||||
|
|
||||||
|
function AssetManager:switchActivity()
|
||||||
|
self.isActive = (self.isActive == false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function AssetManager:getActivity()
|
||||||
|
return self.isActive
|
||||||
|
end
|
||||||
|
|
||||||
|
return AssetManager
|
|
@ -34,6 +34,7 @@ local Screen = require(cwd .. "screen")
|
||||||
local Lang = require(cwd .. "lang")
|
local Lang = require(cwd .. "lang")
|
||||||
local SceneManager = require(cwd .. "scenemanager")
|
local SceneManager = require(cwd .. "scenemanager")
|
||||||
local MusicManager = require(cwd .. "music")
|
local MusicManager = require(cwd .. "music")
|
||||||
|
local Assets = require(cwd .. "assets")
|
||||||
|
|
||||||
-- INIT FUNCTIONS
|
-- INIT FUNCTIONS
|
||||||
-- Initialize and configure the core object
|
-- Initialize and configure the core object
|
||||||
|
@ -51,6 +52,7 @@ function CoreSystem:new(debugLevel)
|
||||||
self.scenemanager = SceneManager(self)
|
self.scenemanager = SceneManager(self)
|
||||||
self.lang = Lang(self)
|
self.lang = Lang(self)
|
||||||
self.music = MusicManager(self)
|
self.music = MusicManager(self)
|
||||||
|
self.assets = Assets(self)
|
||||||
|
|
||||||
self.debug:logDebug("birbcore","Birb initialized")
|
self.debug:logDebug("birbcore","Birb initialized")
|
||||||
end
|
end
|
||||||
|
@ -106,6 +108,7 @@ function CoreSystem:update(dt)
|
||||||
self.input:update(dt)
|
self.input:update(dt)
|
||||||
self.screen:update(dt)
|
self.screen:update(dt)
|
||||||
self.music:update(dt)
|
self.music:update(dt)
|
||||||
|
self.assets:update(dt)
|
||||||
|
|
||||||
if (self.game ~= nil) then
|
if (self.game ~= nil) then
|
||||||
self.game:update(dt)
|
self.game:update(dt)
|
||||||
|
|
|
@ -75,7 +75,6 @@ function SceneManager:update(dt)
|
||||||
if (self.currentScene ~= nil) then
|
if (self.currentScene ~= nil) then
|
||||||
self.currentScene:updateStart(dt)
|
self.currentScene:updateStart(dt)
|
||||||
self.currentScene:setKeys()
|
self.currentScene:setKeys()
|
||||||
self.currentScene.assets:update(dt)
|
|
||||||
self.currentScene.menusystem:update(dt)
|
self.currentScene.menusystem:update(dt)
|
||||||
self.currentScene:updateWorld(dt)
|
self.currentScene:updateWorld(dt)
|
||||||
self.currentScene:update(dt)
|
self.currentScene:update(dt)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- modules/assets :: a simple assets manager, aim to put every assets in a simple
|
-- modules/assets/import :: a simple assets importer, to import easily everything into
|
||||||
-- serie of table in order to find them easily.
|
-- the asset manager.
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Copyright © 2019 Kazhnuz
|
Copyright © 2019 Kazhnuz
|
||||||
|
@ -41,29 +41,87 @@ local SFX = require(cwd .. "sfx")
|
||||||
-- INIT FUNCTIONS
|
-- INIT FUNCTIONS
|
||||||
-- Initilizing and configuring option
|
-- Initilizing and configuring option
|
||||||
|
|
||||||
function Assets:new()
|
function Assets:new(isGlobal)
|
||||||
self:clear()
|
self.isGlobal = isGlobal
|
||||||
|
|
||||||
self.isActive = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Assets:clear()
|
function Assets:clear()
|
||||||
-- TODO: destroy individually each texture/image when assets are cleared
|
if (self.isGlobal) then
|
||||||
self:clearSprites()
|
core.assets:clear()
|
||||||
self:clearSFX()
|
else
|
||||||
self:clearFonts()
|
core.assets:clearLocal()
|
||||||
self:resetMusic()
|
end
|
||||||
self:clearBackgrounds()
|
|
||||||
self:clearFonts()
|
|
||||||
self:clearTileset()
|
|
||||||
|
|
||||||
self:clearImages()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Assets:update(dt)
|
-- WRAPPER FUNCTIONS
|
||||||
if (self.isActive) then
|
-- Basic wrappers to ensure compatibility
|
||||||
self:animationsUpdate(dt)
|
|
||||||
|
function Assets:get(key)
|
||||||
|
return core.assets:get(key)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Assets:getFont(key)
|
||||||
|
return self:getWithType(key, "font")
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:getWithType(key, type)
|
||||||
|
return core.assets:get(key)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:draw(name, x, y, r, sx, sy, ox, oy, kx, ky)
|
||||||
|
core.assets:draw(name, x, y, r, sx, sy, ox, oy, kx, ky)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:newSFX(name, filepath)
|
||||||
|
self:addSFX(name, filepath)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:addImage(name, filename)
|
||||||
|
self:addTexture(name, filename)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:playSFX(name)
|
||||||
|
core.assets:playSFX(name)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:drawImage(name, x, y, r, sx, sy, ox, oy, kx, ky)
|
||||||
|
self:draw(name, x, y, r, sx, sy, ox, oy, kx, ky)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Music
|
||||||
|
|
||||||
|
function Assets:setMusic(filename, loop)
|
||||||
|
core.debug:logDebug("assets", "Assets:setMusic is deprecated")
|
||||||
|
core.music:addMusic(filename, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:silence()
|
||||||
|
core.debug:logDebug("assets", "Assets:silence is deprecated")
|
||||||
|
core.music:silence()
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:resetMusic()
|
||||||
|
core.debug:logDebug("assets", "Assets:resetMusic is deprecated")
|
||||||
|
core.music:purge()
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:playMusic()
|
||||||
|
core.debug:logDebug("assets", "Assets:playMusic is deprecated")
|
||||||
|
core.music:playMusic()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Activity
|
||||||
|
|
||||||
|
function Assets:setActivity(activity)
|
||||||
|
core.assets:setActivity(activity)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:switchActivity()
|
||||||
|
core.assets:switchActivity()
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:getActivity()
|
||||||
|
core.assets:getActivity()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- IMPORT FUNCTIONS
|
-- IMPORT FUNCTIONS
|
||||||
|
@ -145,148 +203,74 @@ function Assets:importSFX(assets)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- SFX & MUSICS
|
-- ADD FUNCTIONS
|
||||||
-- Handle sound effects and musics
|
-- Different wrapper to create easily asset objects
|
||||||
|
|
||||||
function Assets:addSFX(name, filepath)
|
function Assets:add(name, assetObject)
|
||||||
self:newSFX(name, filepath)
|
core.assets:add(name, assetObject, self.isGlobal)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Assets:newSFX(name, filepath)
|
|
||||||
self.sfx[name] = SFX(filepath)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Assets:clearSFX()
|
|
||||||
love.audio.stop( )
|
|
||||||
self.sfx = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
function Assets:playSFX(filename)
|
|
||||||
if not (self.sfx[filename] == nil) then
|
|
||||||
self.sfx[filename]:play()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Assets:setMusic(filename, loop)
|
|
||||||
core.debug:logDebug("assets", "Assets:setMusic is deprecated")
|
|
||||||
core.music:addMusic(filename, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Assets:silence()
|
|
||||||
core.debug:logDebug("assets", "Assets:silence is deprecated")
|
|
||||||
core.music:silence()
|
|
||||||
end
|
|
||||||
|
|
||||||
function Assets:resetMusic()
|
|
||||||
core.debug:logDebug("assets", "Assets:resetMusic is deprecated")
|
|
||||||
core.music:purge()
|
|
||||||
end
|
|
||||||
|
|
||||||
function Assets:playMusic()
|
|
||||||
core.debug:logDebug("assets", "Assets:playMusic is deprecated")
|
|
||||||
core.music:playMusic()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- IMAGES FUNCTIONS
|
|
||||||
-- Create directly texture items
|
|
||||||
|
|
||||||
function Assets:addImage(name, filename)
|
|
||||||
self.images[name] = Texture(filename)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Assets:drawImage(name, x, y, r, sx, sy, ox, oy, kx, ky)
|
|
||||||
self.images[name]:draw(x, y, r, sx, sy, ox, oy, kx, ky)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Assets:clearImages()
|
|
||||||
self.images = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- BACKGROUNDS FUNCTIONS
|
|
||||||
-- Automatic tiling texture
|
|
||||||
|
|
||||||
function Assets:addBackground(name, filepath)
|
function Assets:addBackground(name, filepath)
|
||||||
-- TODO: rework entirely background to work at any size
|
self:add(name, Background(filepath))
|
||||||
self.backgrounds[name] = Background(filepath)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Assets:clearBackgrounds()
|
|
||||||
self.backgrounds = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- SPRITES FUNCTIONS
|
|
||||||
-- Animated tileset
|
|
||||||
|
|
||||||
function Assets:addSprite(name, filepath)
|
function Assets:addSprite(name, filepath)
|
||||||
self.sprites[name] = Sprite(filepath)
|
self:add(name, Sprite(filepath))
|
||||||
end
|
end
|
||||||
|
|
||||||
function Assets:animationsUpdate(dt)
|
|
||||||
for i,v in pairs(self.sprites) do
|
|
||||||
v:update(dt)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Assets:clearSprites()
|
|
||||||
self.sprites = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- FONTS FUNCTIONS
|
|
||||||
-- Handles fonts and imagesfonts
|
|
||||||
|
|
||||||
function Assets:addFont(key, filename, size)
|
function Assets:addFont(key, filename, size)
|
||||||
local font = Font(filename, size)
|
self:add(key, Font(filename, size))
|
||||||
self.fonts[key] = font
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Assets:addImageFont(key, filename, extraspacing)
|
function Assets:addImageFont(key, filename, extraspacing)
|
||||||
local font = ImageFont(filename, extraspacing)
|
self:add(key, ImageFont(filename, extraspacing))
|
||||||
self.fonts[key] = font
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Assets:getFont(filename)
|
|
||||||
return self.fonts[filename]
|
|
||||||
end
|
|
||||||
|
|
||||||
function Assets:clearFonts()
|
|
||||||
self.fonts = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- TILESET FUNCTIONS
|
|
||||||
-- Automatically create quads for a texture
|
|
||||||
|
|
||||||
function Assets:addTileset(name, filepath)
|
function Assets:addTileset(name, filepath)
|
||||||
self.tileset[name] = Tileset(filepath)
|
self:add(name, Tileset(filepath))
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:addAutotile(name, tilesize)
|
||||||
|
self:add(name, Autotile(name, tilesize))
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:addSFX(name, filepath)
|
||||||
|
self:add(name, SFX(filepath))
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:addTexture(name, filename)
|
||||||
|
self:add(name, Texture(filename))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- DEPRECATED FUNCTIONS
|
||||||
|
-- Don't do anything and will be removed soon
|
||||||
|
|
||||||
|
function Assets:clearFonts()
|
||||||
|
core.debug:logDebug("assets", "Assets:clearFonts is deprecated")
|
||||||
end
|
end
|
||||||
|
|
||||||
function Assets:clearTileset()
|
function Assets:clearTileset()
|
||||||
self.tileset = {}
|
core.debug:logDebug("assets", "Assets:clearTileset is deprecated")
|
||||||
end
|
|
||||||
|
|
||||||
-- AUTOTILE FUNCTIONS
|
|
||||||
-- Automatically draw tiles
|
|
||||||
|
|
||||||
function Assets:addAutotile(name, tilesize)
|
|
||||||
self.autotile[name] = Autotile(name, tilesize)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Assets:clearAutotile()
|
function Assets:clearAutotile()
|
||||||
self.autotile = {}
|
core.debug:logDebug("assets", "Assets:clearAutotile is deprecated")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ACTIVITY FUNCTIONS
|
function Assets:clearSFX()
|
||||||
-- Handle activity
|
core.debug:logDebug("assets", "Assets:clearSFX is deprecated")
|
||||||
|
|
||||||
function Assets:setActivity(activity)
|
|
||||||
self.isActive = activity
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Assets:switchActivity()
|
function Assets:clearBackgrounds()
|
||||||
self.isActive = (self.isActive == false)
|
core.debug:logDebug("assets", "Assets:clearBackgrounds is deprecated")
|
||||||
end
|
end
|
||||||
|
|
||||||
function Assets:getActivity()
|
function Assets:clearSprites()
|
||||||
return self.isActive
|
core.debug:logDebug("assets", "Assets:clearSprites is deprecated")
|
||||||
|
end
|
||||||
|
|
||||||
|
function Assets:clearImages()
|
||||||
|
core.debug:logDebug("assets", "Assets:clearImages is deprecated")
|
||||||
end
|
end
|
||||||
|
|
||||||
return Assets
|
return Assets
|
||||||
|
|
|
@ -257,7 +257,7 @@ function Menu:resetSound()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Menu:setSoundFromSceneAssets(name)
|
function Menu:setSoundFromSceneAssets(name)
|
||||||
self:setSound(self.menusystem.scene.assets.sfx[name])
|
self:setSound(self.menusystem.scene.assets:getWithType(name, "sfx"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function Menu:setSound(soundasset)
|
function Menu:setSound(soundasset)
|
||||||
|
|
|
@ -26,7 +26,8 @@ local Actor2D = require(cwd .. "actor2D")
|
||||||
local GFX = Actor2D:extend()
|
local GFX = Actor2D:extend()
|
||||||
|
|
||||||
function GFX:new(world, x, y, spritename)
|
function GFX:new(world, x, y, spritename)
|
||||||
local width, height = world.scene.assets.sprites[spritename]:getDimensions()
|
local baseSprite = world.scene.assets:getWithType(spritename, "sprite")
|
||||||
|
local width, height = baseSprite:getDimensions()
|
||||||
|
|
||||||
GFX.super.new(self, world, "gfx", x - (width/2), y - (height/2), width, height)
|
GFX.super.new(self, world, "gfx", x - (width/2), y - (height/2), width, height)
|
||||||
self:setSprite(spritename, true)
|
self:setSprite(spritename, true)
|
||||||
|
|
|
@ -26,7 +26,8 @@ local Actor3D = require(cwd .. "actor3D")
|
||||||
local GFX = Actor3D:extend()
|
local GFX = Actor3D:extend()
|
||||||
|
|
||||||
function GFX:new(world, x, y, z, spritename)
|
function GFX:new(world, x, y, z, spritename)
|
||||||
local width, height = world.scene.assets.sprites[spritename]:getDimensions()
|
local baseSprite = world.scene.assets:getWithType(spritename, "sprite")
|
||||||
|
local width, height = baseSprite:getDimensions()
|
||||||
|
|
||||||
GFX.super.new(self, world, "gfx", x - (width/2), y - (width/2), z - (height/2), width, width, height)
|
GFX.super.new(self, world, "gfx", x - (width/2), y - (width/2), z - (height/2), width, width, height)
|
||||||
self:setSprite(spritename, true)
|
self:setSprite(spritename, true)
|
||||||
|
|
|
@ -29,8 +29,8 @@ local TexturedBox = Box3D:extend()
|
||||||
function TexturedBox:new(owner, w, h, d, topTexture, bottomTexture)
|
function TexturedBox:new(owner, w, h, d, topTexture, bottomTexture)
|
||||||
local bottomTexture = bottomTexture or topTexture
|
local bottomTexture = bottomTexture or topTexture
|
||||||
|
|
||||||
self.topTexture = owner.assets.images[topTexture]
|
self.topTexture = owner.assets:getWithType(topTexture, "texture")
|
||||||
self.bottomTexture = owner.assets.images[bottomTexture]
|
self.bottomTexture = owner.assets:getWithType(bottomTexture, "texture")
|
||||||
|
|
||||||
TexturedBox.super.new(self, owner, w, h, d)
|
TexturedBox.super.new(self, owner, w, h, d)
|
||||||
self.haveLine = false
|
self.haveLine = false
|
||||||
|
|
|
@ -17,7 +17,8 @@ end
|
||||||
|
|
||||||
function Sprite:clone()
|
function Sprite:clone()
|
||||||
if self.name ~= nil then
|
if self.name ~= nil then
|
||||||
self.spriteClone = self.assets.sprites[self.name]:clone()
|
local baseSprite = self.assets:getWithType(self.name, "sprite")
|
||||||
|
self.spriteClone = baseSprite:clone()
|
||||||
self.spriteClone:setCallbackTarget(self.owner)
|
self.spriteClone:setCallbackTarget(self.owner)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -110,7 +111,8 @@ function Sprite:draw(x, y, r, sx, sy, ox, oy, kx, ky)
|
||||||
if (self.spriteClone ~= nil) then
|
if (self.spriteClone ~= nil) then
|
||||||
self.spriteClone:draw(x, y, r, sx, sy, ox, oy, kx, ky)
|
self.spriteClone:draw(x, y, r, sx, sy, ox, oy, kx, ky)
|
||||||
else
|
else
|
||||||
self.assets.sprites[self.name]:drawAnimation(x, y, r, sx, sy, ox, oy, kx, ky)
|
local sprite = self.assets:getWithType(self.name, "sprite")
|
||||||
|
sprite:drawAnimation(x, y, r, sx, sy, ox, oy, kx, ky)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,7 +24,7 @@ end
|
||||||
|
|
||||||
function ResumeWidget:new(menu)
|
function ResumeWidget:new(menu)
|
||||||
self.scene = menu.scene
|
self.scene = menu.scene
|
||||||
local font = self.scene.assets.fonts["medium"]
|
local font = self.scene.assets:getFont("medium")
|
||||||
local label = "resume"
|
local label = "resume"
|
||||||
ResumeWidget.super.new(self, menu, font, label)
|
ResumeWidget.super.new(self, menu, font, label)
|
||||||
end
|
end
|
||||||
|
@ -36,7 +36,7 @@ end
|
||||||
|
|
||||||
function RestartWidget:new(menu)
|
function RestartWidget:new(menu)
|
||||||
self.scene = menu.scene
|
self.scene = menu.scene
|
||||||
local font = self.scene.assets.fonts["medium"]
|
local font = self.scene.assets:getFont("medium")
|
||||||
local label = "restart"
|
local label = "restart"
|
||||||
RestartWidget.super.new(self, menu, font, label)
|
RestartWidget.super.new(self, menu, font, label)
|
||||||
end
|
end
|
||||||
|
@ -48,7 +48,7 @@ end
|
||||||
|
|
||||||
function ExitWidget:new(menu)
|
function ExitWidget:new(menu)
|
||||||
self.scene = menu.scene
|
self.scene = menu.scene
|
||||||
local font = self.scene.assets.fonts["medium"]
|
local font = self.scene.assets:getFont("medium")
|
||||||
local label = "exit"
|
local label = "exit"
|
||||||
ExitWidget.super.new(self, menu, font, label)
|
ExitWidget.super.new(self, menu, font, label)
|
||||||
end
|
end
|
||||||
|
|
|
@ -97,7 +97,7 @@ end
|
||||||
function SubMenuWidget:new(scene, menu, newmenu, fullname, order)
|
function SubMenuWidget:new(scene, menu, newmenu, fullname, order)
|
||||||
self.scene = scene
|
self.scene = scene
|
||||||
local widgetmenu = self.scene.menusystem.menus[menu]
|
local widgetmenu = self.scene.menusystem.menus[menu]
|
||||||
local font = self.scene.assets.fonts["medium"]
|
local font = self.scene.assets:getFont("medium")
|
||||||
self.newmenu = newmenu
|
self.newmenu = newmenu
|
||||||
local label = ""
|
local label = ""
|
||||||
if fullname == "back" then
|
if fullname == "back" then
|
||||||
|
@ -122,7 +122,7 @@ function SceneWidget:new(scene, menu, newscene, fullname, args)
|
||||||
self.scene = scene
|
self.scene = scene
|
||||||
self.args = args
|
self.args = args
|
||||||
local widgetmenu = self.scene.menusystem.menus[menu]
|
local widgetmenu = self.scene.menusystem.menus[menu]
|
||||||
local font = self.scene.assets.fonts["medium"]
|
local font = self.scene.assets:getFont("medium")
|
||||||
self.newscene = newscene
|
self.newscene = newscene
|
||||||
local label = core.lang:translate("mainmenu", fullname)
|
local label = core.lang:translate("mainmenu", fullname)
|
||||||
SceneWidget.super.new(self, widgetmenu, font, label)
|
SceneWidget.super.new(self, widgetmenu, font, label)
|
||||||
|
@ -139,7 +139,7 @@ end
|
||||||
function ExitWidget:new(scene, menu)
|
function ExitWidget:new(scene, menu)
|
||||||
self.scene = scene
|
self.scene = scene
|
||||||
local widgetmenu = self.scene.menusystem.menus[menu]
|
local widgetmenu = self.scene.menusystem.menus[menu]
|
||||||
local font = self.scene.assets.fonts["medium"]
|
local font = self.scene.assets:getFont("medium")
|
||||||
local label = core.lang:translate("commons", "exit")
|
local label = core.lang:translate("commons", "exit")
|
||||||
SceneWidget.super.new(self, widgetmenu, font, label)
|
SceneWidget.super.new(self, widgetmenu, font, label)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue