sdl-image

SDL2_image not found

做~自己de王妃 提交于 2021-01-22 07:41:02
问题 I am trying to compile the following code which has the headers: #include <SDL2/SDL.h> #include <SDL2_image/SDL_image.h> However after running the following makefile: g++ -std=c++11 src/main.cpp -lSDL2 -lSDL2_image I get the following error: fatal error: SDL2_image/SDL_image.h: No such file or directory #include <SDL2_image/SDL_image.h> Any suggestions? Not entirely sure about my installation of SDL_image. I am running this on Ubuntu. 回答1: This problem can be solved through installing libsdl2

SDL2_image not found

冷暖自知 提交于 2021-01-22 07:40:06
问题 I am trying to compile the following code which has the headers: #include <SDL2/SDL.h> #include <SDL2_image/SDL_image.h> However after running the following makefile: g++ -std=c++11 src/main.cpp -lSDL2 -lSDL2_image I get the following error: fatal error: SDL2_image/SDL_image.h: No such file or directory #include <SDL2_image/SDL_image.h> Any suggestions? Not entirely sure about my installation of SDL_image. I am running this on Ubuntu. 回答1: This problem can be solved through installing libsdl2

SDL2_image not found

僤鯓⒐⒋嵵緔 提交于 2021-01-22 07:38:05
问题 I am trying to compile the following code which has the headers: #include <SDL2/SDL.h> #include <SDL2_image/SDL_image.h> However after running the following makefile: g++ -std=c++11 src/main.cpp -lSDL2 -lSDL2_image I get the following error: fatal error: SDL2_image/SDL_image.h: No such file or directory #include <SDL2_image/SDL_image.h> Any suggestions? Not entirely sure about my installation of SDL_image. I am running this on Ubuntu. 回答1: This problem can be solved through installing libsdl2

SDL2_image not found

拥有回忆 提交于 2021-01-22 07:37:34
问题 I am trying to compile the following code which has the headers: #include <SDL2/SDL.h> #include <SDL2_image/SDL_image.h> However after running the following makefile: g++ -std=c++11 src/main.cpp -lSDL2 -lSDL2_image I get the following error: fatal error: SDL2_image/SDL_image.h: No such file or directory #include <SDL2_image/SDL_image.h> Any suggestions? Not entirely sure about my installation of SDL_image. I am running this on Ubuntu. 回答1: This problem can be solved through installing libsdl2

Can't load image with IMG_Load()

僤鯓⒐⒋嵵緔 提交于 2020-01-15 16:01:34
问题 I've got a problem with the SDL_image library. I wrote a simple program loading a spritesheet and animating it on left-click. Here's the code: #include <SDL2/SDL.h> #include <SDL2/SDL_image.h> const int sw=800; const int sh=450; int main(){ SDL_Init(SDL_INIT_EVERYTHING); IMG_Init(IMG_INIT_PNG); bool quit=false; bool shoot=false; SDL_Event event; Uint32 time; unsigned char frame=0; SDL_Window* window = SDL_CreateWindow("Sprite",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,sw,sh,0); SDL

Can't load image with IMG_Load()

浪尽此生 提交于 2020-01-15 15:58:07
问题 I've got a problem with the SDL_image library. I wrote a simple program loading a spritesheet and animating it on left-click. Here's the code: #include <SDL2/SDL.h> #include <SDL2/SDL_image.h> const int sw=800; const int sh=450; int main(){ SDL_Init(SDL_INIT_EVERYTHING); IMG_Init(IMG_INIT_PNG); bool quit=false; bool shoot=false; SDL_Event event; Uint32 time; unsigned char frame=0; SDL_Window* window = SDL_CreateWindow("Sprite",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,sw,sh,0); SDL

Linking SDL_image errors

吃可爱长大的小学妹 提交于 2020-01-06 15:58:24
问题 I am running into problems when linking SDL_image in gcc 3 on cygwin under Windows 7. I receive the following error: /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lSDL_image My makefile appears as this: all: rabbit rabbit: main.o rabbit.o renderer.o g++ -o rabbit main.o rabbit.o renderer.o -lSDLmain -lSDL -lSDL_image main.o: main.cpp rabbit.h g++ -c main.cpp rabbit.o: rabbit.cpp rabbit.h gameobject.h g++ -c rabbit.cpp renderer.o: renderer.cpp renderer.h g++

C++ IMG_LoadTexture() returns null

流过昼夜 提交于 2019-12-25 08:34:10
问题 I'm trying to load a image("carnero.png") but when I use IMG_LoadTexture(), it returns null; Game.h #ifndef GAME_H_ #define GAME_H_ #include <SDL.h> #include <SDL_image.h> #include <windows.h> class Game { public: Game(); ~Game(); void run(); void initGraphics(); void gameLoop(); private: SDL_Window* _window = nullptr; SDL_Renderer* _renderer; SDL_Surface* _surfaceBMP; SDL_Texture* _textureScenario; SDL_Texture* _textureCarnero; SDL_Rect* _scenarioRect; SDL_Rect* _carneroRect; int _width; int

Why do images loaded to texture with IMG_Load in SDL and OpenGL look bluish?

半世苍凉 提交于 2019-12-23 17:09:13
问题 I'm loading a PNG texture with: void Sprite::setTexture(string f) { SDL_Surface *image = IMG_Load(f.c_str()); if (image == NULL) { this->texture = -1; return; } SDL_DisplayFormatAlpha(image); unsigned object(0); glGenTextures(1, &object); glBindTexture(GL_TEXTURE_2D, object); glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); glTexParameterf(GL

Using .reset() to free a boost::shared_ptr with sole ownership

送分小仙女□ 提交于 2019-12-23 08:08:21
问题 I'm storing an object ( TTF_Font ) in a shared_ptr that is provided to me from a third-party API. I cannot use new or delete on the object, so the shared_ptr is also provided a "freeing" functor. // Functor struct CloseFont { void operator()(TTF_Font* font) const { if(font != NULL) { TTF_CloseFont(font); } } }; boost::shared_ptr<TTF_Font> screenFont; screenFont = boost::shared_ptr<TTF_Font>( TTF_OpenFont("slkscr.ttf", 8), CloseFont() ); If, later, I need to explicitly free this object is it