mirror of
https://github.com/edubart/otclient.git
synced 2025-11-30 07:26:49 +01:00
BEAWARE all game functionality is disabled with this commit for a while
* rework client modules * hide main window when loading * remake top menu functions * rework modules autoload * improve path resolving for otml and lua * move core_widgets to core_lib * fix tooltip issues * split some styles * add bit32 lua library * fix assert issues * fix compilation on linux 32 systems * rework gcc compile options * renable and fix some warnings * remove unused constants * speedup sprite cache * move UIGame to lua (not funcional yet) * fix a lot of issues in x11 window * fix crash handler * add some warnings do uiwidget and much more...
This commit is contained in:
44
modules/client/client.lua
Normal file
44
modules/client/client.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
Client = {}
|
||||
|
||||
function Client.init()
|
||||
g_window.setMinimumSize({ width = 600, height = 480 })
|
||||
|
||||
-- initialize in fullscreen mode on mobile devices
|
||||
if g_window.getPlatformType() == "X11-EGL" then
|
||||
g_window.setFullscreen(true)
|
||||
else
|
||||
-- window size
|
||||
local size = { width = 800, height = 600 }
|
||||
size = Settings.getSize('window-size', size)
|
||||
g_window.resize(size)
|
||||
|
||||
-- window position, default is the screen center
|
||||
local displaySize = g_window.getDisplaySize()
|
||||
local defaultPos = { x = (displaySize.width - size.width)/2,
|
||||
y = (displaySize.height - size.height)/2 }
|
||||
local pos = Settings.getPoint('window-pos', defaultPos)
|
||||
g_window.move(pos)
|
||||
|
||||
-- window maximized?
|
||||
local maximized = Settings.getBoolean('window-maximized', false)
|
||||
if maximized then g_window.maximize() end
|
||||
end
|
||||
|
||||
g_window.setTitle('OTClient')
|
||||
g_window.setIcon(resolvepath('clienticon.png'))
|
||||
|
||||
-- show the only window after the first frame is rendered
|
||||
addEvent(function()
|
||||
addEvent(function()
|
||||
g_window.show()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function Client.terminate()
|
||||
-- save window configs
|
||||
Settings.set('window-size', g_window.getUnmaximizedSize())
|
||||
Settings.set('window-pos', g_window.getUnmaximizedPos())
|
||||
Settings.set('window-maximized', g_window.isMaximized())
|
||||
Client = nil
|
||||
end
|
||||
23
modules/client/client.otmod
Normal file
23
modules/client/client.otmod
Normal file
@@ -0,0 +1,23 @@
|
||||
Module
|
||||
name: client
|
||||
description: Initialize the client and setups its main window
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
autoload: true
|
||||
autoload-priority: 100
|
||||
|
||||
load-later:
|
||||
- client_topmenu
|
||||
- client_background
|
||||
- client_about
|
||||
- client_options
|
||||
- client_terminal
|
||||
- client_modulemanager
|
||||
- client_entergame
|
||||
|
||||
@onLoad: |
|
||||
dofile 'client'
|
||||
Client.init()
|
||||
|
||||
@onUnload: |
|
||||
Client.terminate()
|
||||
BIN
modules/client/clienticon.png
Normal file
BIN
modules/client/clienticon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 518 B |
Reference in New Issue
Block a user