Ajout des derniers développement #1

Merged
kazhnuz merged 68 commits from chronicles-cbs into master 2020-08-02 11:14:18 +02:00
12 changed files with 489 additions and 10 deletions
Showing only changes of commit 459f4905c7 - Show all commits

View file

@ -0,0 +1,4 @@
return {
glyphs = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZÇÂÄÀÆÉÊËÈÎÏÔÖŒÜÛÙ[\\]^_`abcdefghijklmnopqrstuvwxyzçâäàæéêëèïîôöœûüù{|}",
extraspacing = 0,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View file

@ -0,0 +1,4 @@
return {
glyphs = "abcdefghijklmnopqrstuvwxyz0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ",
extraspacing = 1
}

View file

@ -0,0 +1,5 @@
return {
name = "English",
name_ascii = "English",
subfolder = "en"
}

View file

@ -0,0 +1,11 @@
return {
["inputs"] = "Inputs",
["video"] = "Video",
["audio"] = "Audio",
["langs"] = "Languages",
["resolution"] = "Resolution",
["fullscreen"] = "Fullscreen",
["borders"] = "Borders",
["vsync"] = "V-Sync",
["back"] = "Back",
}

View file

@ -0,0 +1,5 @@
return {
name = "Français",
name_ascii = "Francais",
subfolder = "fr"
}

View file

@ -0,0 +1,11 @@
return {
["inputs"] = "Controles",
["video"] = "Affichage",
["audio"] = "Sons",
["langs"] = "Langues",
["resolution"] = "Resolution",
["fullscreen"] = "Plein Ecran",
["borders"] = "Bordures",
["vsync"] = "Sync Vert.",
["back"] = "Retour",
}

View file

@ -12,22 +12,13 @@ function DebugMenu:new()
self:buildOverworldMenu() self:buildOverworldMenu()
self:buildSaveMenu() self:buildSaveMenu()
self:buildOtherMenu() self:buildOtherMenu()
self:buildOptionsMenu() menu.commons.SceneWidget(self, "BaseMenu", scenes.options, "Options")
menu.ExitWidget(self, "BaseMenu") menu.ExitWidget(self, "BaseMenu")
self.menusystem:activate() self.menusystem:activate()
self.menusystem:switchMenu("BaseMenu") self.menusystem:switchMenu("BaseMenu")
end end
function DebugMenu:buildOptionsMenu()
self:addSubMenu("options", "BaseMenu", "Options")
self:addSubMenu("backgrounds", "options", "Set Background")
menu.ShowBackgroundWidget(self, "options")
menu.commons.SubMenuWidget(self, "backgrounds", "options", "Back")
menu.commons.SubMenuWidget(self, "options", "BaseMenu", "Back")
end
function DebugMenu:buildOverworldMenu() function DebugMenu:buildOverworldMenu()
self:addSubMenu("overworld", "BaseMenu", "Overworld") self:addSubMenu("overworld", "BaseMenu", "Overworld")
menu.commons.SubMenuWidget(self, "overworld", "BaseMenu", "Back") menu.commons.SubMenuWidget(self, "overworld", "BaseMenu", "Back")

View file

@ -4,4 +4,5 @@ return {
title = require "scenes.titlescreen", title = require "scenes.titlescreen",
cbs = require "scenes.battlesystem", cbs = require "scenes.battlesystem",
debug = require "scenes.debug", debug = require "scenes.debug",
options = require "scenes.options",
} }

View file

@ -0,0 +1,52 @@
return {
["tilesets"] = {
{"charicons", "assets/sprites/characters/charicons"},
{"normaltiles", "assets/backgrounds/normaltile"},
{"sptiles", "assets/backgrounds/specialtile"},
{"borders", "assets/backgrounds/borders"},
},
["sprites"] = {
{"cursorground", "assets/gui/cursor/ground"},
{"hitGFX", "assets/sprites/gfx/hit"},
},
["textures"] = {
{"menucursor", "assets/gui/cursor-menulist.png"},
{"statusbar", "assets/gui/status_bar.png"},
{"cursorpeak", "assets/gui/cursor/peak.png"},
{"actorsShadow", "assets/sprites/shadow.png"},
{"emptytile", "assets/backgrounds/tilemask.png"},
{"e_speedster", "assets/gui/emblem_speedster.png"},
{"e_technic", "assets/gui/emblem_technic.png"},
{"e_power", "assets/gui/emblem_power.png"},
{"m_speedster", "assets/gui/emblem_speedster_mask.png"},
{"m_technic", "assets/gui/emblem_technic_mask.png"},
{"m_power", "assets/gui/emblem_power_mask.png"},
{"hudturn", "assets/gui/strings/hudturn.png"},
{"battlecompleted", "assets/gui/strings/battle_completed.png" }
},
["fonts"] = {
{"small", "assets/gui/fonts/PixelOperator.ttf", 16},
{"victory", "assets/gui/fonts/vipnagorgialla.ttf", 12}
},
["imagefonts"] = {
{"hudnbrs", "assets/gui/fonts/hudnumbers"},
{"hudnbrs_small", "assets/gui/fonts/hudsmallnumbers"},
{"medium", "assets/gui/fonts/SA2font"},
},
["sfx"] = {
{"hit", "assets/sfx/hit.wav"},
{"hitconnect", "assets/sfx/hitconnect.wav"},
{"jump", "assets/sfx/jump.wav"},
{"woosh", "assets/sfx/woosh.wav"},
{"spincharge", "assets/sfx/spincharge.wav"},
{"spinrelease", "assets/sfx/spinrelease.wav"},
{"mBack", "assets/sfx/menus/back.wav"},
{"mBeep", "assets/sfx/menus/beep.wav"},
{"mSelect", "assets/sfx/menus/select.wav"},
{"mError", "assets/sfx/menus/error.wav"},
}
}

View file

@ -0,0 +1,97 @@
local Scene = require "core.modules.scenes"
local OptionsMenu = Scene:extend()
local ListBox = require "core.modules.menusystem.listbox"
local Widgets = require "scenes.options.widgets"
function OptionsMenu:new()
OptionsMenu.super.new(self)
self.assets:batchImport("scenes.options.assets")
self:addMenu("main", true)
self:addSubMenu("video", "video")
self:addSubMenu("audio", "audio")
self:addSubMenu("langs", "langs")
self:addSubMenu("inputs", "inputs")
Widgets.Resolution(self, "video")
Widgets.Switch(self, "video", "fullscreen")
Widgets.Switch(self, "video", "borders")
Widgets.Switch(self, "video", "vsync")
self:addPlayerMenus()
self:setLanguageMenu()
Widgets.Audio(self, "audio", "sfx")
Widgets.Audio(self, "audio", "music")
Widgets.Exit(self, "main")
self.menusystem:switchMenu("main")
self.menusystem:setSoundFromSceneAssets("mBeep")
self.keyDetector = {}
self.keyDetector.widget = nil
end
-- MENU FUNCTION
-- Functions that serve the handling of menus
function OptionsMenu:addMenu(name, nobackbutton)
local screenHeight, screenWidth = core.screen:getDimensions()
local w, h = 424/2, 240 - 48
local x, y = w / 2, 24
ListBox(self.menusystem, name, x, y, w, h, 8)
end
function OptionsMenu:addSubMenu(name, fullname)
self:addMenu(name)
Widgets.SubMenu(self, "main", name, fullname)
Widgets.SubMenu(self, name, "main", "back", 1, "<")
end
function OptionsMenu:addPlayerMenus()
for i,v in ipairs(core.input.data) do
local menu = "player" .. i
self:addMenu(menu)
Widgets.PlayerSubMenu(self, "inputs", i)
for k,w in pairs(v.keys) do
-- FIXME: make sure that you can use the order you want for the keys list
-- instead of a random one
Widgets.Key(self, i, k)
end
Widgets.SubMenu(self, menu, "inputs", "back", 1, "<")
end
end
function OptionsMenu:addScene(submenu, scene, fullname)
Widgets.Dummy(self, submenu, fullname)
end
function OptionsMenu:setLanguageMenu()
for i,v in ipairs(core.lang.data.available) do
Widgets.Lang(self, "langs", v)
end
end
function OptionsMenu:changeKey(widget)
self.keyDetector.isActive = true
self.keyDetector.widget = widget
end
function OptionsMenu:keypressed( key )
if (self.keyDetector.isActive) then
self.keyDetector.widget:receiveKey( key )
self.menusystem:activate()
self.keyDetector.isActive = false
end
end
function OptionsMenu:draw()
love.graphics.setColor(.3, .1, .4, 1)
love.graphics.rectangle("fill", 0, 0, 424, 240)
utils.graphics.resetColor()
end
return OptionsMenu

View file

@ -0,0 +1,298 @@
local widgets = {}
local Widget = require "core.modules.menusystem.widgets"
local DoubleTextWidget = Widget.Text:extend()
widgets.SubMenu = DoubleTextWidget:extend()
widgets.Dummy = Widget.Text:extend()
widgets.Exit = Widget.Text:extend()
widgets.Switch = DoubleTextWidget:extend()
widgets.Resolution = DoubleTextWidget:extend()
widgets.Lang = Widget.Text:extend()
widgets.PlayerSubMenu = DoubleTextWidget:extend()
widgets.Key = DoubleTextWidget:extend()
widgets.Audio = DoubleTextWidget:extend()
-- BASIC WIDGETS
-- Simple and reusables widgets
-- DoubleText widget : a two-side text widget
function DoubleTextWidget:new(menu, font, label1, label2)
DoubleTextWidget.super.new(self, menu, font, label1)
self.label2 = label2 or ""
end
function DoubleTextWidget:drawCanvas()
local w, h
w = math.floor(self.width)
h = math.floor(self.height / 2) - (self.font:getHeight() / 2)
self.font:draw(self.label, 4, h, -1, "left")
self.font:draw(self.label2, w-4, h, -1, "right")
end
-- Submenu widget :: go to a submenu
function widgets.SubMenu:new(scene, menu, newmenu, fullname, order, label2)
self.scene = scene
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
local label = core.lang:translate("options", fullname)
local label2 = label2 or ">"
self.newmenu = newmenu
widgets.SubMenu.super.new(self, widgetmenu, font, label, label2)
self.order = order or 0
end
function widgets.SubMenu:action()
self.scene.assets:playSFX("mSelect")
self.scene.menusystem:switchMenu(self.newmenu)
end
-- Dummy widget :: An empty widget to serve as a base for others
function widgets.Dummy:new(scene, menu, fullname)
self.scene = scene
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
widgets.Dummy.super.new(self, widgetmenu, font, fullname)
end
function widgets.Dummy:action()
-- shoosh
end
-- Exit Widget : exit the examples
function widgets.Exit:new(scene, menu)
self.scene = scene
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
local label = core.lang:translate("commons", "exit")
widgets.Exit.super.new(self, widgetmenu, font, "Exit")
end
function widgets.Exit:action()
self.scene.assets:playSFX("mSelect")
core.scenemanager:setStoredScene("mainmenu")
end
-- VIDEO WIDGETS
-- Handle graphical settings
-- Switch widget (One widget to handle graphical switch)
function widgets.Switch:new(scene, menu, keyname)
self.scene = scene
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
self.keyname = keyname
local label = core.lang:translate("options", keyname)
local label2 = self:getLabel()
widgets.Switch.super.new(self, widgetmenu, font, label, label2)
self.order = order or 0
end
function widgets.Switch:modifyKey()
--self.key = (self.key == false)
if self.keyname == "fullscreen" then
core.options.data.video.fullscreen = (core.options.data.video.fullscreen == false)
elseif self.keyname == "borders" then
core.options.data.video.border = (core.options.data.video.border == false)
elseif self.keyname == "vsync" then
core.options.data.video.vsync = (core.options.data.video.vsync == false)
end
core.screen:applySettings()
end
function widgets.Switch:getKey()
if self.keyname == "fullscreen" then
self.key = core.options.data.video.fullscreen
elseif self.keyname == "borders" then
self.key = (core.options.data.video.border)
elseif self.keyname == "vsync" then
self.key = (core.options.data.video.vsync)
end
end
function widgets.Switch:getLabel()
self:getKey()
local label = ""
if (self.key) then
label = "true"
else
label = "false"
end
return core.lang:translate("commons", label)
end
function widgets.Switch:action()
self:modifyKey()
self.scene.assets:playSFX("mSelect")
self.label2 = self:getLabel()
core.options:write()
self:invalidateCanvas()
end
-- Resolution Widget
function widgets.Resolution:new(scene, menu)
self.scene = scene
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
local label = core.lang:translate("options", "resolution")
local label2 = self:getLabel()
widgets.Resolution.super.new(self, widgetmenu, font, label, label2)
end
function widgets.Resolution:getLabel()
return "x" .. core.options.data.video.resolution
end
function widgets.Resolution:action()
if core.options.data.video.resolution == 3 then
core.options.data.video.resolution = 1
else
core.options.data.video.resolution = core.options.data.video.resolution + 1
end
self.label2 = self:getLabel()
core.screen:applySettings()
self.scene.assets:playSFX("mSelect")
self:invalidateCanvas()
core.options:write()
end
-- LANGS WIDGET
-- Allow you to change the lang of the game
function widgets.Lang:new(scene, menu, lang)
self.scene = scene
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
local label = core.lang:getLangName(lang)
self.lang = lang
widgets.Lang.super.new(self, widgetmenu, font, label)
end
function widgets.Lang:action()
self.scene.assets:playSFX("mSelect")
core.options:setLanguage(self.lang)
--self.scene.menusystem:invalidateAllWidgets()
end
-- INPUT WIDGETS
-- Widgets to handle inputs
function widgets.PlayerSubMenu:new(scene, menu, sourceid)
self.scene = scene
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
local label = core.lang:translate("options", "player") .. " " .. sourceid
local label2 = ">"
self.newmenu = "player" .. sourceid
widgets.PlayerSubMenu.super.new(self, widgetmenu, font, label, label2)
self.order = 0
end
function widgets.PlayerSubMenu:action()
self.scene.assets:playSFX("mSelect")
self.scene.menusystem:switchMenu(self.newmenu)
end
-- Key widgets
function widgets.Key:new(scene, sourceid, key)
self.scene = scene
self.source = sourceid
self.key = key
local menu = "player" .. self.source
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
local label = self.key
local label2 = self:getLabel()
widgets.Key.super.new(self, widgetmenu, font, label, label2)
self.order = 0
end
function widgets.Key:getLabel()
return core.input.data[self.source].keys[self.key]
end
function widgets.Key:action()
self.scene.assets:playSFX("navigate")
self.scene:changeKey(self)
self.scene.menusystem:deactivate()
end
function widgets.Key:receiveKey( key )
self.scene.assets:playSFX("mSelect")
core.options:setInputKey(self.source, self.key, key)
self.label2 = self:getLabel()
self:invalidateCanvas()
end
-- AUDIO FUNCTIONS
-- Sounds/Music functions
function widgets.Audio:new(scene, menu, audiotype)
self.scene = scene
self.audiotype = key
local widgetmenu = self.scene.menusystem.menus[menu]
local font = self.scene.assets.fonts["medium"]
self.audiotype = audiotype
local label = ""
if (self.audiotype == "sfx") then
label = core.lang:translate("options", "sfx")
else
label = core.lang:translate("options", "music")
end
local label2 = self:getLabel()
widgets.Audio.super.new(self, widgetmenu, font, label, label2)
self.order = 0
end
function widgets.Audio:getLabel()
local value = self:getVolume()
string = utils.math.numberToString(value, 3)
local label = string .. "%"
return label
end
function widgets.Audio:getVolume()
if (self.audiotype == "sfx") then
return core.options.data.audio.sfx
else
return core.options.data.audio.music
end
end
function widgets.Audio:setVolume(vol)
if (vol < 0) then vol = 100 end
if (self.audiotype == "sfx") then
core.options.data.audio.sfx = vol
else
core.options.data.audio.music = vol
end
self.label2 = self:getLabel()
self:invalidateCanvas()
end
function widgets.Audio:action()
local value = self:getVolume()
self:setVolume(value - 20)
self.scene.assets:playSFX("mSelect")
--self.scene.assets.music:setVolume(core.options.data.audio.music / 100)
core.options:write()
end
return widgets