Is there anything wrong with my code?

hi,all,
i wrote some simple codes to test whether SDL can work in my computer.codes below:

#testSDL.c
#include"SDL.h"
#include"stdlib.h"
#include"stdio.h"

int main(int argc,char * argv[])
{
if(-1==(SDL_Init(SDL_INIT_VIDEO)))
{
printf(“SDL cannot be initialized.\n”);
}
printf(“SDL initialized\n”);
SDL_Quit();
}

I compiled it using “gcc testSDL.c -I /usr/local/include -L /usr/local/lib -lSDL -o testSDL”,but when i executed testSDL,the console revolution changed to 320x200 immediately both in my debian and LFS(i donot use X,i executed testSDL in console mode),is there anything wrong in my codes???please give me some suggestions, thanks a lot!---------------------------------
DO YOU YAHOO!?
???G???No.1???

I don’t know if this will fix it, but main is supposed to return an integer.On 6/19/05, sappfaye-dsl at yahoo.com.cn wrote:

hi,all,
i wrote some simple codes to test whether SDL can work in my
computer.codes below:

#testSDL.c
#include"SDL.h"
#include"stdlib.h"
#include"stdio.h"

int main(int argc,char * argv[])
{
if(-1==(SDL_Init(SDL_INIT_VIDEO)))
{
printf(“SDL cannot be initialized.\n”);
}
printf(“SDL initialized\n”);
SDL_Quit();
}

I compiled it using “gcc testSDL.c -I /usr/local/include -L /usr/local/lib
-lSDL -o testSDL”,but when i executed testSDL,the console revolution changed
to 320x200 immediately both in my debian and LFS(i donot use X,i executed
testSDL in console mode),is there anything wrong in my codes???please give
me some suggestions, thanks a lot!


DO YOU YAHOO!?
???G???No.1???


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

hi,all,
i wrote some simple codes to test whether SDL can work in my
computer.codes below:

#testSDL.c
#include"SDL.h"
#include"stdlib.h"
#include"stdio.h"

int main(int argc,char * argv[])
{
if(-1==(SDL_Init(SDL_INIT_VIDEO)))
{
printf(“SDL cannot be initialized.\n”);
}
printf(“SDL initialized\n”);
SDL_Quit();
}

I compiled it using “gcc testSDL.c -I /usr/local/include -L /usr/local/lib
-lSDL -o testSDL”,but when i executed testSDL,the console revolution changed
to 320x200 immediately both in my debian and LFS(i donot use X,i executed
testSDL in console mode),is there anything wrong in my codes???please give
me some suggestions, thanks a lot!

It looks like you’re trying to init video without wanting to init video :stuck_out_tongue:

Many drivers, upon getting a call to video->init() (called by
SDL_InitVideo(), called by SDL_Init()) will switch to a graphics mode
of an arbitrary resolution, then possibly change that resolution when
you call SDL_SetVideoMode(). The implication is that if you’re
initializing video, you’re using video. If you don’t want that, but
you want to use some other features of SDL, just don’t pass
SDL_INIT_VIDEO as a flag to SDL_Init().

In short: No, there is nothing wrong with your code.

HTH
– JoshOn 6/18/05, sappfaye-dsl at yahoo.com.cn wrote:


DO YOU YAHOO!?
???G???No.1???


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl