mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 12:04:55 +02:00
Warn when no graphics is detected at startup
Add script for building otclient snaphots
This commit is contained in:
@@ -9,6 +9,30 @@ function Client.reloadScripts()
|
||||
print(message)
|
||||
end
|
||||
|
||||
function Client.startup()
|
||||
-- Play startup music (The Silver Tree, by Mattias Westlund)
|
||||
g_sounds.playMusic("startup.ogg", 3)
|
||||
connect(g_game, { onGameStart = function() g_sounds.stopMusic(3) end })
|
||||
connect(g_game, { onGameEnd = function() g_sounds.playMusic("startup.ogg", 3) end })
|
||||
|
||||
-- Check for startup errors
|
||||
local errtitle = nil
|
||||
local errmsg = nil
|
||||
|
||||
if g_graphics.getRenderer():lower():match('gdi generic') then
|
||||
errtitle = tr('Graphics card driver not detected')
|
||||
errmsg = tr('No graphics card detected, everything will be drawn using the CPU,\nthus the performance will be really bad.\nPlease update your graphics driver to have a better performance.')
|
||||
end
|
||||
|
||||
-- Show entergame
|
||||
if errmsg or errtitle then
|
||||
local msgbox = displayErrorBox(errtitle, errmsg)
|
||||
msgbox.onOk = function() EnterGame.firstShow() end
|
||||
else
|
||||
EnterGame.firstShow()
|
||||
end
|
||||
end
|
||||
|
||||
function Client.init()
|
||||
g_window.setMinimumSize({ width = 600, height = 480 })
|
||||
|
||||
@@ -37,15 +61,7 @@ function Client.init()
|
||||
g_window.setIcon(resolvepath('clienticon.png'))
|
||||
g_keyboard.bindKeyDown('Ctrl+Shift+R', Client.reloadScripts)
|
||||
|
||||
connect(g_app, { onRun =
|
||||
function()
|
||||
-- Play startup music (The Silver Tree, by Mattias Westlund)
|
||||
g_sounds.playMusic("startup.ogg", 3)
|
||||
connect(g_game, { onGameStart = function() g_sounds.stopMusic(3) end })
|
||||
connect(g_game, { onGameEnd = function() g_sounds.playMusic("startup.ogg", 3) end })
|
||||
end
|
||||
})
|
||||
|
||||
connect(g_app, { onRun = Client.startup })
|
||||
end
|
||||
|
||||
function Client.terminate()
|
||||
|
@@ -88,15 +88,22 @@ function EnterGame.init()
|
||||
protocolBox:setCurrentOption(clientVersion)
|
||||
end
|
||||
|
||||
-- only open entergame when app starts
|
||||
if not g_app.isRunning() then
|
||||
if #host > 0 and #password > 0 and #account > 0 and autologin then
|
||||
addEvent(EnterGame.doLogin)
|
||||
end
|
||||
else
|
||||
if g_game.isOnline() then
|
||||
enterGame:hide()
|
||||
end
|
||||
enterGame:hide()
|
||||
|
||||
if g_app.isRunning() and not g_game.isOnline() then
|
||||
enterGame:show()
|
||||
end
|
||||
end
|
||||
|
||||
function EnterGame.firstShow()
|
||||
enterGame:show()
|
||||
|
||||
local account = g_crypt.decrypt(g_settings.get('account'))
|
||||
local password = g_crypt.decrypt(g_settings.get('password'))
|
||||
local host = g_settings.get('host')
|
||||
local autologin = g_settings.getBoolean('autologin')
|
||||
if #host > 0 and #password > 0 and #account > 0 and autologin then
|
||||
addEvent(EnterGame.doLogin)
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -125,11 +125,11 @@ function tryExit()
|
||||
local logoutFunc = function() logout() exitWindow:destroy() exitWindow = nil end
|
||||
local cancelFunc = function() exitWindow:destroy() exitWindow = nil end
|
||||
|
||||
exitWindow = displayGeneralBox('Exit', tr("If you shut down the program, your character might stay in the game.\nClick on 'Logout' to ensure that you character leaves the game properly.\nClick on 'Exit' if you want to exit the program without logging out your character."), {
|
||||
{ text='Force Exit', callback=exitFunc },
|
||||
exitWindow = displayGeneralBox('Exit', tr("If you shut down the program, your character might stay in the game.\nClick on 'Logout' to ensure that you character leaves the game properly.\nClick on 'Exit' if you want to exit the program without logging out your character."),
|
||||
{ { text='Force Exit', callback=exitFunc },
|
||||
{ text='Logout', callback=logoutFunc },
|
||||
{ text='Cancel', callback=cancelFunc },
|
||||
anchor=AnchorHorizontalCenter}, logoutFunc, cancelFunc)
|
||||
anchor=AnchorHorizontalCenter }, logoutFunc, cancelFunc)
|
||||
|
||||
return true
|
||||
end
|
||||
|
Reference in New Issue
Block a user