🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

SDL Output Problem*solved*

Started by
3 comments, last by Xabbu 19 years, 11 months ago
When i try and run my program, i get no output, it compiles fine, but when executed, nothing happens.(And yes, there should be output). [Edited by - Xabbu on September 3, 2004 5:49:05 PM]
"He had surived everything, developing a faciltiy that was the envy of players every where on the net. He was the most famous character in the Middle country game,recruited for every battle..first choice for every important task"
Advertisement
What sort of output should there be? Sound, video?
I'm assuming you're writing to the standard output... Do you have any idea why it isn't showing up? Anything more information you can give us to narrow the problem down? How about showing us some code. Preferably, the function where you output, and perhaps where you set up SDL.
Writing to stdout should function correctly if you set your project up as a console app (which you possibly didn't).

If you set up a Win32 app you should find some files in your game's working directory (check your project folder or whatever) called stdout.txt or suchlike.

Hope this helps

Pete
Ok, here's the code.I got it from a tutorial.
#include <SDL/SDL.h>#include <stdio.h>#include <stdlib.h>SDL_Surface *screen;void Draw(int x, int y, SDL_Surface *sprite);int main(int nArgs, char **args){       SDL_Surface *image;    bool isRunning;    SDL_Init(SDL_INIT_VIDEO);    atexit(SDL_Quit);    screen = SDL_SetVideoMode(300, 200, 0, SDL_HWSURFACE|SDL_DOUBLEBUF);    image = SDL_LoadBMP("image.bmp");    isRunning = true;    while(isRunning)    {        SDL_Event event;        SDL_PollEvent(&event);        if (event.type == SDL_QUIT)            isRunning = false;        Draw(0,0,image);        SDL_Flip(screen);    }    SDL_FreeSurface(image);    return 0;}void Draw(int x, int y, SDL_Surface *sprite){    SDL_Rect source;    SDL_Rect dest;    source.x = 0;    source.y = 0;    source.w = sprite->w;    source.h = sprite->h;    dest.x = x;    dest.y = y;    dest.w = source.w;    dest.h = source.h;    SDL_BlitSurface(sprite, &source, screen, &dest);    return;}


edit:bah, now i have output, but it flashes for like half a second then closes.
"He had surived everything, developing a faciltiy that was the envy of players every where on the net. He was the most famous character in the Middle country game,recruited for every battle..first choice for every important task"

This topic is closed to new replies.

Advertisement