|
@@ -1,5 +1,8 @@
|
|
|
#include "Einstellungen.h"
|
|
|
#include <MausEreignis.h>
|
|
|
+#include <GraphicsApi.h>
|
|
|
+#include <InitDatei.h>
|
|
|
+#include "../../Global/Variablen.h"
|
|
|
#include "../../Global/Initialisierung.h"
|
|
|
|
|
|
// Inhalt der Einstellungen Klasse aus Einstellungen.h
|
|
@@ -15,10 +18,50 @@ Einstellungen::Einstellungen( Schrift *zSchrift, Fenster *zF )
|
|
|
f->setSBgFarbe( 0xF0000000 );
|
|
|
f->setClosingMeParam( this );
|
|
|
f->setClosingMe( einstellungenSchließenME );
|
|
|
+ TextFeld *gat = initTextFeld( 5, 5, 300, 20, zSchrift, TextFeld::Style::Text, "Grafik Engine (Neustart erforderlich)" );
|
|
|
+ f->addMember( gat );
|
|
|
+ AuswahlBox *graphicAPI = initAuswahlBox( 5, 25, 100, 20, zSchrift, AuswahlBox::Style::Normal | AuswahlBox::Style::Hintergrund, { "Aktuellste", "DirectX 9" } );
|
|
|
+ if( DirectX11::isAvailable() )
|
|
|
+ graphicAPI->addEintrag( "DirectX 11" );
|
|
|
+ if( DirectX12::isAvailable() )
|
|
|
+ graphicAPI->addEintrag( "DirectX 12" );
|
|
|
+ graphicAPI->setAuswahl( 0 );
|
|
|
+ if( userOptions->wertExistiert( "GraphicAPI" ) && userOptions->zWert( "GraphicAPI" )->istGleich( "DX9" ) )
|
|
|
+ graphicAPI->setAuswahl( 1 );
|
|
|
+ if( userOptions->wertExistiert( "GraphicAPI" ) && userOptions->zWert( "GraphicAPI" )->istGleich( "DX11" ) )
|
|
|
+ graphicAPI->setAuswahl( 2 );
|
|
|
+ if( userOptions->wertExistiert( "GraphicAPI" ) && userOptions->zWert( "GraphicAPI" )->istGleich( "DX12" ) )
|
|
|
+ graphicAPI->setAuswahl( 3 );
|
|
|
+ graphicAPI->setEventAktion( [ this ]( void *p, AuswahlBox * b, int unused, int auswahl )
|
|
|
+ {
|
|
|
+ switch( auswahl )
|
|
|
+ {
|
|
|
+ case 1:
|
|
|
+ userOptions->setWert( "GraphicAPI", "DX9" );
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ userOptions->setWert( "GraphicAPI", "DX11" );
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ userOptions->setWert( "GraphicAPI", "DX12" );
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ userOptions->setWert( "GraphicAPI", "BEST" );
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ TextFeld *mft = initTextFeld( 5, 50, 200, 20, zSchrift, TextFeld::Style::Text, "Maximale FPS" );
|
|
|
+ f->addMember( mft );
|
|
|
+ maxFPS = initTextFeld( 5, 70, 50, 20, zSchrift, TextFeld::Style::TextFeld, userOptions->wertExistiert( "MaxFPS" ) ? userOptions->zWert( "MaxFPS" )->getText() : "30" );
|
|
|
+ maxFPS->setTastaturEreignis( _nurNummernTE );
|
|
|
+ f->addMember( maxFPS->getThis() );
|
|
|
ok = initKnopf( 390, 450, 100, 20, zSchrift, Knopf::Style::Sichtbar, "Ok" );
|
|
|
ok->setMausEreignisParameter( this );
|
|
|
ok->setMausEreignis( einstellungenOkME );
|
|
|
f->addMember( ok->getThis() );
|
|
|
+ // add AuswahlBoxen
|
|
|
+ f->addMember( graphicAPI );
|
|
|
+
|
|
|
zF->addMember( f->getThis() );
|
|
|
ref = 1;
|
|
|
}
|
|
@@ -26,6 +69,7 @@ Einstellungen::Einstellungen( Schrift *zSchrift, Fenster *zF )
|
|
|
// Destruktor
|
|
|
Einstellungen::~Einstellungen()
|
|
|
{
|
|
|
+ maxFPS->release();
|
|
|
f->release();
|
|
|
ok->release();
|
|
|
}
|
|
@@ -33,8 +77,6 @@ Einstellungen::~Einstellungen()
|
|
|
// nicht constant
|
|
|
void Einstellungen::setSichtbar()
|
|
|
{
|
|
|
- // TODO
|
|
|
- //-------------------
|
|
|
f->setStyle( Fenster::Style::Sichtbar, f->hatStyleNicht( Fenster::Style::Sichtbar ) );
|
|
|
}
|
|
|
|
|
@@ -50,8 +92,17 @@ bool Einstellungen::okME( MausEreignis &me )
|
|
|
if( me.id == ME_RLinks )
|
|
|
{
|
|
|
f->removeStyle( Fenster::Style::Sichtbar );
|
|
|
- // TODO
|
|
|
- //-----------------------------
|
|
|
+ int fps = *maxFPS->zText();
|
|
|
+ if( fps > 0 )
|
|
|
+ {
|
|
|
+ hauptScreen->lock();
|
|
|
+ if( !userOptions->wertExistiert( "MaxFPS" ) )
|
|
|
+ userOptions->addWert( "MaxFPS", maxFPS->zText()->getText() );
|
|
|
+ else
|
|
|
+ userOptions->setWert( "MaxFPS", maxFPS->zText()->getText() );
|
|
|
+ hauptScreen->unlock();
|
|
|
+ }
|
|
|
+ userOptions->speichern();
|
|
|
}
|
|
|
return 1;
|
|
|
}
|