#include "SFML/Graphics.hpp"
Go to the source code of this file.
◆ LoadTextureFromResource()
      
        
          | sf::Texture LoadTextureFromResource  | 
          ( | 
          const char *const  | 
          name | ) | 
           | 
        
      
 
Creates a new sf::Texture and loads it with Texture data from a resource (.rc) file https://github.com/SFML/SFML/wiki/Source:-Load-Image-From-Resource. 
- Parameters
 - 
  
  
 
- Returns
 - sf::Texture - 
 
    8    HRSRC rsrcData = FindResource(NULL, name, RT_RCDATA);
 
    9    if (!rsrcData) 
throw ErrSys(
"RESORUCES find resoruce.");
 
   11    DWORD rsrcDataSize = SizeofResource(NULL, rsrcData);
 
   12    if (rsrcDataSize <= 0) 
throw ErrSys(
"RESORUCES Size is 0.");
 
   14    HGLOBAL grsrcData = LoadResource(NULL, rsrcData);
 
   15    if (!grsrcData) 
throw ErrSys(
"RESORUCES load resuroce.");
 
   17    LPVOID firstByte = LockResource(grsrcData);
 
   18    if (!firstByte) 
throw ErrSys(
"RESORUCES lock resoruce.");
 
   21    if (!texture.loadFromMemory(firstByte, rsrcDataSize))
 
   22       throw ErrSys(
"RESORUCES load texture form memory.");
 
 
 
 
◆ LoadFontFromResource()
      
        
          | sf::Font LoadFontFromResource  | 
          ( | 
          const char *const  | 
          name | ) | 
           | 
        
      
 
Create a new sf::Font and load it from resoruces. 
- Parameters
 - 
  
  
 
- Returns
 - sf::Font - 
 
   30    HRSRC rsrcData = FindResource(NULL, name, RT_RCDATA);
 
   31    if (!rsrcData) 
throw ErrSys(
"RESORUCES find resoruce.");
 
   33    DWORD rsrcDataSize = SizeofResource(NULL, rsrcData);
 
   34    if (rsrcDataSize <= 0) 
throw ErrSys(
"RESORUCES Size of is 0.");
 
   36    HGLOBAL grsrcData = LoadResource(NULL, rsrcData);
 
   37    if (!grsrcData) 
throw ErrSys(
"RESORUCES load resuroce.");
 
   39    LPVOID firstByte = LockResource(grsrcData);
 
   40    if (!firstByte) 
throw ErrSys(
"RESORUCES lock resoruce.");
 
   43    if (!font.loadFromMemory(firstByte, rsrcDataSize))
 
   44       throw ErrSys(
"RESORUCES load font form memory.");