UI stuff
This commit is contained in:
parent
ddaf61c52c
commit
0bbbae1a6e
|
|
@ -0,0 +1,29 @@
|
|||
return {
|
||||
_font = "client/assets/fonts/Montserrat-Bold.ttf",
|
||||
_title = "SOUS L'ŒIL",
|
||||
["newgame_button"] = "New Game",
|
||||
["join_button"] = "Join Server",
|
||||
["quit_button"] = "Quit",
|
||||
["option_button"] = "Settings",
|
||||
["mainmenu_button"] = "Main Menu",
|
||||
["option_name"] = "Player Name",
|
||||
["option_pron"] = "Player Pronouns",
|
||||
["option_tint"] = "Player Colour",
|
||||
["option_keybinds"] = "Edit Keybindings",
|
||||
["utf8_error"] = "[countrypilled]",
|
||||
["server_browser"] = "Server Browser",
|
||||
["ip_button"] = "Enter IP:",
|
||||
["svinfo_name"] = "Server Name",
|
||||
["svinfo_map"] = "Current Map",
|
||||
["svinfo_players"] = "In",
|
||||
["svinfo_capacity"] = "Max",
|
||||
["svinfo_ip"] = "IP",
|
||||
["svinfo_port"] = "Port",
|
||||
["refresh_button"] = "Refresh",
|
||||
["cancel_button"] = "Cancel",
|
||||
optionsMenu = {
|
||||
language = "Language",
|
||||
resolution = "Resolution",
|
||||
},
|
||||
game_intro = "A gaze blank and pitiless as the sun",
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
return setmetatable({
|
||||
return {
|
||||
_font = "client/assets/fonts/Montserrat-Bold.ttf",
|
||||
_title = "SOUS L'ŒIL",
|
||||
["newgame_button"] = "New Game",
|
||||
["join_button"] = "Join Server",
|
||||
["quit_button"] = "Quit",
|
||||
|
|
@ -20,4 +22,4 @@ return setmetatable({
|
|||
["refresh_button"] = "Refresh",
|
||||
["cancel_button"] = "Cancel",
|
||||
game_intro = "A gaze blank and pitiless as the sun",
|
||||
}, {__index = function( t, k ) return k end } )
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
function love.conf(t)
|
||||
t.identity = "vision-dajjal" -- The name of the save directory (string)
|
||||
t.identity = "sous-loeil" -- The name of the save directory (string)
|
||||
t.appendidentity = false -- Search files in source directory before save directory (boolean)
|
||||
t.version = "11.4" -- The LÖVE version this game was made for (string)
|
||||
t.console = true -- Attach a console (boolean, Windows only)
|
||||
|
|
@ -10,8 +10,8 @@ function love.conf(t)
|
|||
t.audio.mic = false -- Request and use microphone capabilities in Android (boolean)
|
||||
t.audio.mixwithsystem = true -- Keep background music playing when opening LOVE (boolean, iOS and Android only)
|
||||
|
||||
t.window.title = "vision-dajjal" -- The window title (string)
|
||||
t.window.icon = "assets/client-icon.png" -- Filepath to an image to use as the window's icon (string)
|
||||
t.window.title = "SOUS L'OEIL" -- The window title (string)
|
||||
t.window.icon = "client/assets/client-icon.png" -- Filepath to an image to use as the window's icon (string)
|
||||
t.window.width = 800 -- The window width (number)
|
||||
t.window.height = 600 -- The window height (number)
|
||||
t.window.borderless = false -- Remove all border visuals from the window (boolean)
|
||||
|
|
@ -40,7 +40,7 @@ function love.conf(t)
|
|||
t.modules.keyboard = true -- Enable the keyboard module (boolean)
|
||||
t.modules.math = true -- Enable the math module (boolean)
|
||||
t.modules.mouse = true -- Enable the mouse module (boolean)
|
||||
t.modules.physics = true -- Enable the physics module (boolean)
|
||||
t.modules.physics = false -- Enable the physics module (boolean)
|
||||
t.modules.sound = true -- Enable the sound module (boolean)
|
||||
t.modules.system = true -- Enable the system module (boolean)
|
||||
t.modules.thread = true -- Enable the thread module (boolean)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
local t = {}
|
||||
local love = love
|
||||
|
||||
t._languages = {
|
||||
"en",
|
||||
"test",
|
||||
}
|
||||
|
||||
t._fonts = {
|
||||
default = love.graphics.newFont( 18 )
|
||||
}
|
||||
|
||||
local fallbackString = { __index = function( t, s )
|
||||
return "!:"..tostring( s )
|
||||
end }
|
||||
|
||||
function t._setLanguage( name )
|
||||
local lang = name or "en"
|
||||
local strings = require( "client.assets.strings."..lang )
|
||||
local fontName = rawget( strings, "_font" ) or "default"
|
||||
|
||||
setmetatable( t, {__index =
|
||||
setmetatable( strings, fallbackString ) } )
|
||||
|
||||
if t._fonts[fontName] then love.graphics.setFont( t._fonts[fontName], 22 )
|
||||
else t._fonts[fontName] = love.graphics.setNewFont( fontName, 22 ) end
|
||||
return t
|
||||
end
|
||||
|
||||
return t
|
||||
|
|
@ -3,23 +3,16 @@ local love = assert( love )
|
|||
|
||||
|
||||
function love.load()
|
||||
package.path = "./client/?.lua"..package.path
|
||||
print( "Client Started." )
|
||||
assert( require 'config' )
|
||||
|
||||
--Crash if running luajit 2.1 and coconut missing
|
||||
--[[loadstring( love.data.decode( "string", "base64","G0xKAgrbAQAACgALABY2AAAAOQABADkAAgAnAgMAJwMEADYEAAA5BAEEOQQFBCcGBgA2BwAAOQcHBzkHCAcnCQkAQgcCAEEEAQBBAAICBgAKAFgAAoArAAEAWAEBgCsAAgBMAAIALWQ4MmY3M2RkNjQ1MDcxNDZiNTkwNTMwYjg0NDcwMWZlMmJmYjdjZTkeY2xpZW50L2Fzc2V0cy9jb2NvbnV0LnBuZxFuZXdJbWFnZURhdGEKaW1hZ2UJc2hhMQloYXNoCGhleAtzdHJpbmcLZW5jb2RlCWRhdGEJbG92ZV0BAAUABQAONgAAADMCAQBCAAICDgAAAFgBB4A2AAIANAIAADUDAwA2BAAAPQQEA0IAAwJCAAECMgAAgEwAAgALX19jYWxsAQAAEXNldG1ldGF0YWJsZQAKcGNhbGwA" ))()]]
|
||||
local options = assert( require 'client.options' )
|
||||
local strings = assert( require 'client.i18n' )
|
||||
strings._setLanguage( options.language )
|
||||
|
||||
love.window.setTitle( strings._title )
|
||||
love.window.setIcon( assert( love.image.newImageData( "client/assets/client-icon.png" ) ) )
|
||||
love.graphics.setNewFont( "client/assets/fonts/Montserrat-Bold.ttf", 48 )
|
||||
local scenes = assert( require 'scene' )
|
||||
|
||||
assert( require 'ui.options' )
|
||||
assert( require 'ui.browser' )
|
||||
assert( require 'game' )
|
||||
assert( require 'ui.mainmenu' )
|
||||
assert( require 'connecting' )
|
||||
scenes.loadScene( scenes.mainmenu )
|
||||
|
||||
local optionsMenu = assert( require 'client.ui.options' )
|
||||
return optionsMenu.show()
|
||||
end
|
||||
|
||||
function love.quit()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
language = "en",
|
||||
resolution = "800 x 600",
|
||||
volume = 50,
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
local optionsMenu = { name = "optionsMenu" }
|
||||
local options = require( "client.options" )
|
||||
local strings = require( "client.i18n" ).optionsMenu
|
||||
local love = assert( love )
|
||||
|
||||
|
||||
local newOption = {
|
||||
list = { __index = {
|
||||
name = "listOption",
|
||||
x = 0,
|
||||
y = 0,
|
||||
h = 24,
|
||||
w = 200,
|
||||
selected = false,
|
||||
set = function(self)
|
||||
|
||||
end,
|
||||
commit = function(self)
|
||||
|
||||
end,
|
||||
draw = function(self)
|
||||
love.graphics.rectangle( "line", self.x - 5, self.y, 300, 24 )
|
||||
love.graphics.print( self.name, self.x, self.y )
|
||||
end,
|
||||
}},
|
||||
|
||||
int = { __index = {
|
||||
name = "intOption",
|
||||
h = 24,
|
||||
w = 200,
|
||||
x = 0,
|
||||
y = 0,
|
||||
set = function(self, value)
|
||||
|
||||
end,
|
||||
draw = function( self )
|
||||
love.graphics.print( self.name, self.x, self.y )
|
||||
end,
|
||||
}},
|
||||
}
|
||||
|
||||
--option ctors
|
||||
local function addOption(optionType, t)
|
||||
return setmetatable( t, optionType )
|
||||
end
|
||||
|
||||
for k, optionType in pairs(newOption) do
|
||||
setmetatable( optionType, optionType )
|
||||
optionType.__call = addOption
|
||||
end
|
||||
|
||||
|
||||
--save button
|
||||
local saveButton = { h = 50 }
|
||||
do
|
||||
function saveButton.draw()
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
--menu layout
|
||||
local menu = {
|
||||
newOption.list{
|
||||
name = "language",
|
||||
},
|
||||
|
||||
newOption.list{
|
||||
name = "resolution",
|
||||
list = {
|
||||
"800 x 600",
|
||||
"1024 x 768",
|
||||
"fullscreen",
|
||||
}
|
||||
},
|
||||
|
||||
newOption.int{
|
||||
name = "volume",
|
||||
max = 100,
|
||||
min = 0,
|
||||
},
|
||||
|
||||
saveButton,
|
||||
}
|
||||
|
||||
do
|
||||
local y = 0
|
||||
for idx, option in ipairs(menu) do
|
||||
option.y = y
|
||||
y = y + option.h
|
||||
end
|
||||
end
|
||||
|
||||
function optionsMenu.draw()
|
||||
love.graphics.push()
|
||||
|
||||
for i, opt in ipairs( menu ) do
|
||||
opt:draw()
|
||||
end
|
||||
|
||||
love.graphics.pop()
|
||||
end
|
||||
|
||||
function optionsMenu.mousemoved(x, y, dx, dy, istouch)
|
||||
|
||||
end
|
||||
|
||||
function optionsMenu.mousepressed(x, y, button, istouch, presses)
|
||||
|
||||
end
|
||||
|
||||
function optionsMenu.show()
|
||||
local scene = require( "client.ui.scene" )
|
||||
return scene.add( optionsMenu )
|
||||
end
|
||||
|
||||
return optionsMenu
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
local love = assert( love )
|
||||
local table = assert( table )
|
||||
local scene = {}
|
||||
local scenes = {}
|
||||
local callbacks = {
|
||||
draw = true,
|
||||
update = true,
|
||||
mousemoved = true,
|
||||
mousepressed = true,
|
||||
keypressed = true,
|
||||
keyreleased = true,
|
||||
textinput = true,
|
||||
textedited = true,
|
||||
resize = true,
|
||||
}
|
||||
|
||||
function scene.refresh()
|
||||
for cb in pairs( callbacks ) do
|
||||
love[cb] = function(...)
|
||||
for i = 1, #scenes do
|
||||
local sc = scenes[i]
|
||||
if sc[cb] then sc[cb](...) end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.replace( s )
|
||||
for i = 1, #scenes do
|
||||
scenes[i] = nil
|
||||
end
|
||||
scenes[1] = s
|
||||
return scene.refresh()
|
||||
end
|
||||
|
||||
function scene.add( s )
|
||||
table.insert( scenes, s )
|
||||
return scene.refresh()
|
||||
end
|
||||
|
||||
function scene.remove( s )
|
||||
for i = 1, #scenes do
|
||||
if scenes[i] == s then
|
||||
table.remove( scenes, i )
|
||||
return scene.refresh()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function scene.print()
|
||||
for i = 1, #scenes do
|
||||
print( i, scenes[i].name )
|
||||
end
|
||||
end
|
||||
|
||||
return scene
|
||||
|
|
@ -0,0 +1 @@
|
|||
return true
|
||||
Loading…
Reference in New Issue