mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
reorganize some stuff
This commit is contained in:
@@ -10,7 +10,7 @@ local LabelHeight = 16
|
||||
-- private variables
|
||||
local consoleWidget
|
||||
local logLocked = false
|
||||
local commandEnv = createEnvironment()
|
||||
local commandEnv = newenv()
|
||||
local commandLineEdit
|
||||
local consoleBuffer
|
||||
local commandHistory = { }
|
||||
|
@@ -12,7 +12,6 @@ Module
|
||||
require 'console'
|
||||
require 'commands'
|
||||
Console.init()
|
||||
return true
|
||||
|
||||
onUnload: |
|
||||
Console.terminate()
|
||||
|
@@ -3,5 +3,4 @@ Module
|
||||
autoLoad: true
|
||||
onLoad: |
|
||||
require 'playground'
|
||||
return true
|
||||
|
||||
|
@@ -1,8 +1,9 @@
|
||||
Client = { }
|
||||
Client = {}
|
||||
|
||||
-- TODO: load and save configurations
|
||||
function Client.init()
|
||||
g_window.show()
|
||||
g_window.setMinimumSize({ width = 550, height = 450 })
|
||||
|
||||
-- initialize in fullscreen mode on mobile devices
|
||||
if g_window.getPlatformType() == "X11-EGL" then
|
||||
@@ -19,8 +20,11 @@ function Client.init()
|
||||
end
|
||||
|
||||
g_window.setTitle('OTClient')
|
||||
g_window.setIcon('clienticon.png')
|
||||
return true
|
||||
g_window.setIcon(resolvepath('clienticon.png'))
|
||||
|
||||
if not g_sprites.isLoaded() or not g_thingsType.isLoaded() then
|
||||
fatal("spr and dat files are not loaded, did you loaded them?")
|
||||
end
|
||||
end
|
||||
|
||||
function Client.terminate()
|
||||
|
@@ -16,7 +16,7 @@ Module
|
||||
|
||||
onLoad: |
|
||||
require 'client'
|
||||
return Client.init()
|
||||
Client.init()
|
||||
|
||||
onUnload: |
|
||||
Client.terminate()
|
||||
|
@@ -6,5 +6,3 @@ Module
|
||||
|
||||
onLoad: |
|
||||
require 'about'
|
||||
return true
|
||||
|
||||
|
@@ -7,7 +7,6 @@ Module
|
||||
onLoad: |
|
||||
require 'background'
|
||||
Background.create()
|
||||
return true
|
||||
|
||||
onUnload:
|
||||
Background.destroy()
|
||||
|
@@ -8,7 +8,6 @@ Module
|
||||
require 'entergame'
|
||||
require 'characterlist'
|
||||
EnterGame.create()
|
||||
return true
|
||||
|
||||
onUnload:
|
||||
EnterGame.destroy()
|
||||
|
@@ -6,5 +6,3 @@ Module
|
||||
|
||||
onLoad: |
|
||||
require 'options'
|
||||
return true
|
||||
|
||||
|
Submodule modules/client_tibiafiles updated: e76fa2786e...81e6ef44c7
@@ -7,7 +7,6 @@ Module
|
||||
onLoad: |
|
||||
require 'topmenu'
|
||||
TopMenu.create()
|
||||
return true
|
||||
|
||||
onUnload: |
|
||||
TopMenu.destroy()
|
||||
|
@@ -10,7 +10,7 @@ Module
|
||||
|
||||
// NOTE: order does matter
|
||||
dependencies:
|
||||
- core_scripts
|
||||
- core_lib
|
||||
- core_fonts
|
||||
- core_styles
|
||||
- core_widgets
|
||||
|
@@ -4,10 +4,9 @@ Module
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
onLoad: |
|
||||
importFont('verdana-11px-antialised')
|
||||
importFont('verdana-11px-monochrome')
|
||||
importFont('verdana-11px-rounded')
|
||||
importFont('terminus-14px-bold')
|
||||
setDefaultFont('verdana-11px-antialised')
|
||||
return true
|
||||
importFont 'verdana-11px-antialised'
|
||||
importFont 'verdana-11px-monochrome'
|
||||
importFont 'verdana-11px-rounded'
|
||||
importFont 'terminus-14px-bold'
|
||||
setDefaultFont 'verdana-11px-antialised'
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
Module
|
||||
name: core_scripts
|
||||
name: core_lib
|
||||
description: Contains core lua classes, functions and constants used by other modules
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
@@ -7,14 +7,13 @@ Module
|
||||
onLoad: |
|
||||
require 'ext/table'
|
||||
require 'ext/string'
|
||||
require 'util/point'
|
||||
require 'util/size'
|
||||
require 'util/color'
|
||||
require 'util/rect'
|
||||
require 'math/point'
|
||||
require 'math/size'
|
||||
require 'math/color'
|
||||
require 'math/rect'
|
||||
require 'const'
|
||||
require 'util'
|
||||
require 'globals'
|
||||
require 'dispatcher'
|
||||
require 'widget'
|
||||
require 'ui'
|
||||
require 'effects'
|
||||
return true
|
@@ -1,9 +1,15 @@
|
||||
-- globals
|
||||
rootWidget = g_ui.getRootWidget()
|
||||
|
||||
-- public functions
|
||||
function importStyle(otui)
|
||||
g_ui.importStyle(resolveFileFullPath(otui, 2))
|
||||
g_ui.importStyle(resolvepath(otui, 2))
|
||||
end
|
||||
|
||||
function importFont(otfont)
|
||||
g_fonts.importFont(resolvepath(otfont, 2))
|
||||
end
|
||||
|
||||
function setDefaultFont(font)
|
||||
g_fonts.setDefaultFont(font)
|
||||
end
|
||||
|
||||
function displayUI(arg1, options)
|
||||
@@ -14,7 +20,7 @@ function displayUI(arg1, options)
|
||||
|
||||
-- display otui files
|
||||
if type(arg1) == 'string' then
|
||||
local otuiFilePath = resolveFileFullPath(arg1, 2)
|
||||
local otuiFilePath = resolvepath(arg1, 2)
|
||||
widget = g_ui.loadUI(otuiFilePath, parent)
|
||||
-- display already loaded widgets
|
||||
else
|
@@ -26,13 +26,26 @@ function connect(object, signalsAndSlots, pushFront)
|
||||
end
|
||||
end
|
||||
|
||||
function createEnvironment()
|
||||
function extends(base)
|
||||
local derived = {}
|
||||
function derived.internalCreate()
|
||||
local instance = base.create()
|
||||
for k,v in pairs(derived) do
|
||||
instance[k] = v
|
||||
end
|
||||
return instance
|
||||
end
|
||||
derived.create = derived.internalCreate
|
||||
return derived
|
||||
end
|
||||
|
||||
function newenv()
|
||||
local env = { }
|
||||
setmetatable(env, { __index = _G} )
|
||||
return env
|
||||
end
|
||||
|
||||
function getCallingScriptSourcePath(depth)
|
||||
function getfsrcpath(depth)
|
||||
depth = depth or 2
|
||||
local info = debug.getinfo(1+depth, "Sn")
|
||||
local path
|
||||
@@ -47,25 +60,11 @@ function getCallingScriptSourcePath(depth)
|
||||
return path
|
||||
end
|
||||
|
||||
function resolveFileFullPath(filePath, depth)
|
||||
function resolvepath(filePath, depth)
|
||||
depth = depth or 1
|
||||
if filePath:sub(0, 1) ~= '/' then
|
||||
return getCallingScriptSourcePath(depth+1) .. '/' .. filePath
|
||||
return getfsrcpath(depth+1) .. '/' .. filePath
|
||||
else
|
||||
return filePath
|
||||
end
|
||||
end
|
||||
|
||||
function extends(base)
|
||||
local derived = {}
|
||||
function derived.internalCreate()
|
||||
local instance = base.create()
|
||||
for k,v in pairs(derived) do
|
||||
instance[k] = v
|
||||
end
|
||||
return instance
|
||||
end
|
||||
derived.create = derived.internalCreate
|
||||
return derived
|
||||
end
|
||||
|
@@ -17,4 +17,3 @@ Module
|
||||
importStyle 'styles/creatures.otui'
|
||||
importStyle 'styles/popupmenus.otui'
|
||||
importStyle 'styles/comboboxes.otui'
|
||||
return true
|
||||
|
@@ -10,5 +10,4 @@ Module
|
||||
require 'uibutton'
|
||||
require 'uilabel'
|
||||
require 'uicombobox'
|
||||
require 'uipopupmenu'
|
||||
return true
|
||||
require 'uipopupmenu'
|
8
modules/core_widgets/uicheckbox.lua
Normal file
8
modules/core_widgets/uicheckbox.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
UICheckBox = extends(UIWidget)
|
||||
|
||||
function UICheckBox.create()
|
||||
local checkbox = UICheckBox.internalCreate()
|
||||
checkbox:setFocusable(false)
|
||||
checkbox:setAlign(AlignLeft)
|
||||
return checkbox
|
||||
end
|
@@ -16,4 +16,3 @@ Module
|
||||
onLoad: |
|
||||
require 'game'
|
||||
require 'thing'
|
||||
return true
|
||||
|
@@ -5,6 +5,3 @@ Module
|
||||
website: https://github.com/edubart/otclient
|
||||
onLoad: |
|
||||
require 'chat'
|
||||
return true
|
||||
|
||||
|
||||
|
@@ -5,6 +5,3 @@ Module
|
||||
website: https://github.com/edubart/otclient
|
||||
onLoad: |
|
||||
require 'healthbar'
|
||||
return true
|
||||
|
||||
|
||||
|
@@ -5,6 +5,3 @@ Module
|
||||
website: https://github.com/edubart/otclient
|
||||
onLoad: |
|
||||
require 'inventory'
|
||||
return true
|
||||
|
||||
|
||||
|
@@ -5,6 +5,3 @@ Module
|
||||
website: https://github.com/edubart/otclient
|
||||
onLoad: |
|
||||
require 'outfit'
|
||||
return true
|
||||
|
||||
|
||||
|
@@ -5,4 +5,3 @@ Module
|
||||
website: https://github.com/edubart/otclient
|
||||
onLoad: |
|
||||
require 'skills'
|
||||
return true
|
||||
|
@@ -5,5 +5,3 @@ Module
|
||||
website: https://github.com/edubart/otclient
|
||||
onLoad: |
|
||||
require 'textmessage'
|
||||
return true
|
||||
|
||||
|
@@ -5,6 +5,3 @@ Module
|
||||
website: https://github.com/edubart/otclient
|
||||
onLoad: |
|
||||
require 'viplist'
|
||||
return true
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user