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 #SPECIFIC DIRECTORIES
/tmp /tmp
/marble/data/missions/custom/noinclude

View File

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

View File

@ -477,50 +477,20 @@ new GuiChunkedBitmapCtrl(optionsDlg) {
bitmap = "./Options/graf_txt"; bitmap = "./Options/graf_txt";
wrap = "0"; wrap = "0";
}; };
new GuiBitmapButtonCtrl(OptGfx640480) { new GuiPopUpMenuCtrl(OptGfxResSelectWU) {
profile = "GuiButtonProfile"; profile = "GuiPopUpMenuProfile";
horizSizing = "right"; horizSizing = "right";
vertSizing = "bottom"; vertSizing = "top";
position = "157 -3"; position = "170 2";
extent = "84 53"; extent = "200 46";
minExtent = "8 8"; minExtent = "8 2";
visible = "1"; visible = "1";
command = "OptGraphicsPane.setResolution(\"640 480\");"; variable = "";
helpTag = "0"; enumerate = "0";
text = "OK"; resizeCell = "1";
groupNum = "0"; columns = "0";
buttonType = "RadioButton"; fitParentWidth = "1";
bitmap = "./Options/graf640"; clipColumnText = "0";
};
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";
}; };
new GuiBitmapButtonCtrl(OptGfxOpenGL) { new GuiBitmapButtonCtrl(OptGfxOpenGL) {
profile = "GuiButtonProfile"; profile = "GuiButtonProfile";
@ -567,36 +537,6 @@ new GuiChunkedBitmapCtrl(optionsDlg) {
buttonType = "PushButton"; buttonType = "PushButton";
bitmap = "./Options/grafapply"; 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() { new GuiBitmapButtonCtrl() {
profile = "GuiButtonProfile"; profile = "GuiButtonProfile";
horizSizing = "right"; horizSizing = "right";
@ -761,80 +701,20 @@ new GuiChunkedBitmapCtrl(optionsDlg) {
buttonType = "ToggleButton"; buttonType = "ToggleButton";
bitmap = "./Options/graf_chkbx"; bitmap = "./Options/graf_chkbx";
}; };
new GuiBitmapButtonCtrl(OptGfx640480Mac) { new GuiPopUpMenuCtrl(OptGfxResSelectNS) {
profile = "GuiButtonProfile"; profile = "GuiPopUpMenuProfile";
horizSizing = "right"; horizSizing = "right";
vertSizing = "bottom"; vertSizing = "top";
position = "161 -3"; position = "170 2";
extent = "84 53"; extent = "200 46";
minExtent = "8 8"; minExtent = "8 2";
visible = "1"; visible = "1";
command = "OptGraphicsPane.setResolution(\"640 480\");"; variable = "";
helpTag = "0"; enumerate = "0";
text = "OK"; resizeCell = "1";
groupNum = "0"; columns = "0";
buttonType = "RadioButton"; fitParentWidth = "1";
bitmap = "./Options/graf640"; clipColumnText = "0";
};
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";
}; };
new GuiBitmapButtonCtrl() { new GuiBitmapButtonCtrl() {
profile = "GuiButtonProfile"; profile = "GuiButtonProfile";