1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

add Resolution setting

This commit is contained in:
FunkyFr3sh 2023-09-03 00:08:14 +02:00
parent c9d5e1015c
commit 19ed60642f
3 changed files with 93 additions and 10 deletions

View File

@ -116,6 +116,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
CompatibilityBtn->Caption = L"兼容性设置";
RestoreDefaultsBtn->Caption = L"恢复默认设置";
PresentationLbl->Caption = L"显示方式";
ResolutionLbl->Caption = L"解决";
MaintasLbl->Caption = L"保持纵横比";
VsyncLbl->Caption = L"打开垂直同步";
AdjmouseLbl->Caption = L"调整鼠标灵敏度";
@ -175,6 +176,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
CompatibilityBtn->Caption = L"Ajustes de compatibilidad";
RestoreDefaultsBtn->Caption = L"Restaurar la configuración predeterminada";
PresentationLbl->Caption = L"Presentación";
ResolutionLbl->Caption = L"Resolución";
MaintasLbl->Caption = L"Mantener la relación de aspecto";
VsyncLbl->Caption = L"Activar VSync";
AdjmouseLbl->Caption = L"Ajustar sensibilidad de ratón";
@ -234,6 +236,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
CompatibilityBtn->Caption = L"Kompatibilitätseinstellungen";
RestoreDefaultsBtn->Caption = L"Standardeinstellungen wiederherstellen";
PresentationLbl->Caption = L"Darstellung";
ResolutionLbl->Caption = L"Auflösung";
MaintasLbl->Caption = L"Seitenverhältnis beibehalten";
VsyncLbl->Caption = L"VSync aktiveren";
AdjmouseLbl->Caption = L"Mausempfindlichkeit anpassen";
@ -294,6 +297,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
CompatibilityBtn->Caption = L"Настройки совместимости";
RestoreDefaultsBtn->Caption = L"Восстановить настройки по умолчанию";
PresentationLbl->Caption = L"Отображение";
ResolutionLbl->Caption = L"Разрешение";
MaintasLbl->Caption = L"Сохранять соотношение сторон";
VsyncLbl->Caption = L"Включить VSync";
AdjmouseLbl->Caption = L"Регулировка чувствительности мыши";
@ -353,6 +357,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
CompatibilityBtn->Caption = L"Kompatibilitás Beállítások";
RestoreDefaultsBtn->Caption = L"Visszaállítja az alapértelmezett beállításokat";
PresentationLbl->Caption = L"Bemutató";
ResolutionLbl->Caption = L"Felbontás";
MaintasLbl->Caption = L"Képarány megtartása";
VsyncLbl->Caption = L"VSync bekapcsolása";
AdjmouseLbl->Caption = L"Egérérzékenység beállítás";
@ -412,6 +417,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
CompatibilityBtn->Caption = L"Paramètres de Compatibilité";
RestoreDefaultsBtn->Caption = L"Restaurer les paramètres par défaut";
PresentationLbl->Caption = L"Présentation";
ResolutionLbl->Caption = L"Résolution";
MaintasLbl->Caption = L"Conserver les proportions de l'image";
VsyncLbl->Caption = L"Activer la synchro verticale (VSync)";
AdjmouseLbl->Caption = L"Ajuster la sensibilité souris";
@ -471,6 +477,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
CompatibilityBtn->Caption = L"Impostazioni di compatibilità";
RestoreDefaultsBtn->Caption = L"Ripristina le impostazioni predefinite";
PresentationLbl->Caption = L"Presentazione";
ResolutionLbl->Caption = L"Risoluzione";
MaintasLbl->Caption = L"Mantieni il rapporto d'aspetto";
VsyncLbl->Caption = L"Abilita la sincronizzazione verticale (VSync)";
AdjmouseLbl->Caption = L"Regola la sensibilità del mouse";
@ -575,6 +582,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
CompatibilityBtn->Caption = L"Compatibility Settings";
RestoreDefaultsBtn->Caption = L"Restore default settings";
PresentationLbl->Caption = L"Presentation";
ResolutionLbl->Caption = L"Resolution";
MaintasLbl->Caption = L"Maintain aspect ratio";
VsyncLbl->Caption = L"Enable VSync";
AdjmouseLbl->Caption = L"Adjust mouse sensitivity";
@ -694,6 +702,7 @@ void __fastcall TConfigForm::FormCreate(TObject *Sender)
}
auto *ini = new TIniFile(".\\dd-hd.ini");
auto *hd_ini = new TIniFile(".\\Warcraft_II_HD.ini");
if (ini->ReadString("ddraw", "configtheme", "Windows10") == "Cobalt XEMedia") {
@ -727,6 +736,18 @@ void __fastcall TConfigForm::FormCreate(TObject *Sender)
PresentationCbx->ItemIndex = 0;
}
int cwidth = hd_ini->ReadInteger("Warcraft_II_HD", "Width", 0);
int cheight = hd_ini->ReadInteger("Warcraft_II_HD", "Height", 0);
int reso = hd_ini->ReadInteger("Warcraft_II_HD", "Resolution", 3);
if (!cwidth || !cheight) {
ResolutionCbx->ItemIndex = reso <= 5 ? reso : 3;
}
else {
ResolutionCbx->AddItem(IntToStr(cwidth) + "x" + IntToStr(cheight), NULL);
ResolutionCbx->ItemIndex = ResolutionCbx->Items->Count - 1;
}
MaintasChk->State = GetBool(ini, "maintas", false) ? tssOn : tssOff;
VsyncChk->State = GetBool(ini, "vsync", false) ? tssOn : tssOff;
AdjmouseChk->State = GetBool(ini, "adjmouse", true) ? tssOn : tssOff;
@ -889,6 +910,7 @@ void __fastcall TConfigForm::FormCreate(TObject *Sender)
GetBool(ini, "allow_reset", true);
delete ini;
delete hd_ini;
Initialized = true;
}
@ -899,6 +921,7 @@ void TConfigForm::SaveSettings()
return;
auto *ini = new TIniFile(".\\dd-hd.ini");
auto *hd_ini = new TIniFile(".\\Warcraft_II_HD.ini");
/* Display Settings */
@ -925,6 +948,18 @@ void TConfigForm::SaveSettings()
break;
}
if (ResolutionCbx->ItemIndex <= 5) {
hd_ini->WriteInteger(
"Warcraft_II_HD", "Resolution", ResolutionCbx->ItemIndex);
hd_ini->WriteInteger("Warcraft_II_HD", "Width", 0);
hd_ini->WriteInteger("Warcraft_II_HD", "Height", 0);
if (ResolutionCbx->Items->Count == 7) {
ResolutionCbx->Items->Delete(6);
}
}
ini->WriteString(
"ddraw",
"maintas",
@ -1112,6 +1147,7 @@ void TConfigForm::SaveSettings()
NonexclusiveChk->State == tssOn ? "true" : "false");
delete ini;
delete hd_ini;
}
void __fastcall TConfigForm::FormActivate(TObject *Sender)
@ -1340,3 +1376,4 @@ void __fastcall TConfigForm::PboxPaint(TObject *Sender)
//pbox->Canvas->Rectangle(pbox->ClientRect);
}

