Questions tagged [sdl-image]

SDL_image is an image file loading library. It loads images as SDL surfaces, and supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, WEBP, XCF, XPM, XV.

156 questions
2
votes
1 answer

Can't load image with IMG_Load()

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 #include const int sw=800; const int sh=450; int main(){ …
Lisu
  • 35
  • 1
  • 4
2
votes
1 answer

Displaying a PNG in SDL?

I am trying to get a knight on a horse (inauspiciously named "guy") to run across the screen. The knight currently exists in my directory as 2 .png files, to simulate some poorly animated galloping. I was able to get him to appear when he was a…
2
votes
1 answer

Adding SDL2 extension libraries to android project

Hi i just setup SDL2 for android on windows 7 with this guide - http://www.mosaicit.de/android-sdl-c-build-system-compiling. But the problem is that i would like to use SDL2_image and ttf but i don't know how to add them to this kind of project and…
2
votes
1 answer

SDL : blitting on background instead of screen?

Hi i'm working on an SDL/C game , i've made a camera scrolling with a big background (6000*1024) and (1024*768) screen, game.screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); so if i want to blit something on the…
2
votes
1 answer

SDL, OpenGL: Segmentation fault

When I try generate texture with openGL I get a segmentation fault in this method: void RendererGL::create_gl(SDL_Surface * surf, GLuint * tex ) { GLenum format; GLint colors_amount = surf->format->BytesPerPixel; if (colors_amount == 4)…
lolcio
  • 346
  • 5
  • 12
1
vote
3 answers

Is there a better way to load in a big animation?

Maybe not really big, but a hundred frames or something. Is the only way to load it in by making an array and loading each image individually? load_image() is a function I made which loads the images and converts their BPP. expl[0] = load_image(…
Justen
  • 4,859
  • 9
  • 44
  • 68
1
vote
0 answers

SDL2_image not showing up, getting instead a black screen

I am doing a game using SDL. The problem is that instead of getting image I see a black screen without any errors. And the most interesting thing that I've made another test project to see if I'll get an image and this one works excellent. In test…
kurkurindd
  • 23
  • 4
1
vote
1 answer

Assets path with SDL2 library

I'm trying to load image with IMG_Load() function from SDL. I saw from tutorials that they doesn't need full path for asset files. But when I try to do that, it doesn't work. My solution is include full path of those files, but I found that is…
Giao Lê
  • 23
  • 4
1
vote
1 answer

How to import Homebrew SDL2_image with CMake (Mac M1)

I installed SDL2_image with home-brew (so installed at /opt/homebrew/Cellar/) but I can't make CMake detecting it... I tried installing the Framework version, but it seems to not be compatible with the ARM ship... I Also tried to add…
Louis
  • 75
  • 1
  • 1
  • 6
1
vote
1 answer

Flipping a surface vertically in SDL2

The closest i've gotten is this: void Engine::flipSurfaceVertically(SDL_Surface* surface) { SDL_LockSurface(surface); Uint8* pixels = reinterpret_cast(surface->pixels); for (int k = 0; k < sizeof(Uint32); ++k) { for…
Nadpher
  • 186
  • 1
  • 10
1
vote
1 answer

SDL2 on Raspberry Pi 4: SDL Initialization failed No available video device

I was having a problem getting one of my programs that uses SDL to compile so to fix it I reinstalled SDL2 and SDL2Image following this link: https://solarianprogrammer.com/2015/01/22/raspberry-pi-raspbian-getting-started-sdl-2/ I used this link…
JGoss
  • 115
  • 1
  • 10
1
vote
2 answers

SDL include error when including SDL2/SDL_Image

Here is a simple SDL2 program that uses SDL_Image and runs just fine: #include #include #include // Manage error messages void check_error_sdl(bool check, const char* message); void…
JGoss
  • 115
  • 1
  • 10
1
vote
1 answer

Why do i get weird artefacts when changing pixels of an SDL_Surface?

So I am trying to edit every pixels of an SDL_Surface to apply the grayscaling formula. But when running my code I get an area of the width of my entire screen and the height of the surface filled with weird RGB stripes. void grayscale32(Uint8…
D4ilyrun
  • 11
  • 1
1
vote
0 answers

SDL2_Image is throwing "The procedure entry point inflateReset2 could not be located" whenever i try to initialize SDL2_Image for png images

The file included in the error message is "libpng16-16.dll", I am using SDL2_Image version 2.0.4 with Visual C++ on Windows. No matter what I do, the message stays. i tried swapping out all libpng16-16.dll files with my version i got. I also tried…
kritomas
  • 33
  • 5
1
vote
2 answers

Using SDL_image and SDL_RWops with LibZip to load pngs from a zip onto a surface, but won't recognize png

Relevant code: zip_stat_t filestat; uint64_t filetotal = 0; SDL_RWops* rwop = SDL_AllocRW(); //bunch of code that's not relevant to the matter goes here std::vector rwbuffer(filestat.size); rwop = SDL_RWFromMem(rwbuffer.data(),…
laura
  • 51
  • 5
1 2
3
10 11