fork download
  1. GLuint cResourceManager::requestTexture(TexID id)
  2. {
  3. std::string path(texturePaths.at(id));
  4.  
  5. if (textureCache.find(id) == textureCache.end())
  6. {
  7. if (PHYSFS_exists(path.c_str()))
  8. {
  9. auto file = std::unique_ptr<PHYSFS_File, int(*)(PHYSFS_File *)>(PHYSFS_openRead(path.c_str()), PHYSFS_close);
  10. if (file == nullptr)
  11. errmgr->throwErr(__FILE__, __func__, __LINE__, PHYSFS_getLastError());
  12.  
  13.  
  14. PHYSFS_sint64 img_size = PHYSFS_fileLength(file.get());
  15. std::unique_ptr<PHYSFS_sint64> img_data(new PHYSFS_sint64[img_size]);
  16. PHYSFS_sint64 length_read = PHYSFS_read(file.get(), img_data.get(), 1, img_size);
  17.  
  18. if (length_read != img_size)
  19. errmgr->throwErr(__FILE__, __func__, __LINE__, "length_read != img_size");
  20.  
  21. auto rw = std::unique_ptr<SDL_RWops, void(*)(SDL_RWops *)>(SDL_RWFromMem(img_data.get(), img_size), SDL_FreeRW);
  22. std::unique_ptr<SDL_Surface, void(*)(SDL_Surface *)> surf(IMG_Load_RW(rw.get(), 0), SDL_FreeSurface);
  23.  
  24. GLuint texture = sdlSurf2OpenGLtex(surf);
  25. textureCache.emplace(id, texture);
  26. textureCount.emplace(id, 0);
  27. }
  28. else
  29. errmgr->throwErr(__FILE__, __func__, __LINE__, "Texture " + utils::toString(int(id)) + " @ " + texturePaths.at(id));
  30. }
  31.  
  32. textureCount.at(id)++;
  33. return textureCache.at(id);
  34. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:1: error: ‘GLuint’ does not name a type
 GLuint cResourceManager::requestTexture(TexID id)
 ^
stdout
Standard output is empty