better resolution switcher then default

probably works on mac too (i dont have a powerpc that can run mbg to test lol) but eh whatever

looks like a proto because i dont want to write a custom gui component for this right now but whatever works
This commit is contained in:
yellows111 2024-03-20 17:37:23 +00:00
parent e7c419ef1a
commit c89e03f5c4
3 changed files with 51 additions and 186 deletions

1
.gitignore vendored
View File

@ -27,3 +27,4 @@ marble/server/prefs.cs
#SPECIFIC DIRECTORIES
/tmp
/marble/data/missions/custom/noinclude

View File

@ -27,11 +27,6 @@ function optionsDlg::setPane(%this, %pane)
%par.add("Opt" @ %pane @ "Tab");
}
function OptGraphicsPane::setResolution(%this, %res)
{
$pref::Video::resolution = %res SPC getWord($pref::Video::resolution, 2);
}
function OptGraphicsPane::setMode(%this, %mode)
{
$pref::Video::fullScreen = (%mode $= "Full");
@ -42,11 +37,6 @@ function OptGraphicsPane::setDriver(%this, %driver)
$pref::Video::displayDevice = %driver;
}
function OptGraphicsPane::setDepth(%this, %depth)
{
$pref::Video::resolution = getWords($pref::Video::resolution, 0, 1) SPC %depth;
}
function OptionsDlg::onWake(%this)
{
if ($platform $= "x86UNIX")
@ -59,26 +49,22 @@ function OptionsDlg::onWake(%this)
%buffer = getDisplayDeviceList();
%count = getFieldCount( %buffer );
OptGfx640480.setValue(false);
OptGfx800600.setValue(false);
OptGfx1024768.setValue(false);
OptGfx640480Mac.setValue(false);
OptGfx800600Mac.setValue(false);
OptGfx1024768Mac.setValue(false);
OptGfxResSelectWU.clear();
OptGfxResSelectNS.clear();
%res = getWords($pref::Video::resolution, 0, 1);
switch$(%res)
{
case "640 480":
OptGfx640480.setValue(true);
OptGfx640480Mac.setValue(true);
case "800 600":
OptGfx800600.setValue(true);
OptGfx800600Mac.setValue(true);
case "1024 768":
OptGfx1024768.setValue(true);
OptGfx1024768Mac.setValue(true);
OptGfxResSelectWU.setText(getResolution());
OptGfxResSelectNS.setText(getResolution());
%resList = getResolutionList($pref::Video::displayDevice);
for(%resIndex = 0; (%res = getField(%resList, %resIndex)) !$= ""; %resIndex++) {
OptGfxResSelectWU.add(%res, %resIndex);
OptGfxResSelectNS.add(%res, %resIndex);
if(getResolution() $= %res) {
OptGfxResSelectWU.setSelected(%resIndex);
OptGfxResSelectNS.setSelected(%resIndex);
}
}
%isOgl = $pref::Video::displayDevice $= "OpenGL";
OptGfxOpenGL.setValue(%isOgl);
OptGfxD3D.setValue(!%isOgl);
@ -88,12 +74,6 @@ function OptionsDlg::onWake(%this)
OptGfxFullMac.setValue($pref::Video::fullScreen);
OptGfxWindowMac.setValue(!$pref::Video::fullScreen);
%is32 = getWord($pref::Video::resolution, 2) == 32;
OptGfx16.setValue(!%is32);
OptGfx32.setValue(%is32);
OptGfx16Mac.setValue(!%is32);
OptGfx32Mac.setValue(%is32);
OptGraphicsDriverMenu.clear();
for(%i = 0; %i < %count; %i++)
OptGraphicsDriverMenu.add(getField(%buffer, %i), %i);
@ -251,20 +231,24 @@ function optionsDlg::applyGraphics( %this )
// %newBpp = OptGraphicsBPPMenu.getText();
// %newFullScreen = OptGraphicsFullscreenToggle.getValue();
pauseMusic();
%newReso = OptGfxResSelectWU.getTextById(OptGfxResSelectWU.getSelected());
if($platform $= "macos") {
%newReso = OptGfxResSelectNS.getTextById(OptGfxResSelectNS.getSelected());
}
if ($pref::Video::displayDevice !$= getDisplayDeviceName())
{
setDisplayDevice( $pref::Video::displayDevice,
firstWord( $pref::Video::resolution ),
getWord( $pref::Video::resolution, 1 ),
getWord( $pref::Video::resolution, 2),
firstWord( %newReso ),
getWord( %newReso, 1 ),
getWord( %newReso, 2),
$pref::Video::fullScreen );
//OptionsDlg::deviceDependent( %this );
}
else if($pref::Video::resolution !$= getResolution())
else if(%newReso !$= getResolution())
{
setScreenMode( firstWord( $pref::Video::resolution ),
getWord( $pref::Video::resolution, 1 ),
getWord( $pref::Video::resolution, 2),
setScreenMode( firstWord( %newReso ),
getWord( %newReso, 1 ),
getWord( %newReso, 2),
$pref::Video::fullScreen );
}
else if($pref::Video::fullScreen != isFullScreen())

View File

@ -477,50 +477,20 @@ new GuiChunkedBitmapCtrl(optionsDlg) {
bitmap = "./Options/graf_txt";
wrap = "0";
};
new GuiBitmapButtonCtrl(OptGfx640480) {
profile = "GuiButtonProfile";
new GuiPopUpMenuCtrl(OptGfxResSelectWU) {
profile = "GuiPopUpMenuProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "157 -3";
extent = "84 53";
minExtent = "8 8";
vertSizing = "top";
position = "170 2";
extent = "200 46";
minExtent = "8 2";
visible = "1";
command = "OptGraphicsPane.setResolution(\"640 480\");";
helpTag = "0";
text = "OK";
groupNum = "0";
buttonType = "RadioButton";
bitmap = "./Options/graf640";
};
new GuiBitmapButtonCtrl(OptGfx800600) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "237 0";
extent = "86 51";
minExtent = "8 8";
visible = "1";
command = "OptGraphicsPane.setResolution(\"800 600\");";
helpTag = "0";
text = "OK";
groupNum = "0";
buttonType = "RadioButton";
bitmap = "./Options/graf800";
};
new GuiBitmapButtonCtrl(OptGfx1024768) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "320 -1";
extent = "94 51";
minExtent = "8 8";
visible = "1";
command = "OptGraphicsPane.setResolution(\"1024 768\");";
helpTag = "0";
text = "OK";
groupNum = "0";
buttonType = "RadioButton";
bitmap = "./Options/graf1024";
variable = "";
enumerate = "0";
resizeCell = "1";
columns = "0";
fitParentWidth = "1";
clipColumnText = "0";
};
new GuiBitmapButtonCtrl(OptGfxOpenGL) {
profile = "GuiButtonProfile";
@ -567,36 +537,6 @@ new GuiChunkedBitmapCtrl(optionsDlg) {
buttonType = "PushButton";
bitmap = "./Options/grafapply";
};
new GuiBitmapButtonCtrl(OptGfx16) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "179 170";
extent = "78 54";
minExtent = "8 8";
visible = "1";
command = "OptGraphicsPane.setDepth(16);";
helpTag = "0";
text = "OK";
groupNum = "3";
buttonType = "RadioButton";
bitmap = "./Options/graf16bt";
};
new GuiBitmapButtonCtrl(OptGfx32) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "272 174";
extent = "84 51";
minExtent = "8 8";
visible = "1";
command = "OptGraphicsPane.setDepth(32);";
helpTag = "0";
text = "OK";
groupNum = "3";
buttonType = "RadioButton";
bitmap = "./Options/graf32bt";
};
new GuiBitmapButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
@ -761,80 +701,20 @@ new GuiChunkedBitmapCtrl(optionsDlg) {
buttonType = "ToggleButton";
bitmap = "./Options/graf_chkbx";
};
new GuiBitmapButtonCtrl(OptGfx640480Mac) {
profile = "GuiButtonProfile";
new GuiPopUpMenuCtrl(OptGfxResSelectNS) {
profile = "GuiPopUpMenuProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "161 -3";
extent = "84 53";
minExtent = "8 8";
vertSizing = "top";
position = "170 2";
extent = "200 46";
minExtent = "8 2";
visible = "1";
command = "OptGraphicsPane.setResolution(\"640 480\");";
helpTag = "0";
text = "OK";
groupNum = "0";
buttonType = "RadioButton";
bitmap = "./Options/graf640";
};
new GuiBitmapButtonCtrl(OptGfx800600Mac) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "241 0";
extent = "86 51";
minExtent = "8 8";
visible = "1";
command = "OptGraphicsPane.setResolution(\"800 600\");";
helpTag = "0";
text = "OK";
groupNum = "0";
buttonType = "RadioButton";
bitmap = "./Options/graf800";
};
new GuiBitmapButtonCtrl(OptGfx1024768Mac) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "324 -1";
extent = "94 51";
minExtent = "8 8";
visible = "1";
command = "OptGraphicsPane.setResolution(\"1024 768\");";
helpTag = "0";
text = "OK";
groupNum = "0";
buttonType = "RadioButton";
bitmap = "./Options/graf1024";
};
new GuiBitmapButtonCtrl(OptGfx32Mac) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "263 124";
extent = "84 51";
minExtent = "8 8";
visible = "1";
command = "OptGraphicsPane.setDepth(32);";
helpTag = "0";
text = "OK";
groupNum = "3";
buttonType = "RadioButton";
bitmap = "./Options/graf32bt";
};
new GuiBitmapButtonCtrl(OptGfx16Mac) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "170 120";
extent = "78 54";
minExtent = "8 8";
visible = "1";
command = "OptGraphicsPane.setDepth(16);";
helpTag = "0";
text = "OK";
groupNum = "3";
buttonType = "RadioButton";
bitmap = "./Options/graf16bt";
variable = "";
enumerate = "0";
resizeCell = "1";
columns = "0";
fitParentWidth = "1";
clipColumnText = "0";
};
new GuiBitmapButtonCtrl() {
profile = "GuiButtonProfile";