graphics fixes and improvements

This commit is contained in:
Eduardo Bart
2012-06-08 13:58:08 -03:00
parent 4f9ca15ef0
commit 1a7f2a44fc
39 changed files with 450 additions and 317 deletions

View File

@@ -43,7 +43,6 @@ locale = {
["Auto login"] = "Entrar automaticamente",
["Auto login selected character on next charlist load"] = "Entrar automaticamente com o personagem quando reabrir a lista de personagens",
["Axe Fighting"] = "Combate com Machado",
["Background pane framerate limit: %s"] = "Limite da taxa de quadros no segundo plano: %s",
["Banishment"] = "Banimento",
["Banishment + Final Warning"] = "Banimento + Aviso final",
["Battle"] = "Batalha",
@@ -88,9 +87,8 @@ locale = {
["Fishing"] = "Pesca",
["Fist Fighting"] = "Porrada",
["Follow"] = "Seguir",
["Foreground pane framerate limit: %s"] = "Limite da taxa de quadros no primeiro plano: %s",
["Frame rate limit"] = "Limite de FPS",
["Fullscreen"] = "Tela cheia",
["Game framerate limit: %s"] = "Limite da taxa de quadros do jogo: %s",
["General"] = "Geral",
["Graphics"] = "Gr<EFBFBD>ficos",
["Graphics Engine:"] = "Motor Gr<47>fico:",
@@ -106,6 +104,7 @@ locale = {
["Hotkeys"] = "Atalhos",
["Ignore capacity"] = "Ignorar capacidade",
["Ignore equipped"] = "Ignorar equipado",
["Interface framerate limit: %s"] = "Limite da taxa de quadros da interface: %s",
["Inventory"] = "Invent<EFBFBD>rio",
["Invite to Party"] = "Convidar para o grupo",
["Invite to private chat"] = "Convidar para o canal privado",

View File

@@ -35,7 +35,7 @@ Panel
Label
id: backgroundFrameRateLimitLabel
!text: tr('Background pane framerate limit: %s', 'max')
!text: tr('Game framerate limit: %s', 'max')
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
@@ -59,12 +59,12 @@ Panel
value = 0
end
self:getParent():getChildById('backgroundFrameRateLimitLabel'):setText(tr('Background pane framerate limit: %s', text))
self:getParent():getChildById('backgroundFrameRateLimitLabel'):setText(tr('Game framerate limit: %s', text))
g_app.setBackgroundPaneMaxFps(value)
Label
id: foregroundFrameRateLimitLabel
!text: tr('Foreground pane framerate limit: %s', '8')
!text: tr('Interface framerate limit: %s', '24')
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
@@ -78,7 +78,7 @@ Panel
margin-top: 3
minimum: 1
maximum: 61
value: 8
value: 61
step: 1
@onValueChange: |
local value = self:getValue()
@@ -88,6 +88,6 @@ Panel
value = 0
end
self:getParent():getChildById('foregroundFrameRateLimitLabel'):setText(tr('Foreground pane framerate limit: %s', text))
self:getParent():getChildById('foregroundFrameRateLimitLabel'):setText(tr('Interface framerate limit: %s', text))
g_app.setForegroundPaneMaxFps(value)

View File

@@ -39,6 +39,14 @@ local function setupGraphicsEngines()
g_graphics.selectPainterEngine(2)
end
end
local foregroundFrameRateScrollBar = graphicsPanel:getChildById('foregroundFrameRateScrollBar')
local foregroundFrameRateLimitLabel = graphicsPanel:getChildById('foregroundFrameRateLimitLabel')
if not g_graphics.canCacheBackbuffer() then
foregroundFrameRateScrollBar:setValue(61)
foregroundFrameRateScrollBar:disable()
foregroundFrameRateLimitLabel:disable()
end
end
function Options.init()
@@ -50,12 +58,12 @@ function Options.init()
end
end
Keyboard.bindKeyDown('Ctrl+P', Options.toggle)
Keyboard.bindKeyDown('Ctrl+D', Options.toggle)
Keyboard.bindKeyDown('Ctrl+F', function() Options.toggleOption('fullscreen') end)
optionsWindow = displayUI('options.otui')
optionsWindow:hide()
optionsButton = TopMenu.addLeftButton('optionsButton', tr('Options') .. ' (Ctrl+P)', 'options.png', Options.toggle)
optionsButton = TopMenu.addLeftButton('optionsButton', tr('Options') .. ' (Ctrl+D)', 'options.png', Options.toggle)
optionsTabBar = optionsWindow:getChildById('optionsTabBar')
optionsTabBar:setContentWidget(optionsWindow:getChildById('optionsTabContent'))
@@ -69,7 +77,7 @@ function Options.init()
end
function Options.terminate()
Keyboard.unbindKeyDown('Ctrl+P')
Keyboard.unbindKeyDown('Ctrl+D')
Keyboard.unbindKeyDown('Ctrl+F')
optionsWindow:destroy()
optionsWindow = nil

View File

@@ -83,6 +83,8 @@ TopPanel
cycleEvent(function()
local frameCounter = rootWidget:recursiveGetChildById('frameCounter')
if frameCounter then
frameCounter:setText('FPS: ' .. g_app.getBackgroundPaneFps())
local text = 'FPS: ' .. g_app.getBackgroundPaneFps()
frameCounter:setText(text)
--print(text)
end
end, 250)

View File

@@ -63,10 +63,11 @@ local function updateSlider(self)
slider:setMarginLeft(offset)
end
if self.maximum == self.minimum then
self:disable()
else
self:enable()
local status = (self.maximum ~= self.minimum)
self:setOn(status)
for _i,child in pairs(self:getChildren()) do
child:setEnabled(status)
end
end
@@ -100,12 +101,10 @@ end
function UIScrollBar:onSetup()
self.setupDone = true
signalcall(self.onValueChange, self, self.value)
addEvent(function()
Mouse.bindAutoPress(self:getChildById('decrementButton'), function() self:decrement() end)
Mouse.bindAutoPress(self:getChildById('incrementButton'), function() self:increment() end)
Mouse.bindPressMove(self:getChildById('sliderButton'), function(mousePos, mouseMoved) parseSliderPos(self, mousePos) end)
updateSlider(self)
end)
Mouse.bindAutoPress(self:getChildById('decrementButton'), function() self:decrement() end)
Mouse.bindAutoPress(self:getChildById('incrementButton'), function() self:increment() end)
Mouse.bindPressMove(self:getChildById('sliderButton'), function(mousePos, mouseMoved) parseSliderPos(self, mousePos) end)
updateSlider(self)
end
function UIScrollBar:onStyleApply(styleName, styleNode)

View File

@@ -41,6 +41,7 @@ end
function UIItem:onHoverChange(hovered)
UIWidget.onHoverChange(self, hovered)
if self:isVirtual() then return end
local draggingWidget = g_ui.getDraggingWidget()

View File

@@ -6,10 +6,8 @@ function UIMiniWindow.create()
end
function UIMiniWindow:onSetup()
addEvent(function()
self:getChildById('closeButton').onClick = function() signalcall(self.onClose, self) end
self:getChildById('minimizeButton').onClick = function() signalcall(self.onMinimize, self) end
end)
self:getChildById('closeButton').onClick = function() signalcall(self.onClose, self) end
self:getChildById('minimizeButton').onClick = function() signalcall(self.onMinimize, self) end
end
function UIMiniWindow:onDragEnter(mousePos)

View File

@@ -44,6 +44,7 @@ local SayModes = {
local MAX_HISTORY = 1000
local MAX_LINES = 100
local HELP_CHANNEL = 9
local consolePanel
local consoleContentPanel
@@ -221,6 +222,7 @@ function Console.init()
-- tibia like hotkeys
Keyboard.bindKeyDown('Ctrl+O', g_game.requestChannels)
Keyboard.bindKeyDown('Ctrl+E', Console.removeCurrentTab)
Keyboard.bindKeyDown('Ctrl+H', Console.openHelp)
end
function Console.terminate()
@@ -242,6 +244,7 @@ function Console.terminate()
Keyboard.unbindKeyDown('Ctrl+O')
Keyboard.unbindKeyDown('Ctrl+E')
Keyboard.unbindKeyDown('Ctrl+H')
if channelsWindow then
channelsWindow:destroy()
@@ -287,6 +290,10 @@ function Console.setTextEditText(text)
consoleTextEdit:setText(text)
end
function Console.openHelp()
g_game.joinChannel(HELP_CHANNEL)
end
function Console.addTab(name, focus)
local tab = consoleTabBar:addTab(name)
if focus then

View File

@@ -12,14 +12,17 @@ function VipList.init()
onVipStateChange = VipList.onVipStateChange })
Keyboard.bindKeyDown('Ctrl+P', VipList.toggle)
vipWindow = displayUI('viplist.otui', GameInterface.getLeftPanel())
vipButton = TopMenu.addGameToggleButton('vipListButton', tr('VIP list'), 'viplist.png', VipList.toggle)
vipButton = TopMenu.addGameToggleButton('vipListButton', tr('VIP list') .. ' (Ctrl+P)', 'viplist.png', VipList.toggle)
vipButton:setOn(true)
VipList.refresh()
end
function VipList.terminate()
Keyboard.unbindKeyDown('Ctrl+P')
disconnect(g_game, { onGameEnd = VipList.clear,
onAddVip = VipList.onAddVip,
onVipStateChange = VipList.onVipStateChange })