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
Anonymous
unregistriert
Quellcode |
|
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 39 40 41 42 43 44 45 46 47 48 49 50 51 |
VOID CDXEnum::VideoModes(VOID){ SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_RESETCONTENT, 0, 0); INT iNumVideoModes; char cVideoModes[1000] = ""; char Format[256]; INT iIndex = 0; //D3DFORMATS's for test D3DFORMAT d3dFormats[] = {D3DFMT_X8R8G8B8, D3DFMT_A2R10G10B10, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5}; for(int iVideoFormats = 0; iVideoFormats < 4; iVideoFormats++) { iNumVideoModes = m_lpD3D->GetAdapterModeCount(m_iChoosenAdapter, d3dFormats[iVideoFormats]); D3DDISPLAYMODE* pVideoModes = new D3DDISPLAYMODE[iNumVideoModes]; for(int iVideoModes = 0; iVideoModes < iNumVideoModes; iVideoModes++) { m_lpD3D->EnumAdapterModes(m_iChoosenAdapter, d3dFormats[iVideoFormats], iVideoModes, &pVideoModes[iVideoModes]); ReturnFormatString(pVideoModes[iVideoModes].Format, Format); sprintf(cVideoModes, "NumModus %d: %d x %d x %d Hz with %s", iVideoModes, pVideoModes[iVideoModes].Width, pVideoModes[iVideoModes].Height, pVideoModes[iVideoModes].RefreshRate, Format); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! iIndex = (INT)SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_ADDSTRING, 0, (LPARAM)cVideoModes); SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_SETITEMDATA, iIndex, (LPARAM)(pVideoModes)); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! } delete[] pVideoModes; } SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_SETCURSEL, 0, 0); } |
Quellcode |
|
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 39 40 41 42 43 |
VOID CDXEnum::GetBackBufferFormats(VOID){ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! INT iVideoModes; D3DDISPLAYMODE* pVideoModes = NULL; iVideoModes = (INT)SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_GETCURSEL, 0, 0); pVideoModes = (D3DDISPLAYMODE*)SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_GETITEMDATA, iVideoModes, 0); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboAdapterFormats, CB_RESETCONTENT, 0, 0); GetCurrentDisplayMode(); D3DFORMAT d3dFormats[] = {D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8, D3DFMT_R5G6B5, D3DFMT_A2R10G10B10, D3DFMT_A1R5G5B5, D3DFMT_X1R5G5B5}; char cFormats[256]; char cBufferFormats[256]; for(int iNumFormats = 0; iNumFormats < 6; iNumFormats++) { //!!!!!!!!!!!!!!!!!!!pVideoMode falsch ausgelesen?!!!!! if(SUCCEEDED(m_lpD3D->CheckDeviceFormat(m_iChoosenAdapter, m_d3dDevType, pVideoModes->Format, D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, d3dFormats[iNumFormats]))) { (...) Hier mal noch die zwei Funktion fürs in die Liste schreiben/lesen. Axo, die auskommentierten "SendDlgItemMessage" ist die andere Variante die ich probiert hatte und die auch nicht ging. VOID* CDXEnum::GetSelectedItem(INT Handles) { WPARAM nI = (WPARAM)((int)(DWORD)SendDlgItemMessage(m_hDlg, Handles, CB_GETCURSEL, 0, 0)); return ((void*)SendDlgItemMessage(m_hDlg,Handles,CB_GETITEMDATA,nI,0)); } VOID CDXEnum::AddItem(INT Handles, char *ch, void *pData) { WPARAM nI = (WPARAM)((int)(DWORD)SendDlgItemMessage(m_hDlg, Handles, CB_ADDSTRING, 0, (LPARAM)ch)); SendDlgItemMessage(m_hDlg, Handles, CB_SETITEMDATA, nI, (LPARAM)pData); } |
C-/C++-Quelltext |
|
1 2 3 4 5 |
D3DDISPLAYMODE* pVideoModes = new D3DDISPLAYMODE[iNumVideoModes]; D3DDISPLAYMODE* pVideoModes = NULL; iVideoModes = (INT)SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_GETCURSEL, 0, 0); pVideoModes = (D3DDISPLAYMODE*)SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_GETITEMDATA, iVideoModes, 0); |
Anonymous
unregistriert
Quellcode |
|
1 2 3 |
D3DDISPLAYMODE* pVideoModes = new D3DDISPLAYMODE[iNumVideoModes]; D3DDISPLAYMODE* pVideoModes = NULL; |
Quellcode |
|
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
tbResult EnumVideoModes(HWND hDlg) { int iSelectedAdapter; int iNumVideoModes; D3DFORMAT aFormat[] = {D3DFMT_X8R8G8B8, D3DFMT_R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5}; D3DDISPLAYMODE* pVideoMode; char acFormatString[256]; char acVideoModeString[256]; int iIndex; // Gewählten Adapter abfragen iSelectedAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0)); // Liste der Videomodi leeren DeleteListData(hDlg, IDC_D3DS_VIDEO_MODES); // Anzahl der verfügbaren Videomodi erfragen. // Wir gehen dabei Format für Format durch. for(int iFormat = 0; iFormat < 4; iFormat++) { iNumVideoModes = g_pD3DTemp->GetAdapterModeCount(iSelectedAdapter, aFormat[iFormat]); // Jeden Videomodus durchgehen und Informationen über ihn abfragen for(int iVideoMode = 0; iVideoMode < iNumVideoModes; iVideoMode++) { // Speicher für diesen Videomodus reservieren pVideoMode = (D3DDISPLAYMODE*)(tbMemAlloc(sizeof(D3DDISPLAYMODE))); // Informationen abfragen g_pD3DTemp->EnumAdapterModes(iSelectedAdapter, aFormat[iFormat], iVideoMode, pVideoMode); // Textbeschreibung für diesen Videomodus generieren GetFormatString(pVideoMode->Format, acFormatString); if(pVideoMode->RefreshRate != 0) sprintf(acVideoModeString, "%d x %d (%s, %d Hz)", pVideoMode->Width, pVideoMode->Height, acFormatString, pVideoMode->RefreshRate); else sprintf(acVideoModeString, "%d x %d (%s)", pVideoMode->Width, pVideoMode->Height, acFormatString); // Einen neuen Listeneintrag anlegen iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_ADDSTRING, 0, (LPARAM)(acVideoModeString))); // Daten dem Eintrag zuweisen SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_SETITEMDATA, iIndex, (LPARAM)(pVideoMode)); } } // Ersten Videomodus auswählen SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_SETCURSEL, 0, 0); return TB_OK; } |
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 39 40 41 42 43 44 45 46 47 48 49 50 51 |
VOID CDXEnum::VideoModes(VOID){ SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_RESETCONTENT, 0, 0); INT iNumVideoModes; char cVideoModes[1000] = ""; char Format[256]; INT iIndex = 0; //D3DFORMATS's for test D3DFORMAT d3dFormats[] = {D3DFMT_X8R8G8B8, D3DFMT_A2R10G10B10, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5}; for(int iVideoFormats = 0; iVideoFormats < 4; iVideoFormats++) { iNumVideoModes = m_lpD3D->GetAdapterModeCount(m_iChoosenAdapter, d3dFormats[iVideoFormats]); D3DDISPLAYMODE* pVideoModes = new D3DDISPLAYMODE[iNumVideoModes]; for(int iVideoModes = 0; iVideoModes < iNumVideoModes; iVideoModes++) { m_lpD3D->EnumAdapterModes(m_iChoosenAdapter, d3dFormats[iVideoFormats], iVideoModes, &pVideoModes[iVideoModes]); ReturnFormatString(pVideoModes[iVideoModes].Format, Format); sprintf(cVideoModes, "NumModus %d: %d x %d x %d Hz with %s", iVideoModes, pVideoModes[iVideoModes].Width, pVideoModes[iVideoModes].Height, pVideoModes[iVideoModes].RefreshRate, Format); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! iIndex = (INT)SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_ADDSTRING, 0, (LPARAM)cVideoModes); SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_SETITEMDATA, iIndex, (LPARAM)(pVideoModes[iVideoModes])); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! } delete[] pVideoModes; } SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_SETCURSEL, 0, 0); } |
Anonymous
unregistriert
Quellcode |
|
1 |
SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_SETITEMDATA, iIndex, (LPARAM)(pVideoModes[iVideoModes])); |
Quellcode |
|
1 2 |
// Speicher für diesen Videomodus reservieren pVideoMode = (D3DDISPLAYMODE*)(tbMemAlloc(sizeof(D3DDISPLAYMODE))); |
Anonymous
unregistriert
Quellcode |
|
1 2 |
iVideoModes = (INT)SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_GETCURSEL, 0, 0); pVideoModes = (D3DDISPLAYMODE*)SendDlgItemMessage(m_hDlg, DLGHANDLES.ComboVideoModes, CB_GETITEMDATA, iVideoModes, 0); |
Anonymous
unregistriert
Quellcode |
|
1 2 3 4 5 6 7 8 |
VOID* CDXEnum::Test(INT iSize){ VOID* pMemory; pMemory = ::operator new(iSize); return (BYTE*)(pMemory); } |
Werbeanzeige