The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Headaches over getting started with rendering in a game loop
Cosmic Kid


Joined: 04 Oct 2014
Posts: 1
http://www.sdltutorials.com/sdl-coordinates-and-blitting
^The tutorial I'm using.

I'm having some trouble with this tutorial where it says you should see your image appear in the top left hand corner of the screen. For some strange reason (even though I copied the code word for word) every time I run the application it opens a black window and immediately closes it. This is what it returns in the output window:

Code:

'Legend.exe': Loaded 'C:\Users\Cameron\Documents\Visual Studio 2010\Projects\Legend\Debug\Legend.exe', Symbols loaded.
'Legend.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Users\Cameron\Documents\Visual Studio 2010\Projects\Legend\Legend\SDL.dll', Binary was not built with debug information.
'Legend.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\msvcr100.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'Legend.exe': Unloaded 'C:\Windows\SysWOW64\ddraw.dll'
'Legend.exe': Unloaded 'C:\Windows\SysWOW64\dwmapi.dll'
'Legend.exe': Unloaded 'C:\Windows\SysWOW64\setupapi.dll'
'Legend.exe': Unloaded 'C:\Windows\SysWOW64\devobj.dll'
'Legend.exe': Unloaded 'C:\Windows\SysWOW64\oleaut32.dll'
'Legend.exe': Unloaded 'C:\Windows\SysWOW64\ole32.dll'
'Legend.exe': Unloaded 'C:\Windows\SysWOW64\cfgmgr32.dll'
'Legend.exe': Unloaded 'C:\Windows\SysWOW64\dciman32.dll'
'Legend.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\KBDUS.DLL', Cannot find or open the PDB file
'Legend.exe': Unloaded 'C:\Windows\SysWOW64\KBDUS.DLL'
'Legend.exe': Loaded 'C:\Windows\SysWOW64\KBDUS.DLL', Cannot find or open the PDB file
'Legend.exe': Unloaded 'C:\Windows\SysWOW64\KBDUS.DLL'
'Legend.exe': Loaded 'C:\Windows\SysWOW64\dsound.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\powrprof.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\dinput.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'Legend.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x281c) has exited with code -1 (0xffffffff).
The thread 'Win32 Thread' (0x21fc) has exited with code -1 (0xffffffff).
The program '[4220] Legend.exe: Native' has exited with code -1 (0xffffffff).


I don't understand what's giving me this issue, as I've gotten their code copied perfectly. The thing is, the game isn't looping and continuing to render it seems; it's just closing out after displaying the black screen(not even my picture).
Naith


Joined: 03 Jul 2014
Posts: 158
Have you followed the basics tutorial (http://www.sdltutorials.com/sdl-tutorial-basics) that is before the sdl-coordinates-and-blitting tutorial? If that's the case, there might be something wrong in the code you've from that. My guess is that it's some function that's returning -1, which causes the program to exit / shutdown. Re-check all your code and also check that all the textures and stuff (if you load assets during startup) exist in the same directory as the executable file. If you can't find anything wrong with your code and stuff, let me know and you can send me your whole projects (if you're using Visual Studio) and I can check everything and try to execute it on my computer.
maosk21


Joined: 17 Jun 2014
Posts: 22
Simple example that will run.

SDL_Surface *screen, *showImage = NULL;

Code:
int main(int argc, char* args[]){

   if (SDL_Init(SDL_INIT_EVERYTHING) == -1)   //if failed to init SDL
   {
      MessageBox(NULL, "Could not initialize SDL. SDL.dll might be missing", "Error 1 ", MB_OK | MB_ICONERROR);
      return 1;
   }

        screen = SDL_SetVideoMode(1024, 768, 32, SDL_SWSURFACE);

        showImage = IMG_Load(image.png);
       
        //cordinates
        SDL_Rect showImageRect;
        showImageRect.x = 200;
        showImageRect.y = 200;

   while (!GetAsyncKeyState(VK_ESCAPE)){
      

                SDL_BlitSurface(showImage], NULL, SDL_GetVideoSurface(), &showImageRect);
      SDL_Flip(screen);

   }
       
        SDL_FreeSurface(showImage);
   SDL_FreeSurface(screen);
   SDL_Quit();

}