merge total remake

This commit is contained in:
Eduardo Bart 2011-08-13 23:09:11 -03:00
parent 0af7856475
commit 55862b07ad
253 changed files with 6777 additions and 8463 deletions

4
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "data/tibiafiles"] [submodule "modules/tibiafiles"]
path = data/tibiafiles path = modules/tibiafiles
url = https://github.com/Baxnie/otclient-tibiafiles.git url = https://github.com/Baxnie/otclient-tibiafiles.git

View File

@ -4,6 +4,8 @@ PROJECT(otclient)
# setup custom cmake modules path # setup custom cmake modules path
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}") SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
OPTION(USE_PCH "Use precompiled header" ON)
# find needed packages # find needed packages
SET(Boost_USE_STATIC_LIBS ON) SET(Boost_USE_STATIC_LIBS ON)
SET(Boost_USE_MULTITHREADED OFF) SET(Boost_USE_MULTITHREADED OFF)
@ -13,21 +15,24 @@ FIND_PACKAGE(Lua REQUIRED)
FIND_PACKAGE(PhysFS REQUIRED) FIND_PACKAGE(PhysFS REQUIRED)
FIND_PACKAGE(GMP REQUIRED) FIND_PACKAGE(GMP REQUIRED)
FIND_PACKAGE(ZLIB REQUIRED) FIND_PACKAGE(ZLIB REQUIRED)
FIND_PACKAGE(PCHSupport REQUIRED)
# choose a default build type if not specified # choose a default build type if not specified
IF(NOT CMAKE_BUILD_TYPE) IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo) SET(CMAKE_BUILD_TYPE Debug)
ENDIF(NOT CMAKE_BUILD_TYPE) ENDIF(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "BUILD TYPE: " ${CMAKE_BUILD_TYPE}) MESSAGE(STATUS "BUILD TYPE: " ${CMAKE_BUILD_TYPE})
# setup compiler options # setup compiler options
IF(CMAKE_COMPILER_IS_GNUCXX) IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-result -std=gnu++0x") SET(CXX_WARNS "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-result")
SET(CMAKE_CXX_FLAGS_DEBUG "-O1 -g -ggdb -fno-inline") SET(CMAKE_CXX_FLAGS "-std=c++0x -pipe ${CXX_WARNS}")
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wl,-s") SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -ggdb3 -fno-inline")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O1 -g -fno-inline")
ENDIF(CMAKE_COMPILER_IS_GNUCXX) ENDIF(CMAKE_COMPILER_IS_GNUCXX)
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}
@ -35,106 +40,91 @@ INCLUDE_DIRECTORIES(
${PHYSFS_INCLUDE_DIR} ${PHYSFS_INCLUDE_DIR}
${GMP_INCLUDE_DIR} ${GMP_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
"${CMAKE_CURRENT_SOURCE_DIR}/src/framework") "${CMAKE_CURRENT_SOURCE_DIR}/src/framework"
)
# setup definitions
ADD_DEFINITIONS(-D_REENTRANT)
IF(CMAKE_BUILD_TYPE STREQUAL "Debug") IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_DEFINITIONS(-D_DEBUG) ADD_DEFINITIONS(-D_DEBUG)
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug") ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(SOURCES SET(SOURCES
# game sources
src/main.cpp src/main.cpp
src/otclient.cpp
src/otclientluafunctions.cpp
# game files
src/tibiadat.cpp
src/tibiaspr.cpp
# game contents
src/game.cpp src/game.cpp
src/map.cpp src/map.cpp
src/tile.cpp
src/thing.cpp
src/item.cpp
# game net
src/protocollogin.cpp src/protocollogin.cpp
src/protocolgame.cpp src/protocolgame.cpp
src/protocolgameparse.cpp
src/protocolgamesend.cpp src/protocolgamesend.cpp
src/protocolgameparse.cpp
src/tibiadat.cpp
src/tibiaspr.cpp
src/item.cpp
src/tile.cpp
src/thing.cpp
# framework core # framework third party
src/framework/core/dispatcher.cpp src/framework/thirdparty/apngloader.cpp
src/framework/core/configs.cpp
src/framework/core/resources.cpp
src/framework/core/engine.cpp
src/framework/core/packages.cpp
# framework otml
src/framework/otml/otmlemitter.cpp
src/framework/otml/otmlparser.cpp
src/framework/otml/otmlnode.cpp
# framework script
src/framework/script/luastate.cpp
src/framework/script/luavalue.cpp
src/framework/script/luaobject.cpp
src/framework/script/luainterface.cpp
src/framework/script/luafunctions.cpp
src/framework/script/luaexception.cpp
src/framework/script/luavaluecasts.cpp
# framework utilities
src/framework/util/color.cpp
src/framework/util/translator.cpp
src/framework/util/convert.cpp
src/framework/util/logger.cpp
src/framework/util/apngloader.cpp
src/framework/util/allocator.cpp
# framework graphics
src/framework/graphics/image.cpp
src/framework/graphics/borderedimage.cpp
src/framework/graphics/framebuffer.cpp
src/framework/graphics/font.cpp
src/framework/graphics/fonts.cpp
src/framework/graphics/textureloader.cpp
src/framework/graphics/texture.cpp
src/framework/graphics/animatedtexture.cpp
src/framework/graphics/textures.cpp
src/framework/graphics/graphics.cpp
src/framework/graphics/textarea.cpp
# framework ui
src/framework/ui/uianchorlayout.cpp
src/framework/ui/uielement.cpp
src/framework/ui/uielementskin.cpp
src/framework/ui/uibuttonskin.cpp
src/framework/ui/uilabelskin.cpp
src/framework/ui/uicontainer.cpp
src/framework/ui/uiskins.cpp
src/framework/ui/uiloader.cpp
src/framework/ui/uibutton.cpp
src/framework/ui/uilabel.cpp
src/framework/ui/uiwindow.cpp
src/framework/ui/uiwindowskin.cpp
src/framework/ui/uitextedit.cpp
src/framework/ui/uitexteditskin.cpp
src/framework/ui/uicheckboxskin.cpp
src/framework/ui/uicheckbox.cpp
# framework net # framework net
src/framework/net/connection.cpp src/framework/net/connection.cpp
src/framework/net/protocol.cpp
src/framework/net/inputmessage.cpp src/framework/net/inputmessage.cpp
src/framework/net/outputmessage.cpp src/framework/net/outputmessage.cpp
src/framework/net/protocol.cpp
src/framework/net/rsa.cpp src/framework/net/rsa.cpp
# framework util
src/framework/util/logger.cpp
src/framework/util/color.cpp
src/framework/util/translator.cpp
# framework core
src/framework/core/configmanager.cpp
src/framework/core/resourcemanager.cpp
src/framework/core/eventdispatcher.cpp
src/framework/core/modulemanager.cpp
src/framework/core/module.cpp
# framework graphics
src/framework/graphics/font.cpp
src/framework/graphics/fontmanager.cpp
src/framework/graphics/graphics.cpp
src/framework/graphics/texture.cpp
src/framework/graphics/framebuffer.cpp
src/framework/graphics/animatedtexture.cpp
src/framework/graphics/framebuffer.cpp
src/framework/graphics/texturemanager.cpp
src/framework/graphics/borderimage.cpp
src/framework/graphics/image.cpp
src/framework/graphics/textarea.cpp
# framework otml
src/framework/otml/otmldocument.cpp
src/framework/otml/otmlemitter.cpp
src/framework/otml/otmlexception.cpp
src/framework/otml/otmlnode.cpp
src/framework/otml/otmlparser.cpp
# framework luascript
src/framework/luascript/luainterface.cpp
src/framework/luascript/luaobject.cpp
src/framework/luascript/luaexception.cpp
src/framework/luascript/luafunctions.cpp
# framework ui
src/framework/ui/uimanager.cpp
src/framework/ui/uiwidget.cpp
src/framework/ui/uilabel.cpp
src/framework/ui/uibutton.cpp
src/framework/ui/uilineedit.cpp
src/framework/ui/uiwindow.cpp
src/framework/ui/uianchorlayout.cpp
src/framework/ui/uianchor.cpp
) )
IF(WIN32) IF(WIN32)
SET(SOURCES ${SOURCES} src/framework/platform/win32platform.cpp) SET(SOURCES ${SOURCES} src/framework/core/win32platform.cpp)
SET(ADDITIONAL_LIBRARIES ws2_32) SET(ADDITIONAL_LIBRARIES ws2_32)
IF(CMAKE_COMPILER_IS_GNUCXX) IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -mwindows") SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -mwindows")
@ -142,25 +132,30 @@ IF(WIN32)
ENDIF(CMAKE_COMPILER_IS_GNUCXX) ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ADD_DEFINITIONS(-DWIN32_NO_CONSOLE) ADD_DEFINITIONS(-DWIN32_NO_CONSOLE)
ELSE(WIN32) ELSE(WIN32)
SET(SOURCES ${SOURCES} src/framework/platform/x11platform.cpp) SET(SOURCES ${SOURCES} src/framework/core/x11platform.cpp)
#ADD_DEFINITIONS(-D_DEBUG_MEMORY)
SET(ADDITIONAL_LIBRARIES pthread GLU)
ENDIF(WIN32) ENDIF(WIN32)
# target executable # target executable
ADD_EXECUTABLE(otclient ${SOURCES}) ADD_EXECUTABLE(otclient ${SOURCES})
# target link libraries # target link libraries
TARGET_LINK_LIBRARIES(otclient TARGET_LINK_LIBRARIES(
otclient
${Boost_LIBRARIES} ${Boost_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
${LUA_LIBRARIES} ${LUA_LIBRARIES}
${PHYSFS_LIBRARY} ${PHYSFS_LIBRARY}
${GMP_LIBRARY} ${GMP_LIBRARY}
${ZLIB_LIBRARY} ${ZLIB_LIBRARY}
${ADDITIONAL_LIBRARIES}) ${ADDITIONAL_LIBRARIES}
)
IF(USE_PCH)
ADD_PRECOMPILED_HEADER(otclient ${CMAKE_CURRENT_SOURCE_DIR}/src/framework/pch.h)
ENDIF(USE_PCH)
# installation # installation
SET(DATA_INSTALL_DIR share/otclient) SET(DATA_INSTALL_DIR share/otclient)
INSTALL(TARGETS otclient RUNTIME DESTINATION bin) INSTALL(TARGETS otclient RUNTIME DESTINATION bin)
INSTALL(DIRECTORY data DESTINATION ${DATA_INSTALL_DIR}) INSTALL(DIRECTORY modules DESTINATION ${DATA_INSTALL_DIR})

View File

@ -1,10 +0,0 @@
glyph-height: 14
glyph-spacing: [1, 1]
top-margin: 2
image: helvetica-11px-bold.png
image-glyph-size: [16, 16]
glyph-widths:
32: 4
65: 8

View File

@ -1,9 +0,0 @@
glyph-height: 14
glyph-spacing: [1, 1]
top-margin: 1
image: helvetica-11px.png
image-glyph-size: [16, 16]
glyph-widths:
32: 4

View File

@ -1,10 +0,0 @@
glyph-height: 16
glyph-spacing: [1, 1]
top-margin: 2
image: helvetica-12px-bold.png
image-glyph-size: [18, 18]
glyph-widths:
32: 4
65: 9

View File

@ -1,9 +0,0 @@
glyph-height: 15
glyph-spacing: [1, 1]
top-margin: 1
image: helvetica-12px.png
image-glyph-size: [16, 16]
glyph-widths:
32: 4
65: 8

View File

@ -1,10 +0,0 @@
glyph-height: 16
glyph-spacing: [1, 1]
top-margin: 2
image: helvetica-14px-bold.png
image-glyph-size: [20, 20]
glyph-widths:
32: 4
65: 9

View File

@ -1,3 +0,0 @@
require 'constants'
require 'util'
require 'messagebox'

View File

@ -1,16 +0,0 @@
require 'entergame'
function initializeApplication()
mainMenu = loadUI("ui/mainmenu", rootUI)
end
function terminateApplication()
exit()
end
-- here is where everything starts
if not initialized then
initializeApplication()
onClose = terminateApplication
initialized = true
end

View File

@ -1,80 +0,0 @@
default font: helvetica-12px
default font color: [210, 210, 210, 255]
buttons:
default:
font: helvetica-11px-bold
font color: [240, 173, 77, 255]
default size: [106, 24]
bordered image:
source: button.png
border: 5
hover state:
bordered image:
source: button_hover.png
border: 5
down state:
text translate: [1, 1]
bordered image:
source: button_down.png
border: 5
panels:
default:
# the default panel is empty
mainMenuBackground:
image: background.png
antialised: true
roundedGridPanel:
bordered image:
source: panel_rounded.png
border: 4
flatPanel:
bordered image:
source: panel_flat.png
border: 1
labels:
default:
large:
font: helvetica-12px-bold
windows:
default:
font: helvetica-11px-bold
font color: [240, 173, 77, 255]
head:
height: 20
bordered image:
source: window.png
size: [256, 19]
border: 4
bottom: 3
body:
bordered image:
source: window.png
size: [256, 237]
offset: [0, 19]
border: 4
top: 0
text edits:
default:
default size: [86, 20]
text margin: 3
bordered image:
source: panel_flat.png
border: 1
line decorations:
default:
bordered image:
source: horizontal_separator.png
top: 2

@ -1 +0,0 @@
Subproject commit a25c238959eb660a187e614eb5c794e0da302bac

23
modules/core/core.otmod Normal file
View File

@ -0,0 +1,23 @@
Module
name: core
description: Contains lua classes, functions and constants used by other modules
author: OTClient team
website: https://github.com/edubart/otclient
version: 0.2
autoLoad: true
dependencies:
- core_fonts
- core_ui
onLoad: |
require 'constants'
require 'util'
require 'widget'
require 'messagebox'
rootWidget = getRootWidget()
return true
onUnload: |
rootWidget = nil

View File

@ -11,32 +11,32 @@ function MessageBox.create(title, text, flags)
-- create messagebox window -- create messagebox window
local window = UIWindow.create() local window = UIWindow.create()
id = "messageBoxWindow" window.id = "messageBoxWindow"
window.title = title window.title = title
window:centerIn(rootUI) window:centerIn("parent")
window:setLocked(true) --window:setLocked(true)
rootUI:addChild(window) rootWidget:addChild(window)
-- create messagebox label -- create messagebox label
local label = UILabel.create() local label = UILabel.create()
id = "messageBoxLabel" label.id = "messageBoxLabel"
label.text = text label.text = text
label:addAnchor(AnchorHorizontalCenter, window.id, AnchorHorizontalCenter) label:addAnchor(AnchorHorizontalCenter, window.id, AnchorHorizontalCenter)
label:addAnchor(AnchorTop, window.id, AnchorTop) label:addAnchor(AnchorTop, window.id, AnchorTop)
--label:setMargin(27, 0) label:setMargin(27, 0)
label:resizeToText()
window:addChild(label) window:addChild(label)
-- set window size based on label size -- set window size based on label size
window.width = label.width + 40 window.width = label.width + 60
window.height = label.height + 64 window.height = label.height + 64
-- setup messagebox first button -- setup messagebox first button
local buttonText local button1 = UIButton.create()
local button1 = UIButton.new() button1.id = "messageBoxButton1"
id = "messageBoxButton1"
button1:addAnchor(AnchorBottom, window.id, AnchorBottom) button1:addAnchor(AnchorBottom, window.id, AnchorBottom)
button1:addAnchor(AnchorRight, window.id, AnchorRight) button1:addAnchor(AnchorRight, window.id, AnchorRight)
--button1:setMargin(10) button1:setMargin(10)
button1.width = 64 button1.width = 64
window:addChild(button1) window:addChild(button1)

19
modules/core/widget.lua Normal file
View File

@ -0,0 +1,19 @@
function UIWidget:setMargin(...)
local params = {...}
if #params == 1 then
self.marginTop = params[1]
self.marginRight = params[1]
self.marginBottom = params[1]
self.marginLeft = params[1]
elseif #params == 2 then
self.marginTop = params[1]
self.marginRight = params[2]
self.marginBottom = params[1]
self.marginLeft = params[2]
elseif #params == 4 then
self.marginTop = params[1]
self.marginRight = params[2]
self.marginBottom = params[3]
self.marginLeft = params[4]
end
end

View File

@ -0,0 +1,17 @@
Module
name: core_fonts
description: Contains fonts used by core
author: OTClient team
website: https://github.com/edubart/otclient
version: 0.2
autoLoad: true
onLoad: |
importFont('helvetica-11px-bold')
importFont('helvetica-11px')
importFont('helvetica-12px-bold')
importFont('helvetica-12px')
importFont('helvetica-14px-bold')
setDefaultFont('helvetica-12px')
return true

View File

@ -0,0 +1,12 @@
Font
name: helvetica-11px-bold
height: 14
spacing: 1 1
top margin: 2
texture: helvetica-11px-bold.png
glyph size: 16 16
glyph widths:
32: 4
65: 8

View File

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -0,0 +1,11 @@
Font
name: helvetica-11px
height: 14
spacing: 1 1
top margin: 1
texture: helvetica-11px.png
glyph size: 16 16
glyph widths:
32: 4

View File

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -0,0 +1,12 @@
Font
name: helvetica-12px-bold
height: 16
spacing: 1 1
top margin: 2
texture: helvetica-12px-bold.png
glyph size: 18 18
glyph widths:
32: 4
65: 9

View File

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

View File

@ -0,0 +1,11 @@
Font
name: helvetica-12px
height: 15
spacing: 1 1
top margin: 1
texture: helvetica-12px.png
glyph size: 16 16
glyph widths:
32: 4
65: 8

View File

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -0,0 +1,12 @@
Font
name: helvetica-14px-bold
height: 16
spacing: 1 1
top margin: 2
texture: helvetica-14px-bold.png
glyph size: 20 20
glyph widths:
32: 4
65: 9

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,19 @@
Button < UIButton
font: helvetica-11px-bold
color: 240 173 77 255
size: 106 24
border-image:
source: /core_ui/images/button.png
border: 5
state.hover:
border-image:
source: /core_ui/images/button_hover.png
border: 5
state.down:
text-translate: 1 1
border-image:
source: /core_ui/images/button_down.png
border: 5

View File

@ -0,0 +1,18 @@
Module
name: core_ui
description: Contains ui styles used by other modules
author: OTClient team
website: https://github.com/edubart/otclient
version: 0.2
autoLoad: true
dependencies:
- core_fonts
onLoad: |
importStyles('buttons.otui')
importStyles('labels.otui')
importStyles('panels.otui')
importStyles('separators.otui')
importStyles('lineedits.otui')
importStyles('windows.otui')
return true

View File

Before

Width:  |  Height:  |  Size: 825 B

After

Width:  |  Height:  |  Size: 825 B

View File

Before

Width:  |  Height:  |  Size: 833 B

After

Width:  |  Height:  |  Size: 833 B

View File

Before

Width:  |  Height:  |  Size: 859 B

After

Width:  |  Height:  |  Size: 859 B

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 151 B

View File

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 152 B

View File

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 179 B

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -0,0 +1,5 @@
Label < UILabel
LargerLabel < Label
font: helvetica-12px-bold

View File

@ -0,0 +1,7 @@
LineEdit < UILineEdit
size: 86 20
text-margin: 3
border-image:
source: /core_ui/images/panel_flat.png
border: 1

View File

@ -0,0 +1,11 @@
Panel < UIWidget
FlatPanel < Panel
border-image:
source: /core_ui/images/panel_flat.png
border: 4
RoundedGridPanel < Panel
border-image:
source: /core_ui/images/panel_rounded.png
border: 4

View File

@ -0,0 +1,4 @@
HorizontalSeparator < UIWidget
border-image:
source: /core_ui/images/horizontal_separator.png
border.top: 2

View File

@ -0,0 +1,20 @@
Window < UIWindow
size: 200 100
head:
height: 20
border-image:
source: /core_ui/images/window.png
size: 256 19
border: 4
border.bottom: 3
body:
border-image:
source: /core_ui/images/window.png
size: 256 237
offset: 0 19
border: 4
border.top: 0
MainWindow < Window
anchors.centerIn: parent

View File

@ -4,7 +4,7 @@ function EnterGame_connectToLoginServer()
-- used to recreate enter game window -- used to recreate enter game window
local recreateEnterGame = function() local recreateEnterGame = function()
loadUI("ui/entergamewindow") loadUI("/mainmenu/ui/entergamewindow.otui")
end end
-- display loading message box -- display loading message box
@ -40,18 +40,16 @@ function EnterGame_connectToLoginServer()
local motdText = string.sub(motd, string.find(motd, "\n") + 1, string.len(motd)) local motdText = string.sub(motd, string.find(motd, "\n") + 1, string.len(motd))
local motdBox = displayInfoBox("Message of the day", motdText) local motdBox = displayInfoBox("Message of the day", motdText)
-- cancel protocol and reacreate enter game window -- hide main menu
protocol:cancel() mainMenu.visible = false
motdBox.onOk = recreateEnterGame
end end
-- get account and password then login -- get account and password then login
local enterGameWindow = rootUI:getChild("enterGameWindow") local enterGameWindow = rootWidget:getChild("enterGameWindow")
local account = enterGameWindow:getChild("accountNameTextEdit").text local account = enterGameWindow:getChild("accountNameLineEdit").text
local password = enterGameWindow:getChild("passwordTextEdit").text local password = enterGameWindow:getChild("accountPasswordLineEdit").text
protocolLogin:login(account, password) protocolLogin:login(account, password)
-- destroy enter game window -- destroy enter game window
enterGameWindow:destroy() enterGameWindow:destroy()
end end

View File

@ -0,0 +1,26 @@
Module
name: mainmenu
description: Create the game mainmenu, where everything starts
author: OTClient team
website: https://github.com/edubart/otclient
version: 0.2
autoLoad: true
dependencies:
- core
onLoad: |
require('entergame')
if not initialized then
mainMenu = loadUI("/mainmenu/ui/mainmenu.otui")
getRootWidget():addChild(mainMenu)
initialized = true
end
return true
onUnload: |
mainMenu:destroy()
mainMenu = nil
initialized = false

View File

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

@ -1,18 +1,17 @@
%window#enterGameWindow MainWindow
id: enterGameWindow
title: Enter Game title: Enter Game
size: [236, 160] size: 236 160
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
%label#accountNameLabel LargerLabel
skin: large
text: Account name text: Account name
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
margin.left: 18 margin.left: 18
margin.top: 28 margin.top: 28
%textEdit#accountNameTextEdit LineEdit
id: accountNameLineEdit
text: otclient0 text: otclient0
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -20,14 +19,14 @@
margin.left: 18 margin.left: 18
margin.right: 18 margin.right: 18
%label#passwordLabel LargerLabel
skin: large
text: Password text: Password
anchors.left: prev.left anchors.left: prev.left
anchors.top: prev.bottom anchors.top: prev.bottom
margin.top: 8 margin.top: 8
%textEdit#passwordTextEdit LineEdit
id: accountPasswordLineEdit
text: 123456 text: 123456
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -35,7 +34,7 @@
margin.left: 18 margin.left: 18
margin.right: 18 margin.right: 18
%button#okButton Button
text: Ok text: Ok
width: 64 width: 64
anchors.right: next.left anchors.right: next.left
@ -44,11 +43,11 @@
margin.right: 16 margin.right: 16
onClick: EnterGame_connectToLoginServer() onClick: EnterGame_connectToLoginServer()
%button#cancelButton Button
text: Cancel text: Cancel
width: 64 width: 64
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
margin.bottom: 16 margin.bottom: 16
margin.right: 16 margin.right: 16
onClick: function(self) rootUI:getChild("enterGameWindow"):destroy() end onClick: function(self) self.parent:destroy() end

View File

@ -1,19 +1,16 @@
%window#infoWindow MainWindow
id: infoWindow
title: Info title: Info
size: [244, 221] size: 244 221
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
onLoad: function(self) self:setLocked() end
%panel#infoPanel FlatPanel
skin: flatPanel size: 208 129
size: [208, 129]
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
margin.top: 32 margin.top: 32
margin.left: 18 margin.left: 18
%label#infoLabel Label
align: center align: center
text: |- text: |-
OTClient OTClient
@ -23,29 +20,29 @@
anchors.top: parent.top anchors.top: parent.top
margin.top: 20 margin.top: 20
%lineDecoration#bottomSeparator HorizontalSeparator
size: [190, 2] size: 190 2
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
margin.top: 83 margin.top: 83
margin.left: 9 margin.left: 9
%label#websiteLabel Label
text: Official Website text: Official Website
anchors.left: parent.left anchors.left: parent.left
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
margin.bottom: 14 margin.bottom: 14
margin.left: 9 margin.left: 9
%button#websiteButton Button
text: Github Page text: Github Page
size: [88, 24] size: 88 24
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
margin.bottom: 9 margin.bottom: 9
margin.right: 9 margin.right: 9
%lineDecoration#bottomSeparator HorizontalSeparator
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
@ -53,9 +50,9 @@
margin.left: 13 margin.left: 13
margin.right: 13 margin.right: 13
%button#okButton Button
text: Ok text: Ok
size: [46, 24] size: 46 24
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
margin.top: 191 margin.top: 191

View File

@ -1,42 +1,47 @@
%panel#background Panel
skin: mainMenuBackground skin: mainMenuBackground
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
%panel#mainMenu Panel
id: mainMenu
skin: roundedGridPanel skin: roundedGridPanel
size: [144, 162] size: 144 162
anchors.left: parent.left anchors.left: parent.left
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
margin.left: 60 margin.left: 60
margin.bottom: 70 margin.bottom: 70
%button#enterGameButton Button
id: enterGameButton
text: Enter Game text: Enter Game
anchors.top: parent.top anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
margin.top: 18 margin.top: 18
onClick: loadUI("entergamewindow", rootUI) onClick: rootWidget:addChild(loadUI("entergamewindow"))
%button#optionsButton Button
id: optionsButton
text: Options text: Options
anchors.top: prev.bottom anchors.top: prev.bottom
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
margin.top: 10 margin.top: 10
onClick: loadUI("optionswindow", rootUI) onClick: rootWidget:addChild(loadUI("optionswindow"))
%button#infoButton Button
id: infoButton
text: Info text: Info
anchors.top: prev.bottom anchors.top: prev.bottom
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
margin.top: 10 margin.top: 10
onClick: loadUI("infowindow", rootUI) onClick: rootWidget:addChild(loadUI("infowindow"))
%button#exitGameButton Button
id: exitGameButton
text: Exit text: Exit
anchors.top: prev.bottom anchors.top: prev.bottom
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
margin.top: 10 margin.top: 10
onClick: terminateApplication() onClick: exit()

View File

@ -0,0 +1,38 @@
MenuButton < Button
anchors.top: prev.bottom
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 10
Panel
id: mainMenuBackground
image:
source: /mainmenu/ui/background.png
smooth: true
anchors.fill: parent
RoundedGridPanel
id: mainMenu
size: 144 162
anchors.left: parent.left
anchors.bottom: parent.bottom
margin.left: 60
margin.bottom: 70
MenuButton
text: Enter Game
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 18
onClick: rootWidget:addChild(loadUI("/mainmenu/ui/entergamewindow.otui"))
MenuButton
text: Options
onClick: rootWidget:addChild(loadUI("/mainmenu/ui/optionswindow.otui"))
MenuButton
text: Info
onClick: rootWidget:addChild(loadUI("/mainmenu/ui/infowindow.otui"))
MenuButton
text: Exit
onClick: exit()

View File

@ -1,19 +1,18 @@
%window#optionsWindow MainWindow
id: optionsWindow
title: Options title: Options
size: [286, 262] size: 286 262
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
onLoad: function(self) self:setLocked(true) end
# general // general
%button#generalButton Button
text: General text: General
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
margin.left: 18 margin.left: 18
margin.top: 32 margin.top: 32
onClick: displayErrorBox("Error", "Not implemented yet")
%label#generalLabel Label
text: |- text: |-
Change general Change general
game options game options
@ -22,15 +21,15 @@
margin.left: 10 margin.left: 10
margin.top: -2 margin.top: -2
# graphics // graphics
%button#graphicsButton Button
text: Graphics text: Graphics
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
margin.left: 18 margin.left: 18
margin.top: 65 margin.top: 65
%label#graphicsLabel Label
text: |- text: |-
Change graphics and Change graphics and
performance settings performance settings
@ -39,37 +38,37 @@
margin.left: 10 margin.left: 10
margin.top: -2 margin.top: -2
# console // console
%button#consoleButton Button
text: Console text: Console
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
margin.left: 18 margin.left: 18
margin.top: 98 margin.top: 98
%label#consoleLabel Label
text: Customise the console text: Customise the console
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
margin.left: 10 margin.left: 10
margin.top: -2 margin.top: -2
# hotkeys // hotkeys
%button#hotkeysButton Button
text: Hotkeys text: Hotkeys
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
margin.left: 18 margin.left: 18
margin.top: 131 margin.top: 131
%label#hotkeysLabel Label
text: Edit your hotkey texts text: Edit your hotkey texts
anchors.left: prev.right anchors.left: prev.right
anchors.top: prev.top anchors.top: prev.top
margin.left: 10 margin.left: 10
margin.top: -2 margin.top: -2
%lineDecoration#middleSeparator HorizontalSeparator
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
@ -77,15 +76,15 @@
margin.left: 18 margin.left: 18
margin.right: 18 margin.right: 18
# motd // motd
%button#motdButton Button
text: Motd text: Motd
anchors.left: parent.left anchors.left: parent.left
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
margin.left: 18 margin.left: 18
margin.bottom: 60 margin.bottom: 60
%label#motdLabel Label
text: | text: |
Show the most recent Show the most recent
Message of the Day Message of the Day
@ -94,7 +93,7 @@
margin.left: 10 margin.left: 10
margin.top: -2 margin.top: -2
%lineDecoration#bottomSeparator HorizontalSeparator
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
@ -102,10 +101,10 @@
margin.left: 13 margin.left: 13
margin.right: 13 margin.right: 13
# ok button // ok button
%button#okButton Button
text: Ok text: Ok
size: [43, 20] size: 43 20
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
margin.right: 10 margin.right: 10

1
modules/tibiafiles Submodule

@ -0,0 +1 @@
Subproject commit 8bb3b7d6d86e561be4622fbe7dbef208446a0319

View File

@ -1,11 +0,0 @@
rootUI = App.getRootContainer()
-- AnchorPoint
AnchorNone = 0
AnchorTop = 1
AnchorBottom = 2
AnchorLeft = 3
AnchorRight = 4
AnchorVerticalCenter = 5
AnchorHorizontalCenter = 6

View File

@ -1,3 +0,0 @@
require 'constants'
require 'util'
require 'messagebox'

View File

@ -1,86 +0,0 @@
MessageBox = {}
MessageBox.__index = MessageBox
-- messagebox flags
MessageBoxOk = 1
MessageBoxCancel = 2
function MessageBox.create(title, text, flags)
local box = {}
setmetatable(box, MessageBox)
-- create messagebox window
local window = UIWindow.new("messageBoxWindow", rootUI)
window.title = title
window:centerIn(rootUI)
window:setLocked()
-- create messagebox label
local label = UILabel.new("messageBoxLabel", window)
label.text = text
label:addAnchor(AnchorHorizontalCenter, window, AnchorHorizontalCenter)
label:addAnchor(AnchorTop, window, AnchorTop)
label:setMargin(27, 0)
-- set window size based on label size
window.width = label.width + 40
window.height = label.height + 64
-- setup messagebox first button
local buttonText
local button1 = UIButton.new("messageBoxButton1", window)
button1:addAnchor(AnchorBottom, window, AnchorBottom)
button1:addAnchor(AnchorRight, window, AnchorRight)
button1:setMargin(10)
if flags == MessageBoxOk then
buttonText = "Ok"
box.onOk = createEmptyFunction()
button1.onClick = function()
box.onOk()
box:destroy()
end
elseif flags == MessageBoxCancel then
buttonText = "Cancel"
box.onCancel = createEmptyFunction()
button1.onClick = function()
box.onCancel()
box:destroy()
end
end
button1.text = buttonText
box.window = window
return box
end
function MessageBox:destroy()
if self.onDestroy then
self.onDestroy()
self.onDestroy = nil
end
if self.window then
self.window:destroy()
self.window = nil
end
self.onOk = nil
self.onCancel = nil
end
-- shortcuts for creating message boxes
function displayMessageBox(title, text, flags)
return MessageBox.create(title, text, flags)
end
function displayErrorBox(title, text)
return MessageBox.create(title, text, MessageBoxOk)
end
function displayInfoBox(title, text)
return MessageBox.create(title, text, MessageBoxOk)
end
function displayCancelBox(title, text)
return MessageBox.create(title, text, MessageBoxCancel)
end

View File

@ -1,9 +0,0 @@
title: Core
description: Core utilities used by other modules
author: otclient
version: 1
website: https://github.com/edubart/otclient
enabled: true
dependencies: [core_fonts, core_styles]
script: core.lua

View File

@ -1,5 +0,0 @@
function createEmptyFunction()
local emptyFunction = function() end
return emptyFunction
end

View File

@ -1,4 +0,0 @@
-- load default fonts
App.loadFont("fonts/helvetica-11px")
App.loadFont("fonts/helvetica-11px-bold")

View File

@ -1,9 +0,0 @@
glyph-height: 14
glyph-spacing: 1 1
top-margin: 2
image: helvetica-11px-bold.png
image-glyph-size: 16 16
glyph-widths:
32: 4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -1,9 +0,0 @@
glyph-height: 14
glyph-spacing: 1 1
top-margin: 1
image: helvetica-11px.png
image-glyph-size: 16 16
glyph-widths:
32: 4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -1,9 +0,0 @@
title: Fonts
description: Fonts package
author: otclient
version: 1
website: https://github.com/edubart/otclient
enabled: true
dependencies: []
script: fonts.lua

View File

@ -1,9 +0,0 @@
title: Core styles
description: Core styles used by other modules
author: otclient
version: 1
website: https://github.com/edubart/otclient
enabled: true
dependencies: [core_fonts]
script: styles.lua

View File

@ -1,12 +0,0 @@
-- set default font
App.setDefaultFont("helvetica-11px")
App.setDefaultFontColor(Color("#f0ad4dff"))
-- load styles
App.loadStyle("styles/utilities")
App.loadStyle("styles/panels")
App.loadStyle("styles/buttons")
App.loadStyle("styles/labels")
App.loadStyle("styles/textedits")
App.loadStyle("styles/windows")
App.loadStyle("styles/linedecorations")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 859 B

View File

@ -1,25 +0,0 @@
button
font: helvetica-11px-bold
font-color: #f0ad4dff
size: 106 24
bordered-image: { source: button_standard.png; border: 5 }
button:hover
bordered-image: { source: tibia_flash/button_standard_hover.png; border: 5 }
button:down
text-translate: 1 1
bordered-image: { source: tibia_flash/button_standard_down.png; border: 5 }
button.small
width: 64
button.large
width: 144
button.notImplemented
onClick: displayErrorBox("Error", "Not implemented yet")
button.closeParent
onClick: self.parent:destroy()

View File

@ -1,57 +0,0 @@
function EnterGame_connectToLoginServer()
-- create login protocol
local protocolLogin = ProtocolLogin.new()
-- used to recreate enter game window
local recreateEnterGame = function()
loadUI("ui/entergamewindow")
end
-- display loading message box
local loadBox = displayCancelBox("Please wait", "Connecting..")
-- cancel loading callback
loadBox.onCancel = function()
-- cancel protocol and reacreate enter game window
protocolLogin:cancel()
recreateEnterGame()
end
-- error callback
protocolLogin.onError = function(error)
-- destroy loading message box
loadBox:destroy()
-- display error message
local errorBox = displayErrorBox("Login Error", error)
-- cancel protocol and reacreate enter game window
self.cancel()
errorBox.onOk = recreateEnterGame
end
-- motd callback
protocolLogin.onMotd = function(motd)
-- destroy loading message box
loadBox:destroy()
-- display motd
local motdNumber = string.sub(motd, 0, string.find(motd, "\n"))
local motdText = string.sub(motd, string.find(motd, "\n") + 1, string.len(motd))
local motdBox = displayInfoBox("Message of the day", motdText)
-- cancel protocol and reacreate enter game window
self.cancel()
motdBox.onOk = recreateEnterGame
end
-- get account and password then login
local enterGameWindow = rootUI:child("enterGameWindow")
local account = enterGameWindow:child("accountNameTextEdit").text
local password = enterGameWindow:child("passwordTextEdit").text
protocolLogin:login(account, password)
-- destroy enter game window
enterGameWindow:destroy()
end

View File

@ -1,16 +0,0 @@
require 'entergame'
function initializeApplication()
mainMenu = loadUI("ui/mainmenu")
end
function terminateApplication()
App.exit()
end
-- here is where everything starts
if not initialized then
initializeApplication()
App.onClose = terminateApplication
initialized = true
end

View File

@ -1,9 +0,0 @@
title: Main menu
description: Used to create the main menu
author: otclient
version: 1
website: https://github.com/edubart/otclient
enabled: true
dependencies: [core]
script: init.lua

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

View File

@ -1,63 +0,0 @@
Window
id: enterGameWindow
title: Enter Game
size: 236 178
anchor.centerIn: parent
lockOnLoad: true
Label
text: Account name
position: 18 33
Label
text: "Password:"
position: 18 62
Label
text:
[[If you don't have
an account yet]]
anchors.top: parent.top
anchors.left: parent.left
margin: 87 18
Button
text: Create Account
anchors.top: parent.top
anchors.right: parent.right
margin: 94 18
onClick:
function(self)
displayErrorBox("Error", "Not implemented yet")
self.parent:destroy()
end
SmallButton
text: Ok
anchors.bottomRight: parent.bottomRight
margin: 10 66
onClick: EnterGame_connectToLoginServer()
SmallButton
text: Cancel
anchors.bottom: parent.bottom
anchors.right: parent.right
margin: 10 13
onClick: displayErrorBox("Error", "Not implemented yet")
TextEdit
id: accountNameTextEdit
text: tibialua0
anchors.top: parent.top
anchors.right: parent.right
margin: 32 18
TextEdit
id: passwordTextEdit
text: lua123456
text-hidden: true
anchors.top: parent.top
anchors.right: parent.right
margin: 61 18

View File

@ -1,54 +0,0 @@
%window#infoWindow
title: Info
size: 244 221
anchor.centerIn: parent
lockOnLoad: true
%panel.flat
size: 208 129
anchors.top: parent.top
anchors.left: parent.left
margin: 32 18
%label
align: center
text: |-
OTClient
Version 0.2.0
Created by edubart
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
margin.top: 20
%element.bottomSeparator
size: 190 2
anchors.top: parent.top
anchors.left: parent.left
margin: 83 9
%label
text: Official Website
anchors.bottom: parent.bottom
anchors.left: parent.left
margin: 14 9
%button
text: Github Page
size: 80 22
anchors.bottom: parent.bottom
anchors.right: parent.right
margin: 9
%element.bottomSeparator
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
margin: 40 13
%button.closeParent
text: Ok
size: 43 20
anchors.top: parent.top
anchors.left: parent.left
margin: 191 188

View File

@ -1,63 +0,0 @@
@import "additional_elements"
Panel
id: "mainBackground"
image:
source: "background.png"
antialised: true
anchor.fill: parent
lista:
- valor1
- valor2
- valor3
FlatPanel
id: mainMenuPanel
size: {117, 171}
anchors.bottom: parent.bottom
anchors.left: parent.left
margin: {70, 60}
// enter game button
Button
text: "Enter Game"
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 16
onClick: |
function(self)
if not mainMenu:getChild("enterGameWindow") then
local enterGame = loadUI("entergamewindow")
enterGame:setLocked(true)
end
end
Button
text: "Access Account"
anchors.top: prev.bottom
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 6
onClick: loadUI("entergamewindow")
Button
text: "Options"
anchors.top: prev.bottom
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 6
onClick: loadUI("optionswindow")
Button
text: "Info"
anchors.top: prev.bottom
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 6
onClick: loadUI("infowindow")
Button
text: "Exit"
anchors.top: prev.bottom
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 6
onClick: terminateApplication()

View File

@ -1,82 +0,0 @@
%window#optionsWindow
title: Options
size: 286 262
anchor.centerIn: parent
lockOnLoad: true
panel
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin.left: 18
margin.top: 3
height: 30
button
anchors.top: parent.top
anchors.left: parent.left
margin.top: 3
onClick: displayErrorBox("Error", "Not implemented yet")
label
anchors.top: parent.top
anchors.left: parent.left
margin.top: 99
%panel
anchors.top: parent.top
margin.top: 29
%button { text: General }
%label { text: "Change general\ngame options" }
%panel
%button { text: Graphics }
%label { text: "Change graphics and\nperformance settings" }
%panel
%button { text: Console }
%label { text: Customise the console }
%panel
%button { text: Hotkeys }
%label { text: Edit your hotkey texts }
%element.horizontalSeparator
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
margin: 97 18
%panel
anchors.top: ~
anchors.bottom: parent.bottom
margin.top: 29
%button
text: Motd
anchors.left: parent.left
anchors.bottom: parent.bottom
margin: 60 18
%label
text: |
Show the most recent
Message of the Day
anchors.left: parent.left
anchors.bottom: parent.bottom
margin: 56 117
%element.horizontalSeparator
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
margin: 40 13
%button.closeParent
text: Ok
size: 43 20
anchors.right: parent.right
anchors.bottom: parent.bottom
margin: 13 10

View File

@ -1,6 +1,8 @@
#ifndef CONST_H #ifndef CONST_H
#define CONST_H #define CONST_H
//namespace Fw {
enum AlignmentFlag { enum AlignmentFlag {
AlignLeft = 1, AlignLeft = 1,
AlignRight = 2, AlignRight = 2,
@ -19,4 +21,42 @@ enum AlignmentFlag {
AlignCenter = AlignVerticalCenter | AlignHorizontalCenter AlignCenter = AlignVerticalCenter | AlignHorizontalCenter
}; };
#endif // CONST_H enum AnchorPoint {
AnchorNone = 0,
AnchorTop,
AnchorBottom,
AnchorLeft,
AnchorRight,
AnchorVerticalCenter,
AnchorHorizontalCenter,
};
enum MouseButton {
MouseNoButton = 0,
MouseLeftButton,
MouseRightButton,
MouseMidButton
};
enum MouseWheelDirection {
MouseNoWheel = 0,
MouseWheelUp,
MouseWheelDown
};
enum KeyboardModifier {
KeyboardNoModifier = 0,
KeyboardCtrlModifier = 1,
KeyboardAltModifier = 2,
KeyboardShiftModifier = 4
};
enum ButtonState {
ButtonUp = 0,
ButtonDown,
ButtonHover
};
//}
#endif

View File

@ -0,0 +1,35 @@
#include "configmanager.h"
#include "resourcemanager.h"
#include <otml/otml.h>
ConfigManager g_configs;
bool ConfigManager::load(const std::string& fileName)
{
m_fileName = fileName;
if(!g_resources.fileExists(fileName))
return false;
try {
OTMLDocumentPtr doc = OTMLDocument::parse(fileName);
for(const OTMLNodePtr& child : doc->childNodes())
m_confsMap[child->tag()] = child->value();
} catch(std::exception& e) {
logError("ERROR: could not load configurations: ", e.what());
return false;
}
return true;
}
bool ConfigManager::save()
{
if(!m_fileName.empty()) {
OTMLDocumentPtr doc = OTMLDocument::create();
doc->write(m_confsMap);
return doc->save(m_fileName);
}
return false;
}

View File

@ -1,25 +1,25 @@
#ifndef CONFIGS_H #ifndef CONFIGMANAGER_H
#define CONFIGS_H #define CONFIGMANAGER_H
#include <global.h> #include <global.h>
struct ConfigValueProxy { struct ConfigValueProxy {
ConfigValueProxy(const std::string& v) : value(v) { } ConfigValueProxy(const std::string& v) : value(v) { }
operator std::string() const { return convert<std::string>(value); } operator std::string() const { return aux::unsafe_cast<std::string>(value); }
operator float() const { return convert<float>(value); } operator float() const { return aux::unsafe_cast<float>(value); }
operator int() const { return convert<int>(value); } operator int() const { return aux::unsafe_cast<int>(value); }
operator bool() const { return convert<bool>(value); } operator bool() const { return aux::unsafe_cast<bool>(value); }
std::string value; std::string value;
}; };
class Configs class ConfigManager
{ {
public: public:
bool load(const std::string& fileName); bool load(const std::string& fileName);
void save(); bool save();
template<class T> template<class T>
void set(const std::string& key, const T& value) { m_confsMap[key] = convert<std::string>(value); } void set(const std::string& key, const T& value) { m_confsMap[key] = aux::unsafe_cast<std::string>(value); }
ConfigValueProxy get(const std::string& key) { return ConfigValueProxy(m_confsMap[key]); } ConfigValueProxy get(const std::string& key) { return ConfigValueProxy(m_confsMap[key]); }
@ -28,6 +28,6 @@ private:
std::map<std::string, std::string> m_confsMap; std::map<std::string, std::string> m_confsMap;
}; };
extern Configs g_configs; extern ConfigManager g_configs;
#endif // CONFIGS_H #endif

View File

@ -1,37 +0,0 @@
#include "configs.h"
#include "resources.h"
#include <otml/otml.h>
Configs g_configs;
bool Configs::load(const std::string& fileName)
{
m_fileName = fileName;
if(!g_resources.fileExists(fileName))
return false;
std::stringstream fin;
if(!g_resources.loadFile(fileName, fin))
return false;
try {
OTMLParser parser(fin, fileName);
parser.getDocument()->read(&m_confsMap);
} catch(OTMLException e) {
logError("ERROR: Malformed config file: ", e.what());
return false;
}
return true;
}
void Configs::save()
{
if(!m_fileName.empty()) {
OTMLEmitter emitter;
emitter.createDocument()->write(m_confsMap);
g_resources.saveFile(m_fileName, emitter.emitDocument());
}
}

View File

@ -1,43 +0,0 @@
#include "dispatcher.h"
#include "engine.h"
Dispatcher g_dispatcher;
void Dispatcher::cleanup()
{
while(!m_scheduledTaskList.empty()) {
ScheduledTask *task = m_scheduledTaskList.top();
m_scheduledTaskList.pop();
delete task;
}
}
void Dispatcher::poll()
{
while(!m_taskList.empty()) {
m_taskList.front()();
m_taskList.pop_front();
}
while(!m_scheduledTaskList.empty()) {
ScheduledTask *task = m_scheduledTaskList.top();
if(g_engine.getCurrentFrameTicks() < task->ticks)
break;
m_scheduledTaskList.pop();
task->callback();
delete task;
}
}
void Dispatcher::scheduleTask(const std::function<void()>& callback, int delay)
{
m_scheduledTaskList.push(new ScheduledTask(g_engine.getCurrentFrameTicks() + delay, callback));
}
void Dispatcher::addTask(const std::function<void()>& callback, bool pushFront)
{
if(pushFront)
m_taskList.push_front(callback);
else
m_taskList.push_back(callback);
}

View File

@ -1,43 +0,0 @@
#ifndef DISPATCHER_H
#define DISPATCHER_H
#include <global.h>
#include <queue>
struct ScheduledTask {
ScheduledTask(const std::function<void()>& _callback) : ticks(0), callback(_callback) { }
ScheduledTask(int _ticks, const std::function<void()>& _callback) : ticks(_ticks), callback(_callback) { }
bool operator<(const ScheduledTask& other) const { return ticks > other.ticks; }
int ticks;
std::function<void()> callback;
};
struct lessScheduledTask : public std::binary_function<ScheduledTask*&, ScheduledTask*&, bool> {
bool operator()(ScheduledTask*& t1,ScheduledTask*& t2) { return (*t1) < (*t2); }
};
class Dispatcher
{
public:
Dispatcher() { }
/// Cleanup scheduled events
void cleanup();
/// Execute scheduled events
void poll();
/// Add an event
void addTask(const std::function<void()>& callback, bool pushFront = false);
/// Schedula an event
void scheduleTask(const std::function<void()>& callback, int delay);
private:
std::list<std::function<void()>> m_taskList;
std::priority_queue<ScheduledTask*, std::vector<ScheduledTask*>, lessScheduledTask> m_scheduledTaskList;
};
extern Dispatcher g_dispatcher;
#endif // DISPATCHER_H

View File

@ -1,155 +0,0 @@
#include "engine.h"
#include "platform.h"
#include "dispatcher.h"
#include <graphics/graphics.h>
#include <graphics/fonts.h>
#include <graphics/textures.h>
#include <ui/uicontainer.h>
#include <ui/uiskins.h>
#include <script/luainterface.h>
#include <net/connection.h>
#include <../game.h>
#include <../item.h>
Engine g_engine;
void Engine::init()
{
// initialize stuff
g_graphics.init();
g_fonts.init();
g_lua.init();
}
void Engine::terminate()
{
// destroy root ui
UIContainer::getRoot()->destroy();
// cleanup script stuff
g_lua.terminate();
// poll remaning events
g_engine.poll();
// terminate stuff
g_fonts.terminate();
g_graphics.terminate();
g_dispatcher.cleanup();
}
void Engine::poll()
{
// poll platform events
Platform::poll();
// poll diaptcher tasks
g_dispatcher.poll();
// poll network events
Connection::poll();
}
void Engine::run()
{
// check if root container has elements
const UIContainerPtr& rootContainer = UIContainer::getRoot();
if(rootContainer->getChildCount() == 0)
logFatal("FATAL ERROR: no ui loaded at all, no reason to continue running");
std::string fpsText;
Size fpsTextSize;
FontPtr defaultFont = g_uiSkins.getDefaultFont();
m_lastFrameTicks = Platform::getTicks();
int lastFpsTicks = m_lastFrameTicks;
int frameCount = 0;
int fps = 0;
m_running = true;
while(!m_stopping) {
m_lastFrameTicks = Platform::getTicks();
poll();
// render only when visible
if(Platform::isWindowVisible()) {
// calculate fps
if(m_calculateFps) {
frameCount++;
if(m_lastFrameTicks - lastFpsTicks >= 1000) {
lastFpsTicks = m_lastFrameTicks;
fps = frameCount;
frameCount = 0;
// update fps text
fpsText = make_string("FPS: ", fps);
fpsTextSize = defaultFont->calculateTextRectSize(fpsText);
}
}
// render
g_graphics.beginRender();
rootContainer->render();
// todo remove. render map
g_game.getMap()->draw(0, 0);
// todo remove. view items
static Item *item = NULL;
if(!item) {
item = new Item();
item->setId(8377);
}
//item->draw(1, 1, 7);
// render fps
if(m_calculateFps)
defaultFont->renderText(fpsText, Point(g_graphics.getScreenSize().width() - fpsTextSize.width() - 10, 10));
g_graphics.endRender();
// swap buffers
Platform::swapBuffers();
}
}
m_stopping = false;
m_running = false;
}
void Engine::stop()
{
m_stopping = true;
}
void Engine::onClose()
{
g_lua.getGlobal("onClose")->call("onClose");
}
void Engine::onResize(const Size& size)
{
g_graphics.resize(size);
UIContainer::getRoot()->setSize(size);
}
void Engine::onInputEvent(const InputEvent& event)
{
UIContainer::getRoot()->onInputEvent(event);
ProtocolGame *protocol = g_game.getProtocol();
if(protocol) {
if(event.type == EV_KEY_DOWN) {
if(event.keycode == KC_UP)
protocol->sendWalkNorth();
if(event.keycode == KC_RIGHT)
protocol->sendWalkEast();
if(event.keycode == KC_DOWN)
protocol->sendWalkSouth();
if(event.keycode == KC_LEFT)
protocol->sendWalkWest();
}
}
}

View File

@ -1,53 +0,0 @@
#ifndef ENGINE_H
#define ENGINE_H
#include <global.h>
#include "input.h"
class Engine
{
public:
Engine() : m_stopping(false),
m_running(false),
m_calculateFps(false) { }
void init();
void terminate();
/// Poll events
void poll();
/// Main loop
void run();
/// Stops main loop
void stop();
/// Change current game state
bool isRunning() const { return m_running; }
bool isStopping() const { return m_stopping; }
/// Fired by platform on window close
void onClose();
/// Fired by platform on window resize
void onResize(const Size& size);
/// Fired by platform on mouse/keyboard input
void onInputEvent(const InputEvent& event);
/// Enable FPS counter on screen
void enableFpsCounter(bool enable = true) { m_calculateFps = enable; };
/// Return the current ticks on this frame
int getCurrentFrameTicks() const { return m_lastFrameTicks; }
private:
bool m_stopping;
bool m_running;
bool m_calculateFps;
int m_lastFrameTicks;
};
extern Engine g_engine;
#endif // ENGINE_H

View File

@ -0,0 +1,45 @@
#include "eventdispatcher.h"
#include <core/platform.h>
EventDispatcher g_dispatcher;
void EventDispatcher::init()
{
// nothing to do
}
void EventDispatcher::terminate()
{
// clean scheduled events
while(!m_scheduledEventList.empty())
m_scheduledEventList.pop();
}
void EventDispatcher::poll()
{
while(!m_eventList.empty()) {
m_eventList.front()();
m_eventList.pop_front();
}
while(!m_scheduledEventList.empty()) {
if(g_platform.getTicks() < m_scheduledEventList.top().ticks)
break;
SimpleCallback callback = std::move(m_scheduledEventList.top().callback);
m_scheduledEventList.pop();
callback();
}
}
void EventDispatcher::scheduleEvent(const SimpleCallback& callback, int delay)
{
m_scheduledEventList.push(ScheduledEvent(g_platform.getTicks() + delay, callback));
}
void EventDispatcher::addEvent(const SimpleCallback& callback, bool pushFront)
{
if(pushFront)
m_eventList.push_front(callback);
else
m_eventList.push_back(callback);
}

View File

@ -0,0 +1,38 @@
#ifndef EVENTDISPATCHER_H
#define EVENTDISPATCHER_H
#include <global.h>
struct ScheduledEvent {
ScheduledEvent(int ticks, const SimpleCallback& callback) : ticks(ticks), callback(callback) { }
bool operator<(const ScheduledEvent& other) const { return ticks > other.ticks; }
int ticks;
SimpleCallback callback;
};
class EventDispatcher
{
public:
/// Initialize dispatcher
void init();
/// Cleanup scheduled events
void terminate();
/// Execute scheduled events
void poll();
/// Add an event
void addEvent(const SimpleCallback& callback, bool pushFront = false);
/// Schedule an event
void scheduleEvent(const SimpleCallback& callback, int delay);
private:
std::list<SimpleCallback> m_eventList;
std::priority_queue<ScheduledEvent> m_scheduledEventList;
};
extern EventDispatcher g_dispatcher;
#endif

View File

@ -1,10 +1,9 @@
#ifndef INPUT_H #ifndef INPUTEVENT_H
#define INPUT_H #define INPUTEVENT_H
#include <util/types.h> #include <global.h>
#include <util/point.h>
enum EKeyCode { enum InputKeyCode {
KC_UNKNOWN = 0x00, KC_UNKNOWN = 0x00,
KC_ESCAPE = 0x01, KC_ESCAPE = 0x01,
KC_1 = 0x02, KC_1 = 0x02,
@ -152,28 +151,28 @@ enum EKeyCode {
KC_MEDIASELECT = 0xED // Media Select KC_MEDIASELECT = 0xED // Media Select
}; };
enum EEvent { enum InputEventType {
EV_MOUSE = 1, EventNone = 0,
EV_KEYBOARD = 2, EventMouseAction = 1,
EV_DOWN = 4, EventKeyboardAction = 2,
EV_UP = 8, EventDown = 4,
EV_MOUSE_WHEEL = 16, EventUp = 8,
EV_MOUSE_LEFT = 32, EventMouseWheel = 16,
EV_MOUSE_RIGHT = 64, EventMouseLeftButton = 32,
EV_MOUSE_MIDDLE = 128, EventMouseRightButton = 64,
EventMouseMidButton = 128,
EV_TEXT_ENTER = EV_KEYBOARD | 256, EventTextEnter = 256,
EV_KEY_DOWN = EV_KEYBOARD | EV_DOWN, EventKeyDown = EventKeyboardAction | EventDown,
EV_KEY_UP = EV_KEYBOARD | EV_UP, EventKeyUp = EventKeyboardAction | EventUp,
EV_MOUSE_MOVE = EV_MOUSE | 512, EventMouseMove = EventMouseAction | 512,
EV_MOUSE_LDOWN = EV_MOUSE | EV_MOUSE_LEFT | EV_DOWN, EventMouseLeftButtonDown = EventMouseAction | EventMouseLeftButton | EventDown,
EV_MOUSE_LUP = EV_MOUSE | EV_MOUSE_LEFT | EV_UP, EventMouseLeftButtonUp = EventMouseAction | EventMouseLeftButton | EventUp,
EV_MOUSE_MDOWN = EV_MOUSE | EV_MOUSE_MIDDLE | EV_DOWN, EventMouseMiddleButtonDown = EventMouseAction | EventMouseMidButton | EventDown,
EV_MOUSE_MUP = EV_MOUSE | EV_MOUSE_MIDDLE | EV_UP, EventMouseMiddleButtonUp = EventMouseAction | EventMouseMidButton | EventUp,
EV_MOUSE_RDOWN = EV_MOUSE | EV_MOUSE_RIGHT | EV_DOWN, EventMouseRightButtonDown = EventMouseAction | EventMouseRightButton | EventDown,
EV_MOUSE_RUP = EV_MOUSE | EV_MOUSE_RIGHT | EV_UP, EventMouseRightButtonUp = EventMouseAction | EventMouseRightButton | EventUp,
EV_MOUSE_WHEEL_UP = EV_MOUSE | EV_MOUSE_WHEEL | EV_UP, EventMouseWheelUp = EventMouseAction | EventMouseWheel | EventUp,
EV_MOUSE_WHEEL_DOWN = EV_MOUSE | EV_MOUSE_WHEEL | EV_DOWN EventMouseWheelDown = EventMouseAction | EventMouseWheel | EventDown
}; };
struct InputEvent { struct InputEvent {
@ -187,4 +186,4 @@ struct InputEvent {
bool alt; bool alt;
}; };
#endif // INPUT_H #endif

View File

@ -0,0 +1,73 @@
#include "module.h"
#include <otml/otml.h>
#include <luascript/luainterface.h>
#include "modulemanager.h"
void Module::discover(const OTMLNodePtr& moduleNode)
{
m_description = moduleNode->readAt<std::string>("description");
m_author = moduleNode->readAt<std::string>("author");
m_website = moduleNode->readAt<std::string>("website");
m_version = moduleNode->readAt<std::string>("version");
if(OTMLNodePtr node = moduleNode->get("dependencies")) {
for(const OTMLNodePtr& tmp : node->childNodes())
m_dependencies.push_back(tmp->value());
}
// set onLoad callback
if(OTMLNodePtr node = moduleNode->get("onLoad")) {
g_lua.loadFunction(node->read<std::string>(), "@" + node->source() + "[" + node->tag() + "]");
g_lua.useValue();
m_loadCallback = g_lua.polymorphicPop<BooleanCallback>();
}
// set onUnload callback
if(OTMLNodePtr node = moduleNode->get("onUnload")) {
g_lua.loadFunction(node->read<std::string>(), "@" + node->source() + "[" + node->tag() + "]");
g_lua.useValue();
m_unloadCallback = g_lua.polymorphicPop<SimpleCallback>();
}
// load if autoLoad is set
m_autoLoad = moduleNode->readAt<bool>("autoLoad", false);
}
bool Module::load()
{
for(const std::string& depName : m_dependencies) {
ModulePtr dep = g_modules.getModule(depName);
if(!dep) {
logError("ERROR: failed to load module '",m_name,"': could not find module dependency '",depName,"'");
return false;
}
if(!dep->isLoaded()) {
if(!dep->load()) {
logError("ERROR: failed to load module '",m_name,"': a dependency has failed to load");
return false;
}
}
}
if(m_loadCallback) {
m_loaded = m_loadCallback();
if(!m_loaded) {
logError("ERROR: failed to load module '",m_name, "': onLoad returned false");
return false;
}
}
logInfo("Loaded module '", m_name, "'");
return true;
}
void Module::unload()
{
if(m_loaded) {
if(m_unloadCallback)
m_unloadCallback();
m_loaded = false;
}
}

View File

@ -0,0 +1,40 @@
#ifndef MODULE_H
#define MODULE_H
#include <otml/otmldeclarations.h>
class Module;
typedef std::shared_ptr<Module> ModulePtr;
class Module
{
public:
Module(const std::string& name) : m_loaded(false), m_autoLoad(false), m_name(name) { }
void discover(const OTMLNodePtr& moduleNode);
bool load();
void unload();
bool isLoaded() const { return m_loaded; }
std::string getDescription() const { return m_description; }
std::string getName() const { return m_name; }
std::string getAuthor() const { return m_author; }
std::string getWebsite() const { return m_website; }
std::string getVersion() const { return m_version; }
bool autoLoad() const { return m_autoLoad; }
private:
bool m_loaded;
bool m_autoLoad;
std::string m_name;
std::string m_description;
std::string m_author;
std::string m_website;
std::string m_version;
BooleanCallback m_loadCallback;
SimpleCallback m_unloadCallback;
std::list<std::string> m_dependencies;
};
#endif

View File

@ -0,0 +1,58 @@
#include "modulemanager.h"
#include "resourcemanager.h"
#include <otml/otml.h>
ModuleManager g_modules;
void ModuleManager::discoverAndLoadModules()
{
auto moduleDirs = g_resources.listDirectoryFiles("/");
for(const std::string& moduleDir : moduleDirs) {
auto moduleFiles = g_resources.listDirectoryFiles("/" + moduleDir);
for(const std::string& file : moduleFiles) {
if(boost::ends_with(file, ".otmod"))
discoverModule("/" + moduleDir + "/" + file);
}
}
// auto load modules
for(const ModulePtr& module : m_modules) {
if(!module->isLoaded() && module->autoLoad())
module->load();
}
}
bool ModuleManager::discoverModule(const std::string& file)
{
ModulePtr module;
try {
OTMLDocumentPtr doc = OTMLDocument::parse(file);
OTMLNodePtr moduleNode = doc->at("Module");
std::string name = moduleNode->readAt<std::string>("name");
if(getModule(name))
throw OTMLException(moduleNode, "a module with the same name is already discovered, did you duplicate module names?");
module = ModulePtr(new Module(name));
module->discover(moduleNode);
m_modules.push_back(module);
} catch(std::exception& e) {
logError("ERROR: failed to load module from '", file, "':\n", e.what());
return false;
}
return true;
}
void ModuleManager::unloadModules()
{
for(const ModulePtr& module : m_modules)
module->unload();
}
ModulePtr ModuleManager::getModule(const std::string& moduleName)
{
for(const ModulePtr& module : m_modules)
if(module->getName() == moduleName)
return module;
return nullptr;
}

View File

@ -0,0 +1,21 @@
#ifndef MODULEMANAGER_H
#define MODULEMANAGER_H
#include "module.h"
class ModuleManager
{
public:
void discoverAndLoadModules();
bool discoverModule(const std::string& file);
void unloadModules();
ModulePtr getModule(const std::string& moduleName);
private:
std::vector<ModulePtr> m_modules;
};
extern ModuleManager g_modules;
#endif

View File

@ -1,29 +0,0 @@
#include "packages.h"
#include <core/resources.h>
#include <script/luainterface.h>
Packages g_packages;
void Packages::loadPackages()
{
std::list<std::string> packages = g_resources.listDirectoryFiles("modules");
foreach(const std::string& package, packages) {
std::string dir = make_string("modules/", package);
g_resources.pushCurrentPath(dir);
std::list<std::string> packagesFiles = g_resources.listDirectoryFiles();
foreach(const std::string& packageFile, packagesFiles) {
if(boost::ends_with(packageFile, ".lua")) {
g_lua.runScript(packageFile);
}
}
g_resources.popCurrentPath();
}
}
void Packages::terminate()
{
}

View File

@ -1,15 +0,0 @@
#ifndef PACKAGES_H
#define PACKAGES_H
#include <global.h>
class Packages
{
public:
void loadPackages();
void terminate();
};
extern Packages g_packages;
#endif // MODULES_H

View File

@ -3,53 +3,63 @@
#include <global.h> #include <global.h>
class PlatformListener;
class Platform class Platform
{ {
public: public:
static void init(const char *appName); void init(PlatformListener* platformListener, const char* appName);
static void terminate(); void terminate();
/// Poll platform input/window events /// Poll platform input/window events
static void poll(); void poll();
/// Get current time in milliseconds since init /// Get current time in milliseconds since init
static int getTicks(); int getTicks();
/// Sleep in current thread /// Sleep in current thread
static void sleep(ulong miliseconds); void sleep(ulong ms);
static bool createWindow(int x, int y, int width, int height, int minWidth, int minHeight, bool maximized); bool createWindow(int x, int y, int width, int height, int minWidth, int minHeight, bool maximized);
static void destroyWindow(); void destroyWindow();
static void showWindow(); void showWindow();
static void setWindowTitle(const char *title); void hideWindow();
static bool isWindowFocused(); void setWindowTitle(const char* title);
static bool isWindowVisible(); bool isWindowFocused();
static int getWindowX(); bool isWindowVisible();
static int getWindowY(); int getWindowX();
static int getWindowWidth(); int getWindowY();
static int getWindowHeight(); int getWindowWidth();
static bool isWindowMaximized(); int getWindowHeight();
bool isWindowMaximized();
static int getDisplayHeight(); int getDisplayHeight();
static int getDisplayWidth(); int getDisplayWidth();
/// Get GL extension function address /// Get GL extension function address
static void *getExtensionProcAddress(const char *ext); void* getExtensionProcAddress(const char* ext);
/// Check if GL extension is supported /// Check if GLX/WGL extension is supported
static bool isExtensionSupported(const char *ext); bool isExtensionSupported(const char* ext);
static const char *getClipboardText(); /// Get text from Ctrl+c
static void setClipboardText(const char *text); const char* getClipboardText();
/// Set text for Ctrl+v
void setClipboardText(const char* text);
static void hideMouseCursor(); void hideMouseCursor();
static void showMouseCursor(); void showMouseCursor();
/// Enable/disable vertical synchronization /// Enable or disable vertical synchronization
static void setVsync(bool enable = true); void setVerticalSync(bool enable);
/// Swap GL buffers /// Swap GL buffers
static void swapBuffers(); void swapBuffers();
/// Get the app user directory, the place to save files configurations files /// Get the app user directory, the place to save files configurations files
static std::string getAppUserDir(); std::string getAppUserDir();
private:
PlatformListener* m_listener;
}; };
#endif // PLATFORM_H extern Platform g_platform;
#endif

Some files were not shown because too many files have changed in this diff Show More