Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Quellcode |
|
1 |
myApp.exe c:\test_userIni.ini c:\test_userAni.ani |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
cUserSettings* cUserSettings::CreateInstance(const LPSTR lpCmdLine) { if (m_ptrInstance==NULL) { m_ptrInstance = new cUserSettings; // CommandLine parsen und wenn vorhanden, User-Defined // .ini und .ani Dateinamen übernehmen LPWSTR * cmdList; INT nArgs; cmdList = CommandLineToArgvW(GetCommandLineW(), &nArgs); if ( cmdList != NULL ) { if ( nArgs>2 ) { m_ptrInstance->iniFile_filename = cmdList[1]; m_ptrInstance->aniFile_filename = cmdList[2]; } else { m_ptrInstance->iniFile_filename = L"2dcse.ini"; m_ptrInstance->aniFile_filename = L"2dcse.ani"; } } // Speicher der Argumentenliste freigeben LocalFree( cmdList ); // neue Instanz retour return m_ptrInstance; } // vorhandene Instanz retour return m_ptrInstance; } |
Anonymous
unregistriert
Anonymous
unregistriert
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#include <memory> class CInst { public: static CInst* getInstance (); }; CInst* CInst::getInstance () { static std::auto_ptr<CInst> inst (0); if (0 == inst.get ()) inst = std::auto_ptr<CInst> (new CInst); return inst.get (); } |
Alter Hase
Werbeanzeige