View File

@ -2696,8 +2696,6 @@ object ConfigForm: TConfigForm
ShowCaption = False
TabOrder = 1
StyleElements = [seFont, seBorder]
ExplicitWidth = 495
ExplicitHeight = 464
DesignSize = (
499
465)
@ -2716,7 +2714,7 @@ object ConfigForm: TConfigForm
end
object MaintasLbl: TLabel
Left = 40
Top = 105
Top = 182
Width = 145
Height = 21
Margins.Top = 18
@ -2730,7 +2728,7 @@ object ConfigForm: TConfigForm
end
object VsyncLbl: TLabel
Left = 40
Top = 173
Top = 250
Width = 93
Height = 21
Margins.Top = 18
@ -2744,7 +2742,7 @@ object ConfigForm: TConfigForm
end
object AdjmouseLbl: TLabel
Left = 40
Top = 241
Top = 318
Width = 168
Height = 21
Margins.Top = 18
@ -2758,7 +2756,7 @@ object ConfigForm: TConfigForm
end
object DevmodeLbl: TLabel
Left = 40
Top = 309
Top = 386
Width = 216
Height = 21
Margins.Top = 18
@ -2806,6 +2804,26 @@ object ConfigForm: TConfigForm
Visible = False
OnClick = LanguageImgClick
end
object ResolutionLbl: TLabel
Left = 40
Top = 105
Width = 74
Height = 21
Caption = 'Resolution'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
end
object ResolutionPbox: TPaintBox
Left = 40
Top = 131
Width = 282
Height = 31
OnPaint = PboxPaint
end
object PresentationCbx: TComboBox
Left = 41
Top = 55
@ -2831,7 +2849,7 @@ object ConfigForm: TConfigForm
end
object MaintasChk: TToggleSwitch
Left = 40
Top = 132
Top = 209
Width = 50
Height = 20
ShowStateCaption = False
@ -2840,7 +2858,7 @@ object ConfigForm: TConfigForm
end
object VsyncChk: TToggleSwitch
Left = 40
Top = 200
Top = 277
Width = 50
Height = 20
ShowStateCaption = False
@ -2849,7 +2867,7 @@ object ConfigForm: TConfigForm
end
object AdjmouseChk: TToggleSwitch
Left = 40
Top = 268
Top = 345
Width = 50
Height = 20
ShowStateCaption = False
@ -2858,7 +2876,7 @@ object ConfigForm: TConfigForm
end
object DevmodeChk: TToggleSwitch
Left = 40
Top = 336
Top = 413
Width = 50
Height = 20
ShowStateCaption = False
@ -2879,6 +2897,31 @@ object ConfigForm: TConfigForm
OnClick = ThemePnlClick
ExplicitLeft = 471
end
object ResolutionCbx: TComboBox
Left = 41
Top = 132
Width = 280
Height = 29
BevelEdges = []
BevelInner = bvNone
BevelOuter = bvSpace
Style = csDropDownList
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Font.Name = 'Segoe UI'
Font.Style = []
ParentFont = False
TabOrder = 6
OnChange = PresentationCbxChange
Items.Strings = (
'640x480 (4:3)'
'800x608 (4:3)'
'832x480 (16:9)'
'960x544 (16:9)'
'1280x704 (16:9)'
'1280x544 (21:9)')
end
end
object CompatibilityPnl: TPanel
Left = 233

View File

@ -81,6 +81,9 @@ __published: // Von der IDE verwaltete Komponenten
TComboBox *ShaderD3DCbx;
TSpeedButton *RestoreDefaultsBtn;
TPanel *ThemePnl;
TComboBox *ResolutionCbx;
TLabel *ResolutionLbl;
TPaintBox *ResolutionPbox;
void __fastcall DisplayBtnClick(TObject *Sender);
void __fastcall AdvancedBtnClick(TObject *Sender);
void __fastcall CompatibilityBtnClick(TObject *Sender);