improvements to skins
After Width: | Height: | Size: 592 B |
After Width: | Height: | Size: 827 B |
|
@ -23,13 +23,11 @@ ModuleInfoLabel < Label
|
|||
margin-top: 5
|
||||
margin-bottom: 2
|
||||
|
||||
ModuleValueLabel < UILabel
|
||||
ModuleValueLabel < FlatLabel
|
||||
font: verdana-11px-antialised
|
||||
color: #aaaaaa
|
||||
text-offset: 2 3
|
||||
padding-bottom: 5
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-border: 1
|
||||
height: 20
|
||||
|
||||
MainWindow
|
||||
|
|
|
@ -14,12 +14,20 @@ local function onSkinComboBoxOptionChange(self, optionText, optionData)
|
|||
end
|
||||
end
|
||||
|
||||
local function getSkinPath(name)
|
||||
return g_modules.getModulesPath() .. g_lua.getCurrentSourcePath(0) .. '/skins/' .. string.lower(name) .. '/'
|
||||
end
|
||||
|
||||
-- public functions
|
||||
function Skins.init()
|
||||
installedSkins = {}
|
||||
|
||||
Skins.installSkins('skins')
|
||||
|
||||
if installedSkins[defaultSkinName] then
|
||||
g_resources.addToSearchPath(getSkinPath(defaultSkinName), 0)
|
||||
end
|
||||
|
||||
local userSkinName = Settings.get('skin')
|
||||
if userSkinName and Skins.setSkin(userSkinName) then
|
||||
info('Using configured skin: ' .. userSkinName)
|
||||
|
@ -40,6 +48,11 @@ function Skins.init()
|
|||
end
|
||||
|
||||
function Skins.terminate()
|
||||
g_resources.removeFromSearchPath(getSkinPath(defaultSkinName))
|
||||
if currentSkin then
|
||||
g_resources.removeFromSearchPath(getSkinPath(currentSkin.name))
|
||||
end
|
||||
|
||||
installedSkins = nil
|
||||
currentSkin = nil
|
||||
skinComboBox = nil
|
||||
|
@ -51,8 +64,11 @@ function Skins.installSkin(skin)
|
|||
return false
|
||||
end
|
||||
|
||||
if installedSkins[skin.name] then
|
||||
warning(skin.name .. ' has been replaced.')
|
||||
end
|
||||
|
||||
installedSkins[skin.name] = skin
|
||||
-- todo: maybe combine styles if skin already exists
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -67,11 +83,41 @@ function Skins.setSkin(name)
|
|||
return false
|
||||
end
|
||||
|
||||
--g_ui.clearStyles() -- this is crashing
|
||||
for i=1,#skin.styles do
|
||||
g_ui.importStyle('skins/' .. string.lower(name) .. '/' .. skin.styles[i])
|
||||
g_fonts.clearFonts()
|
||||
g_ui.clearStyles()
|
||||
|
||||
if name ~= defaultSkinName then
|
||||
local defaultSkin = installedSkins[defaultSkinName]
|
||||
if not defaultSkin then
|
||||
error("Default skin is not installed.")
|
||||
return false
|
||||
end
|
||||
|
||||
Skins.loadSkin(defaultSkin)
|
||||
end
|
||||
|
||||
if currentSkin then
|
||||
g_resources.removeFromSearchPath(getSkinPath(currentSkin.name))
|
||||
end
|
||||
g_resources.addToSearchPath(getSkinPath(skin.name), true)
|
||||
|
||||
Skins.loadSkin(skin)
|
||||
currentSkin = skin
|
||||
return true
|
||||
end
|
||||
|
||||
function Skins.loadSkin(skin)
|
||||
local lowerName = string.lower(skin.name)
|
||||
|
||||
for i=1,#skin.fonts do
|
||||
g_fonts.importFont('skins/' .. lowerName .. '/fonts/' .. skin.fonts[i])
|
||||
|
||||
if i == 1 then
|
||||
g_fonts.setDefaultFont(skin.fonts[i])
|
||||
end
|
||||
end
|
||||
|
||||
for i=1,#skin.styles do
|
||||
g_ui.importStyle('skins/' .. lowerName .. '/styles/' .. skin.styles[i])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,32 @@
|
|||
local skin = {
|
||||
name = 'Default',
|
||||
name = 'Default',
|
||||
|
||||
styles = {}
|
||||
-- first font is default
|
||||
fonts = {
|
||||
'verdana-11px-antialised',
|
||||
'verdana-11px-monochrome',
|
||||
'verdana-11px-rounded',
|
||||
'terminus-14px-bold'
|
||||
},
|
||||
|
||||
styles = {
|
||||
'buttons.otui',
|
||||
'labels.otui',
|
||||
'panels.otui',
|
||||
'separators.otui',
|
||||
'textedits.otui',
|
||||
'checkboxes.otui',
|
||||
'progressbars.otui',
|
||||
'tabbars.otui',
|
||||
'windows.otui',
|
||||
'listboxes.otui',
|
||||
'popupmenus.otui',
|
||||
'comboboxes.otui',
|
||||
'spinboxes.otui',
|
||||
'messageboxes.otui',
|
||||
'scrollbars.otui',
|
||||
'splitters.otui'
|
||||
}
|
||||
}
|
||||
|
||||
Skins.installSkin(skin)
|
||||
|
|
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 266 B After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 409 B After Width: | Height: | Size: 409 B |
Before Width: | Height: | Size: 833 B After Width: | Height: | Size: 833 B |
Before Width: | Height: | Size: 859 B After Width: | Height: | Size: 859 B |
Before Width: | Height: | Size: 548 B After Width: | Height: | Size: 548 B |
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 457 B After Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 139 B |
Before Width: | Height: | Size: 152 B After Width: | Height: | Size: 152 B |
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 241 B |
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 400 B |
Before Width: | Height: | Size: 638 B After Width: | Height: | Size: 638 B |
Before Width: | Height: | Size: 415 B After Width: | Height: | Size: 415 B |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
@ -3,7 +3,7 @@ Button < UIButton
|
|||
color: #f0ad4dff
|
||||
size: 106 22
|
||||
text-offset: 0 0
|
||||
image-source: /core_styles/styles/images/button.png
|
||||
image-source: /images/button.png
|
||||
image-color: white
|
||||
image-clip: 0 0 20 20
|
||||
image-border: 2
|
||||
|
@ -21,7 +21,7 @@ Button < UIButton
|
|||
|
||||
TabButton < UIButton
|
||||
size: 20 20
|
||||
image-source: /core_styles/styles/images/tabbutton.png
|
||||
image-source: /images/tabbutton.png
|
||||
image-color: white
|
||||
image-clip: 0 0 20 20
|
||||
image-border: 2
|
|
@ -1,12 +1,13 @@
|
|||
CheckBox < UICheckBox
|
||||
size: 16 16
|
||||
text-align: left
|
||||
text: aa
|
||||
text-offset: 16 0
|
||||
color: #aaaaaa
|
||||
image-color: #ffffffff
|
||||
image-rect: 0 0 12 12
|
||||
image-offset: 0 2
|
||||
image-source: /core_styles/styles/images/checkbox.png
|
||||
image-source: /images/checkbox.png
|
||||
|
||||
$hover !disabled:
|
||||
color: #cccccc
|
||||
|
@ -30,7 +31,7 @@ CheckBox < UICheckBox
|
|||
ColorBox < UICheckBox
|
||||
size: 16 16
|
||||
image-color: #ffffffff
|
||||
image-source: /core_styles/styles/images/colorbox.png
|
||||
image-source: /images/colorbox.png
|
||||
|
||||
$checked:
|
||||
image-clip: 16 0 16 16
|
||||
|
@ -44,7 +45,7 @@ ButtonBox < UICheckBox
|
|||
size: 106 22
|
||||
text-offset: 0 0
|
||||
text-align: center
|
||||
image-source: /core_styles/styles/images/tabbutton.png
|
||||
image-source: /images/tabbutton.png
|
||||
image-color: white
|
||||
image-clip: 0 0 20 20
|
||||
image-border: 2
|
|
@ -14,14 +14,14 @@ ComboBoxPopupMenuButton < UIButton
|
|||
color: #555555
|
||||
|
||||
ComboBoxPopupMenuSeparator < UIWidget
|
||||
image-source: /core_styles/styles/images/combobox.png
|
||||
image-source: /images/combobox.png
|
||||
image-repeated: true
|
||||
image-clip: 1 59 89 1
|
||||
height: 1
|
||||
phantom: true
|
||||
|
||||
ComboBoxPopupMenu < UIPopupMenu
|
||||
image-source: /core_styles/styles/images/combobox.png
|
||||
image-source: /images/combobox.png
|
||||
image-clip: 0 60 89 20
|
||||
image-border: 1
|
||||
image-border-top: 0
|
||||
|
@ -33,7 +33,7 @@ ComboBox < UIComboBox
|
|||
size: 86 20
|
||||
text-offset: 3 0
|
||||
text-align: left
|
||||
image-source: /core_styles/styles/images/combobox.png
|
||||
image-source: /images/combobox.png
|
||||
image-border: 1
|
||||
image-border-right: 17
|
||||
image-clip: 0 0 89 20
|
|
@ -11,7 +11,7 @@ FlatLabel < UILabel
|
|||
size: 86 20
|
||||
text-offset: 3 3
|
||||
text-margin: 3
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-source: /images/panel_flat.png
|
||||
image-border: 1
|
||||
|
||||
$disabled:
|
|
@ -5,9 +5,9 @@ ScrollablePanel < UIScrollArea
|
|||
phantom: true
|
||||
|
||||
FlatPanel < Panel
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-source: /images/panel_flat.png
|
||||
image-border: 1
|
||||
|
||||
ScrollableFlatPanel < ScrollablePanel
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-source: /images/panel_flat.png
|
||||
image-border: 1
|
|
@ -17,7 +17,7 @@ PopupMenuButton < UIButton
|
|||
PopupMenuSeparator < UIWidget
|
||||
margin-left: 2
|
||||
margin-right: 2
|
||||
image-source: /core_styles/styles/images/menubox.png
|
||||
image-source: images/menubox.png
|
||||
image-border-left: 1
|
||||
image-border-right: 1
|
||||
image-clip: 0 0 32 2
|
||||
|
@ -26,7 +26,7 @@ PopupMenuSeparator < UIWidget
|
|||
|
||||
PopupMenu < UIPopupMenu
|
||||
width: 50
|
||||
image-source: /core_styles/styles/images/menubox.png
|
||||
image-source: images/menubox.png
|
||||
image-border: 3
|
||||
padding-top: 3
|
||||
padding-bottom: 3
|
|
@ -2,7 +2,7 @@ ProgressBar < UIProgressBar
|
|||
height: 16
|
||||
background-color: red
|
||||
border: 1 black
|
||||
image-source: /core_styles/styles/images/progressbar.png
|
||||
image-source: /images/progressbar.png
|
||||
image-border: 1
|
||||
|
||||
ProgressRect < UIProgressRect
|
|
@ -2,7 +2,7 @@ ScrollBarSlider < UIButton
|
|||
id: sliderButton
|
||||
anchors.centerIn: parent
|
||||
size: 13 13
|
||||
image-source: images/scrollbar.png
|
||||
image-source: /images/scrollbar.png
|
||||
image-clip: 0 26 13 13
|
||||
image-border: 2
|
||||
image-color: #ffffffff
|
||||
|
@ -17,7 +17,7 @@ VerticalScrollBar < UIScrollBar
|
|||
orientation: vertical
|
||||
width: 13
|
||||
height: 39
|
||||
image-source: images/scrollbar.png
|
||||
image-source: /images/scrollbar.png
|
||||
image-clip: 39 0 13 65
|
||||
image-border: 1
|
||||
pixels-scroll: true
|
||||
|
@ -26,7 +26,7 @@ VerticalScrollBar < UIScrollBar
|
|||
id: decrementButton
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
image-source: images/scrollbar.png
|
||||
image-source: /images/scrollbar.png
|
||||
image-clip: 0 0 13 13
|
||||
image-color: #ffffffff
|
||||
size: 13 13
|
||||
|
@ -42,7 +42,7 @@ VerticalScrollBar < UIScrollBar
|
|||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
size: 13 13
|
||||
image-source: images/scrollbar.png
|
||||
image-source: /images/scrollbar.png
|
||||
image-clip: 0 13 13 13
|
||||
image-color: #ffffffff
|
||||
$hover:
|
||||
|
@ -58,7 +58,7 @@ HorizontalScrollBar < UIScrollBar
|
|||
orientation: horizontal
|
||||
height: 13
|
||||
width: 39
|
||||
image-source: images/scrollbar.png
|
||||
image-source: /images/scrollbar.png
|
||||
image-clip: 0 65 52 13
|
||||
image-border: 1
|
||||
|
||||
|
@ -66,7 +66,7 @@ HorizontalScrollBar < UIScrollBar
|
|||
id: decrementButton
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
image-source: images/scrollbar.png
|
||||
image-source: /images/scrollbar.png
|
||||
image-clip: 0 39 13 13
|
||||
image-color: #ffffffff
|
||||
size: 13 13
|
||||
|
@ -82,7 +82,7 @@ HorizontalScrollBar < UIScrollBar
|
|||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
size: 13 13
|
||||
image-source: images/scrollbar.png
|
||||
image-source: /images/scrollbar.png
|
||||
image-clip: 0 52 13 13
|
||||
image-color: #ffffffff
|
||||
$hover:
|
|
@ -1,12 +1,12 @@
|
|||
HorizontalSeparator < UIWidget
|
||||
image-source: /core_styles/styles/images/horizontal_separator.png
|
||||
image-source: /images/horizontal_separator.png
|
||||
image-border-top: 2
|
||||
height: 2
|
||||
phantom: true
|
||||
focusable: false
|
||||
|
||||
VerticalSeparator < UIWidget
|
||||
image-source: /core_styles/styles/images/horizontal_separator.png
|
||||
image-source: /images/horizontal_separator.png
|
||||
image-border-left: 2
|
||||
width: 2
|
||||
phantom: true
|
|
@ -4,7 +4,7 @@ SpinBox < UISpinBox
|
|||
size: 86 20
|
||||
text-offset: 0 3
|
||||
text-margin: 3
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-source: images/panel_flat.png
|
||||
image-border: 1
|
||||
|
||||
$disabled:
|
|
@ -3,7 +3,7 @@ TabBar < UITabBar
|
|||
TabBarPanel < Panel
|
||||
TabBarButton < UIButton
|
||||
size: 20 20
|
||||
image-source: /core_styles/styles/images/tabbutton.png
|
||||
image-source: /images/tabbutton.png
|
||||
image-color: white
|
||||
image-clip: 0 0 20 20
|
||||
image-border: 2
|
|
@ -4,7 +4,7 @@ TextEdit < UITextEdit
|
|||
size: 86 20
|
||||
text-offset: 0 3
|
||||
text-margin: 3
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-source: /images/panel_flat.png
|
||||
image-border: 1
|
||||
|
||||
$disabled:
|
|
@ -5,7 +5,7 @@ Window < UIWindow
|
|||
color: white
|
||||
text-offset: 0 4
|
||||
text-align: top
|
||||
image-source: /core_styles/styles/images/window.png
|
||||
image-source: /images/window.png
|
||||
image-border: 5
|
||||
image-border-top: 22
|
||||
opacity: 1
|
|
@ -1,6 +1,8 @@
|
|||
local skin = {
|
||||
name = 'Example',
|
||||
|
||||
fonts = {},
|
||||
|
||||
styles = {
|
||||
'topmenu.otui'
|
||||
}
|
||||
|
|
|
@ -3,17 +3,17 @@ Mouse = {}
|
|||
local cursorChanged = false
|
||||
|
||||
function Mouse.setTargetCursor()
|
||||
g_window.setMouseCursor('/core_styles/cursors/targetcursor.png', {x=9,y=9})
|
||||
g_window.setMouseCursor('/cursors/targetcursor.png', {x=9,y=9})
|
||||
cursorChanged = true
|
||||
end
|
||||
|
||||
function Mouse.setHorizontalCursor()
|
||||
g_window.setMouseCursor('/core_styles/cursors/horizontal.png', {x=9,y=4})
|
||||
g_window.setMouseCursor('/cursors/horizontal.png', {x=9,y=4})
|
||||
cursorChanged = true
|
||||
end
|
||||
|
||||
function Mouse.setVerticalCursor()
|
||||
g_window.setMouseCursor('/core_styles/cursors/vertical.png', {x=4,y=9})
|
||||
g_window.setMouseCursor('/cursors/vertical.png', {x=4,y=9})
|
||||
cursorChanged = true
|
||||
end
|
||||
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
Module
|
||||
name: core_styles
|
||||
description: Contains ui styles used by other modules
|
||||
author: OTClient team
|
||||
website: www.otclient.info
|
||||
autoload: true
|
||||
autoload-priority: 20
|
||||
reloadable: false
|
||||
|
||||
@onLoad: |
|
||||
importFont 'fonts/verdana-11px-antialised'
|
||||
importFont 'fonts/verdana-11px-monochrome'
|
||||
importFont 'fonts/verdana-11px-rounded'
|
||||
importFont 'fonts/terminus-14px-bold'
|
||||
setDefaultFont 'verdana-11px-antialised'
|
||||
|
||||
importStyle 'styles/buttons.otui'
|
||||
importStyle 'styles/labels.otui'
|
||||
importStyle 'styles/panels.otui'
|
||||
importStyle 'styles/separators.otui'
|
||||
importStyle 'styles/textedits.otui'
|
||||
importStyle 'styles/checkboxes.otui'
|
||||
importStyle 'styles/progressbars.otui'
|
||||
importStyle 'styles/tabbars.otui'
|
||||
importStyle 'styles/windows.otui'
|
||||
importStyle 'styles/listboxes.otui'
|
||||
importStyle 'styles/popupmenus.otui'
|
||||
importStyle 'styles/comboboxes.otui'
|
||||
importStyle 'styles/spinboxes.otui'
|
||||
importStyle 'styles/messageboxes.otui'
|
||||
importStyle 'styles/scrollbars.otui'
|
||||
importStyle 'styles/splitters.otui'
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -1,5 +1,5 @@
|
|||
Creature < UICreature
|
||||
size: 80 80
|
||||
padding: 1
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-source: /images/panel_flat.png
|
||||
image-border: 1
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Item < UIItem
|
||||
size: 34 34
|
||||
padding: 1
|
||||
image-source: /core_styles/styles/images/item.png
|
||||
image-source: /game/images/item.png
|
||||
font: verdana-11px-rounded
|
||||
border-color: white
|
||||
|
|
|
@ -37,9 +37,9 @@ local SpeakTypes = {
|
|||
}
|
||||
|
||||
local SayModes = {
|
||||
[1] = { speakTypeDesc = 'whisper', icon = '/core_styles/icons/whisper.png' },
|
||||
[2] = { speakTypeDesc = 'say', icon = '/core_styles/icons/say.png' },
|
||||
[3] = { speakTypeDesc = 'yell', icon = '/core_styles/icons/yell.png' }
|
||||
[1] = { speakTypeDesc = 'whisper', icon = 'icons/whisper.png' },
|
||||
[2] = { speakTypeDesc = 'say', icon = 'icons/say.png' },
|
||||
[3] = { speakTypeDesc = 'yell', icon = 'icons/yell.png' }
|
||||
}
|
||||
|
||||
local MAX_HISTORY = 1000
|
||||
|
|
|
@ -40,7 +40,7 @@ Panel
|
|||
|
||||
TabButton
|
||||
id: prevChannelButton
|
||||
icon: /core_styles/icons/leftarrow.png
|
||||
icon: icons/leftarrow.png
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
margin-left: 6
|
||||
|
@ -56,7 +56,7 @@ Panel
|
|||
|
||||
TabButton
|
||||
id: nextChannelButton
|
||||
icon: /core_styles/icons/rightarrow.png
|
||||
icon: icons/rightarrow.png
|
||||
anchors.right: next.left
|
||||
anchors.top: parent.top
|
||||
margin-right: 5
|
||||
|
@ -65,7 +65,7 @@ Panel
|
|||
TabButton
|
||||
id: closeChannelButton
|
||||
!tooltip: tr('Close this channel') .. ' (Ctrl+E)'
|
||||
icon: /core_styles/icons/closechannel.png
|
||||
icon: icons/closechannel.png
|
||||
anchors.right: next.left
|
||||
anchors.top: parent.top
|
||||
enabled: false
|
||||
|
@ -76,7 +76,7 @@ Panel
|
|||
TabButton
|
||||
id: channelsButton
|
||||
!tooltip: tr('Open new channel') .. ' (Ctrl+O)'
|
||||
icon: /core_styles/icons/channels.png
|
||||
icon: icons/channels.png
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
margin-right: 5
|
||||
|
@ -98,7 +98,7 @@ Panel
|
|||
|
||||
TabButton
|
||||
id: sayModeButton
|
||||
icon: /core_styles/icons/say.png
|
||||
icon: icons/say.png
|
||||
!tooltip: tr('Adjust volume')
|
||||
&sayMode: 2
|
||||
size: 20 20
|
||||
|
|
Before Width: | Height: | Size: 245 B After Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 300 B After Width: | Height: | Size: 300 B |
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
Before Width: | Height: | Size: 285 B After Width: | Height: | Size: 285 B |
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 266 B After Width: | Height: | Size: 266 B |
|
@ -57,14 +57,12 @@ MainWindow
|
|||
margin-left: 5
|
||||
margin-top: 5
|
||||
|
||||
Panel
|
||||
FlatPanel
|
||||
height: 250
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: prev.bottom
|
||||
margin-top: 10
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-border: 1
|
||||
|
||||
VerticalScrollBar
|
||||
id: itemsPanelListScrollBar
|
||||
|
|
|
@ -77,6 +77,7 @@ void ModuleManager::discoverModulesPath()
|
|||
// try to add module directory
|
||||
if(g_resources.addToSearchPath(dir, false)) {
|
||||
//g_logger.info(stdext::format("Using modules directory '%s'", dir.c_str()));
|
||||
m_modulesPath = dir;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
void ensureModuleLoaded(const std::string& moduleName);
|
||||
void unloadModules();
|
||||
void reloadModules();
|
||||
std::string getModulesPath() { return m_modulesPath; }
|
||||
|
||||
ModulePtr getModule(const std::string& moduleName);
|
||||
std::deque<ModulePtr> getModules() { return m_modules; }
|
||||
|
@ -47,6 +48,7 @@ protected:
|
|||
friend class Module;
|
||||
|
||||
private:
|
||||
std::string m_modulesPath;
|
||||
std::deque<ModulePtr> m_modules;
|
||||
std::multimap<int, ModulePtr> m_autoLoadModules;
|
||||
};
|
||||
|
|
|
@ -66,6 +66,13 @@ bool ResourceManager::addToSearchPath(const std::string& path, bool insertInFron
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ResourceManager::removeFromSearchPath(const std::string& path)
|
||||
{
|
||||
if(!PHYSFS_removeFromSearchPath(path.c_str()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ResourceManager::searchAndAddPackages(const std::string& packagesDir, const std::string& packageExt, bool append)
|
||||
{
|
||||
auto files = listDirectoryFiles(resolvePath(packagesDir));
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
bool setupWriteDir(const std::string& appWriteDirName);
|
||||
|
||||
bool addToSearchPath(const std::string& path, bool insertInFront = true);
|
||||
bool removeFromSearchPath(const std::string& path);
|
||||
void searchAndAddPackages(const std::string& packagesDir, const std::string& packagesExt, bool append);
|
||||
|
||||
bool fileExists(const std::string& fileName);
|
||||
|
|
|
@ -38,6 +38,12 @@ void FontManager::terminate()
|
|||
m_defaultFont = nullptr;
|
||||
}
|
||||
|
||||
void FontManager::clearFonts()
|
||||
{
|
||||
m_fonts.clear();
|
||||
m_defaultFont = BitmapFontPtr(new BitmapFont("emptyfont"));
|
||||
}
|
||||
|
||||
bool FontManager::importFont(std::string fontFile)
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -31,6 +31,7 @@ public:
|
|||
FontManager();
|
||||
|
||||
void terminate();
|
||||
void clearFonts();
|
||||
|
||||
bool importFont(std::string fontFile);
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ void PainterOGL2::drawCoords(CoordsBuffer& coordsBuffer, DrawMode drawMode)
|
|||
|
||||
void PainterOGL2::drawTextureCoords(CoordsBuffer& coordsBuffer, const TexturePtr& texture)
|
||||
{
|
||||
if(texture->isEmpty())
|
||||
if(texture && texture->isEmpty())
|
||||
return;
|
||||
|
||||
setDrawProgram(m_shaderProgram ? m_shaderProgram : m_drawTexturedProgram.get());
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <framework/core/module.h>
|
||||
#include <framework/sound/soundmanager.h>
|
||||
#include <framework/util/crypt.h>
|
||||
#include <framework/core/resourcemanager.h>
|
||||
|
||||
void Application::registerLuaFunctions()
|
||||
{
|
||||
|
@ -601,9 +602,11 @@ void Application::registerLuaFunctions()
|
|||
g_lua.bindSingletonFunction("g_modules", "reloadModules", &ModuleManager::reloadModules, &g_modules);
|
||||
g_lua.bindSingletonFunction("g_modules", "getModule", &ModuleManager::getModule, &g_modules);
|
||||
g_lua.bindSingletonFunction("g_modules", "getModules", &ModuleManager::getModules, &g_modules);
|
||||
g_lua.bindSingletonFunction("g_modules", "getModulesPath", &ModuleManager::getModulesPath, &g_modules);
|
||||
|
||||
// FontManager
|
||||
g_lua.registerSingletonClass("g_fonts");
|
||||
g_lua.bindSingletonFunction("g_fonts", "clearFonts", &FontManager::clearFonts, &g_fonts);
|
||||
g_lua.bindSingletonFunction("g_fonts", "importFont", &FontManager::importFont, &g_fonts);
|
||||
g_lua.bindSingletonFunction("g_fonts", "fontExists", &FontManager::fontExists, &g_fonts);
|
||||
g_lua.bindSingletonFunction("g_fonts", "setDefaultFont", &FontManager::setDefaultFont, &g_fonts);
|
||||
|
@ -626,4 +629,15 @@ void Application::registerLuaFunctions()
|
|||
g_lua.bindSingletonFunction("g_eventDispatcher", "addEvent", &EventDispatcher::addEvent, &g_eventDispatcher);
|
||||
g_lua.bindSingletonFunction("g_eventDispatcher", "scheduleEvent", &EventDispatcher::scheduleEvent, &g_eventDispatcher);
|
||||
g_lua.bindSingletonFunction("g_eventDispatcher", "cycleEvent", &EventDispatcher::cycleEvent, &g_eventDispatcher);
|
||||
|
||||
// ResourceManager
|
||||
g_lua.registerSingletonClass("g_resources");
|
||||
g_lua.bindSingletonFunction("g_resources", "addToSearchPath", &ResourceManager::addToSearchPath, &g_resources);
|
||||
g_lua.bindSingletonFunction("g_resources", "removeFromSearchPath", &ResourceManager::removeFromSearchPath, &g_resources);
|
||||
g_lua.bindSingletonFunction("g_resources", "fileExists", &ResourceManager::fileExists, &g_resources);
|
||||
|
||||
// LuaInterface
|
||||
g_lua.registerSingletonClass("g_lua");
|
||||
g_lua.bindSingletonFunction("g_lua", "getCurrentSourcePath", &LuaInterface::getCurrentSourcePath, &g_lua);
|
||||
|
||||
}
|
||||
|
|
|
@ -112,8 +112,6 @@ public:
|
|||
void draw(const Point& dest, float scaleFactor, int layer, int xPattern, int yPattern, int zPattern, int animationPhase);
|
||||
void drawMask(const Point& dest, float scaleFactor, int w, int h, int xPattern, int yPattern, int zPattern, int layer, int animationPhase, SpriteMask mask);
|
||||
|
||||
TexturePtr& getSprite(int w, int h, int l, int x, int y, int z, int a);
|
||||
TexturePtr& getSpriteMask(int w, int h, int l, int x, int y, int z, int a, SpriteMask mask);
|
||||
TexturePtr& getTexture(int animationPhase);
|
||||
|
||||
bool getProperty(Property property) { return m_properties[property]; }
|
||||
|
|