MCPcopy Create free account
hub / github.com/DentonW/DevIL / GetNextImage

Function GetNextImage

DevIL/examples/windows_example/windows_example.cpp:1460–1523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1458
1459
1460bool GetNextImage()
1461{
1462 HANDLE Search;
1463 WIN32_FIND_DATA FindData;
1464 int i = 0, j, Total = 0, FileNamePos = -1;
1465 TCHAR *Ext, *CurName;
1466
1467 Search = FindFirstFile(L"*.*", &FindData);
1468 CurName = wcsrchr(CurFileName, '\\');
1469 if (CurName == NULL) {
1470 CurName = CurFileName;
1471 }
1472 else {
1473 CurName++; // Skip the '\'
1474 }
1475
1476 do {
1477 if (!_wcsicmp(FindData.cFileName, L".") || !_wcsicmp(FindData.cFileName, L".."))
1478 continue;
1479 Ext = GetExtension(FindData.cFileName);
1480 if (Ext == NULL)
1481 continue;
1482 for (j = 0; ExtList[j] != NULL; j++) {
1483 if (CheckExtension(FindData.cFileName, ExtList[j])) {
1484 if (!_wcsicmp(FindData.cFileName, CurName))
1485 FileNamePos = Total;
1486 Total++;
1487 break;
1488 }
1489 }
1490 } while (FindNextFile(Search, &FindData));
1491
1492 FindClose(Search);
1493 Search = FindFirstFile(L"*.*", &FindData);
1494
1495 if (Total == 0 || FileNamePos == -1)
1496 return false;
1497
1498 if (FileNamePos == Total-1)
1499 FileNamePos = -1;
1500
1501 do {
1502 if (!_wcsicmp(FindData.cFileName, L".") || !_wcsicmp(FindData.cFileName, L".."))
1503 continue;
1504 Ext = GetExtension(FindData.cFileName);
1505 if (Ext == NULL)
1506 continue;
1507 for (j = 0; ExtList[j] != NULL; j++) {
1508 if (CheckExtension(FindData.cFileName, ExtList[j])) {
1509 if (FileNamePos == i-1) {
1510 wcscpy(OpenFileName, FindData.cFileName);
1511 i++;
1512 break;
1513 }
1514 i++;
1515 break;
1516 }
1517 }

Callers 1

WndProcFunction · 0.70

Calls 2

GetExtensionFunction · 0.85
CheckExtensionFunction · 0.85

Tested by

no test coverage detected