Nothing happens after build/run in Visual C++ 6

You need to set up a window with SDL_SetVideoMode. And you’ll probably want a delay in there so it doesn’t just shut down again immediately.------------------------
Privateer: Ascii Sector (www.asciisector.net)

Yeah, because you’re not writing/drawing to the graphical window – you’re writing to a console.------------------------
Privateer: Ascii Sector (www.asciisector.net)

To draw something in the SDL window, you will have to blit a surface (or part of a surface) to it or use something like SDL_ttf (which I’ve never used myself). To display text, I personally use a fontmap (just a bmp file) with all the font letters I need. I then have a procedure that writes a string of text by looping through the string, finding the coordinates of each letter on my fontmap and blitting that part of the fontmap to the desired area on the screen.------------------------
Privateer: Ascii Sector (www.asciisector.net)

Christian Knudsen wrote:

You need to set up a window with SDL_SetVideoMode. And you’ll probably want a delay in there so it doesn’t just shut down again immediately.

Err, i do not know what SDL_SetVideoMode so i tumbled it in the book and found example with SDL_SetVideoMode, but it doesnt work also:

Code:
#include “sdl.h”
#include <stdio.h>
#include <stdlib.h>

SDL_Surface* g_pMainSurface = NULL;
SDL_Event g_Event;

int main(int argc, char* argv[]) {
if (SDL_Init(SDL_INIT_VIDEO) == -1) {
fprintf(stderr, “Could not initialize SDL!\n”);
exit(1);
}
else {
fprintf(stdout, “SDL initialized properly!\n”);
atexit(SDL_Quit);
}
g_pMainSurface = SDL_SetVideoMode(640, 480, 0, SDL_ANYFORMAT);
if(!g_pMainSurface) {
fprintf(stderr, “Could not create main surface!\n”);
exit(1);
}
for(;:wink: {
if(SDL_WaitEvent(&g_Event) == 0) {
fprintf(stderr, “Error while waiting for an event!\n”);
exit(1);
}
//check the type of event
if(g_Event.type == SDL_QUIT) {
fprintf(stdout, “Quit event has occurred.\n”);
break;
}
}
fprintf(stdout, “Terminating program normally.\n”);
return(0);
}

The only thing that happen is that black window 640x480 appear and stands.
No result from fprintf(stderr, “Could not initialize SDL!\n”); and fprintf(stdout, “SDL initialized properly!\n”);.
Do you know why?

I assume you just write out to a file like you ordinarily would. I’m using FreePascal myself and I can just write to a file like normal – SDL doesn’t affect that.------------------------
Privateer: Ascii Sector (www.asciisector.net)