Option: Don't Stretch/Shrink Game Window
Sets gameMapPanel to size 480 x 352 Prevents resizing.
This commit is contained in:
parent
95e46dbbaf
commit
478e796dbd
|
@ -42,13 +42,17 @@ Panel
|
||||||
id: fullscreen
|
id: fullscreen
|
||||||
!text: tr('Fullscreen')
|
!text: tr('Fullscreen')
|
||||||
|
|
||||||
|
OptionCheckBox
|
||||||
|
id: dontStretchShrink
|
||||||
|
!text: tr('Don\'t stretch/shrink Game Window')
|
||||||
|
|
||||||
Label
|
Label
|
||||||
id: backgroundFrameRateLabel
|
id: backgroundFrameRateLabel
|
||||||
!text: tr('Game framerate limit: %s', 'max')
|
!text: tr('Game framerate limit: %s', 'max')
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.bottom
|
||||||
margin-top: 6
|
margin-top: 16
|
||||||
@onSetup: |
|
@onSetup: |
|
||||||
local value = Options.getOption('backgroundFrameRate')
|
local value = Options.getOption('backgroundFrameRate')
|
||||||
local text = value
|
local text = value
|
||||||
|
|
|
@ -5,6 +5,7 @@ local defaultOptions = {
|
||||||
showFps = true,
|
showFps = true,
|
||||||
showPing = true,
|
showPing = true,
|
||||||
fullscreen = false,
|
fullscreen = false,
|
||||||
|
dontStretchShrink = false,
|
||||||
classicControl = false,
|
classicControl = false,
|
||||||
walkBooster = false,
|
walkBooster = false,
|
||||||
smartWalk = false,
|
smartWalk = false,
|
||||||
|
@ -144,6 +145,10 @@ function Options.setOption(key, value)
|
||||||
end)
|
end)
|
||||||
elseif key == 'fullscreen' then
|
elseif key == 'fullscreen' then
|
||||||
g_window.setFullscreen(value)
|
g_window.setFullscreen(value)
|
||||||
|
elseif key == 'dontStretchShrink' then
|
||||||
|
addEvent(function()
|
||||||
|
modules.game_interface.updateStretchShrink()
|
||||||
|
end)
|
||||||
elseif key == 'enableMusic' then
|
elseif key == 'enableMusic' then
|
||||||
g_sounds.enableMusic(value)
|
g_sounds.enableMusic(value)
|
||||||
elseif key == 'showLeftPanel' then
|
elseif key == 'showLeftPanel' then
|
||||||
|
|
|
@ -17,7 +17,7 @@ OptionCheckBox < CheckBox
|
||||||
MainWindow
|
MainWindow
|
||||||
id: optionsWindow
|
id: optionsWindow
|
||||||
!text: tr('Options')
|
!text: tr('Options')
|
||||||
size: 350 280
|
size: 350 290
|
||||||
|
|
||||||
@onEnter: Options.hide()
|
@onEnter: Options.hide()
|
||||||
@onEscape: Options.hide()
|
@onEscape: Options.hide()
|
||||||
|
|
|
@ -10,6 +10,7 @@ mouseGrabberWidget = nil
|
||||||
countWindow = nil
|
countWindow = nil
|
||||||
logoutWindow = nil
|
logoutWindow = nil
|
||||||
exitWindow = nil
|
exitWindow = nil
|
||||||
|
bottomSplitter = nil
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
g_ui.importStyle('styles/countwindow.otui')
|
g_ui.importStyle('styles/countwindow.otui')
|
||||||
|
@ -25,6 +26,7 @@ function init()
|
||||||
mouseGrabberWidget = gameRootPanel:getChildById('mouseGrabber')
|
mouseGrabberWidget = gameRootPanel:getChildById('mouseGrabber')
|
||||||
mouseGrabberWidget.onMouseRelease = onMouseGrabberRelease
|
mouseGrabberWidget.onMouseRelease = onMouseGrabberRelease
|
||||||
|
|
||||||
|
bottomSplitter = gameRootPanel:getChildById('bottomSplitter')
|
||||||
gameMapPanel = gameRootPanel:getChildById('gameMapPanel')
|
gameMapPanel = gameRootPanel:getChildById('gameMapPanel')
|
||||||
gameRightPanel = gameRootPanel:getChildById('gameRightPanel')
|
gameRightPanel = gameRootPanel:getChildById('gameRightPanel')
|
||||||
gameLeftPanel = gameRootPanel:getChildById('gameLeftPanel')
|
gameLeftPanel = gameRootPanel:getChildById('gameLeftPanel')
|
||||||
|
@ -90,6 +92,7 @@ function show()
|
||||||
gameRootPanel:show()
|
gameRootPanel:show()
|
||||||
gameRootPanel:focus()
|
gameRootPanel:focus()
|
||||||
gameMapPanel:followCreature(g_game.getLocalPlayer())
|
gameMapPanel:followCreature(g_game.getLocalPlayer())
|
||||||
|
updateStretchShrink()
|
||||||
end
|
end
|
||||||
|
|
||||||
function hide()
|
function hide()
|
||||||
|
@ -187,6 +190,16 @@ function smartWalk(defaultDir)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function updateStretchShrink()
|
||||||
|
if Options.getOption('dontStretchShrink') then
|
||||||
|
gameMapPanel:setKeepAspectRatio(true)
|
||||||
|
gameMapPanel:setVisibleDimension({ width = 15, height = 11 })
|
||||||
|
|
||||||
|
-- Set gameMapPanel size to height = 11 * 32
|
||||||
|
bottomSplitter:setMarginBottom(bottomSplitter:getMarginBottom() + (gameMapPanel:getHeight() - 32 * 11) - 10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function toggleAspectRatio()
|
function toggleAspectRatio()
|
||||||
if gameMapPanel:isKeepAspectRatioEnabled() then
|
if gameMapPanel:isKeepAspectRatioEnabled() then
|
||||||
gameMapPanel:setKeepAspectRatio(false)
|
gameMapPanel:setKeepAspectRatio(false)
|
||||||
|
|
|
@ -63,7 +63,7 @@ UIWidget
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
relative-margin: bottom
|
relative-margin: bottom
|
||||||
margin-bottom: 172
|
margin-bottom: 172
|
||||||
@canUpdateMargin: function(self, newMargin) return math.max(math.min(newMargin, self:getParent():getHeight() - 300), 100) end
|
@canUpdateMargin: function(self, newMargin) if Options.getOption('dontStretchShrink') then return self:getMarginBottom() end return math.max(math.min(newMargin, self:getParent():getHeight() - 300), 100) end
|
||||||
@onGeometryChange: function(self) self:setMarginBottom(math.min(math.max(self:getParent():getHeight() - 300, 100), self:getMarginBottom())) end
|
@onGeometryChange: function(self) self:setMarginBottom(math.min(math.max(self:getParent():getHeight() - 300, 100), self:getMarginBottom())) end
|
||||||
|
|
||||||
UIWidget
|
UIWidget
|
||||||
|
|
Loading…
Reference in New Issue