An adjustment in my code is causing a strange occurrence which is causing segfaults. After running it through gdb, I found that a call to SDL_QueryTexture wasn't assigning the SDL_Texture's width and height values to the int pointers passed to the method. I called SDL_GetError() and printed it, and it says: "Failed loading SHCORE.DLL: The specified module could not be found." While doing searching, I heard this may have to do something with older versions of Windows. I have Windows 7, but the code was working from before, so I doubt Windows is the problem here, but the code. The code I think is causing the problem (which includes the SDL_QueryTexture call) is below:
struct TextTexture {
private:
SDL_Texture* texture;
SDL_Rect destinationrect;
int* w;
int* h;
void loadText(string s) {
SDL_Color color = {255,255,255};
SDL_Surface* textsurface = TTF_RenderText_Solid(font, s.c_str(), color);
if(textsurface == NULL) {
cout << "Could not rendertext onto surface" << endl;
}
texture = SDL_CreateTextureFromSurface(r,textsurface);
if(texture == NULL) {
cout << "Could not make texture" << SDL_GetError() << endl;
}
SDL_QueryTexture(texture, NULL, NULL, w, h);
cout << SDL_GetError() << endl;
SDL_FreeSurface(textsurface);
textsurface = NULL;
}
void textRender(int x, int y) {
destinationrect = {x,y,*w,*h};
if (SDL_RenderCopy(r,texture,NULL,&destinationrect) < 0) {
cout << "Rendercopy error" << SDL_GetError() << endl;
}
}
};