MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / loadGpuImage

Function loadGpuImage

TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp:295–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293 void menuItem_Exit();
294
295 bool loadGpuImage(const char* localPath, UiImage* uiImage)
296 {
297 char imagePath[TFE_MAX_PATH];
298 strcpy(imagePath, localPath);
299 if (!TFE_Paths::mapSystemPath(imagePath))
300 {
301 memset(imagePath, 0, TFE_MAX_PATH);
302 TFE_Paths::appendPath(TFE_PathType::PATH_PROGRAM, localPath, imagePath, TFE_MAX_PATH);
303 FileUtil::fixupPath(imagePath);
304 }
305 SDL_Surface* image = TFE_Image::get(imagePath);
306 if (image)
307 {
308 TextureGpu* gpuImage = TFE_RenderBackend::createTexture(image->w, image->h, (u32*)image->pixels, MAG_FILTER_LINEAR);
309 uiImage->image = TFE_RenderBackend::getGpuPtr(gpuImage);
310 uiImage->width = image->w;
311 uiImage->height = image->h;
312 return true;
313 }
314 return false;
315 }
316
317 void initConsole()
318 {

Callers 1

initFunction · 0.70

Calls 6

getGpuPtrFunction · 0.85
createTextureFunction · 0.70
mapSystemPathFunction · 0.50
appendPathFunction · 0.50
fixupPathFunction · 0.50
getFunction · 0.50

Tested by

no test coverage detected