Hello fellows!
When I run this code:
for (int x = 0; x <= 5; x++)
{
for (int y = 0; y <= 9; y++)
{
if (mBack[x][y] == 0)
{
SDL_Rect src, dest;
src.x = 0;
src.y = 0;
dest.x = x * 60;
dest.y = y * 60;
src.w = 60;
src.h = 60;
dest.w = 60;
dest.h = 60;
SDL_BlitSurface(mBackTiles, &src, screen, &dest);
// Only for debug
// std::cout << "0\n";
continue;
}
... // Bla, bla
(gdb)r
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 1017)]
0x4004b883 in SDL_UpperBlit () from /usr/lib/libSDL-1.2.so.0
Current language: auto; currently c
(gdb) bt
#0 0x4004b883 in SDL_UpperBlit () from /usr/lib/libSDL-1.2.so.0
#1 0x0804998b in Back::Draw(SDL_Surface*) (this=0x8056048, screen=0x804d6d8)
at cBack.cpp:71
#2 0x08048d24 in Spel::MainLoop() (this=0x804a888) at cSpel.cpp:49
#3 0x08049bd1 in main () at main.cpp:7
#4 0x4018abb4 in __libc_start_main () from /lib/libc.so.6
I’m a beginner on SDL and game programming, so I’m really greatfull if anybody take time to look at this mess.