SDL_Texture* Object::LoadSurface(std::string imagePath, bool doesColorKey, SDL_Color colorKey) { try { SDL_Surface* surface; surface = IMG_Load(imagePath.c_str()); if(surface == nullptr) SDLException::throwException(); imageSize = {surface->w, surface->h}; SDL_SetColorKey(surface, doesColorKey, SDL_MapRGB(surface->format, colorKey.r, colorKey.g, colorKey.b)); LoadClips({{0, 0, surface->w, surface->h}}); SetActiveClip(0); return LoadTexture(surface); } catch(std::exception& exception) { printf("%s\n", exception.what()); std::terminate(); } }
void __fastcall TClipMaker::ebLoadClipsClick(TObject *Sender) { LoadClips (); }