Author Topic: Help needed avoiding SDL window  (Read 4139 times)

Offline manmach

  • Multiple posting newcomer
  • *
  • Posts: 39
Help needed avoiding SDL window
« on: September 26, 2007, 02:06:04 pm »
I have an SDL application that does not create an SDL window, because I only need SDL for some preprocessing steps. So SDL is initialised like so:

Code
SetVideoMode(0,0,0,SDL_SWSURFACE);

The application itself is a wxWidgets application.
On Windows XP, when I run it from Code::Blocks, whether in debug or release mode, I get my application as expected. But when I start it from the command line, I get a big black SDL window AND my application.

So what exactly does Code::Blocks do when it starts the application, to avoid this SDL window?

Offline manmach

  • Multiple posting newcomer
  • *
  • Posts: 39
Re: Help needed avoiding SDL window
« Reply #1 on: September 26, 2007, 03:14:15 pm »
Hmm, it turns out that the difference is not what Code::Blocks does at program start, but how PATH has been set.

I used to be using SDL 1.2.9 and upgraded to 1.2.12 recently. But the SDL.dll of both versions are on disk somewhere and depending on the situation either one or the other was found first.

And apparently with 1.2.12 you still get an SDL window, even if you say you don't want one, whereas 1.2.9 simply obeys :-)

So, on to the next hurdle. Anyone any suggestions as to why 1.2.12 insists on creating a window?

insolence

  • Guest
Re: Help needed avoiding SDL window
« Reply #2 on: September 27, 2007, 08:51:32 pm »
I'm a total beginner with SDL but I found that there's a couple SDL apps that when run on linux produce big black windows in addition to their other windows.  I thought this was because these apps used wxWidgets to do some of the windowing and so the SDL_SetVideoMode call was unnecessary.

One tutorial on using SDL with wxWidgets uses SetVideoMode with a 0 width 0 height window, but for some reason this defaults to some giant black window behind a later window apparently created with wxWidgets.  (Again, I'm not certain about this.)

I commented out the SDL_SetVideoMode call and there was no black window and the program ran fine.  SDL_Init does the SDL initialization so SetVideoMode is not always necessary, that's my guess anyway.  I'm also thinking that perhaps a bunch of people started using it with 0x0 because they saw it in tutorials without really understanding what SetVideoMode does.  (I certainly don't.)  Then in a recent version of SDL, they changed it so that 0x0 defaults to a large window instead of being invisible.  Hence, the large black windows.  Your PATH issues are maybe using two different versions of libraries right around this issue.

Can someone confirm this?
« Last Edit: September 27, 2007, 08:53:34 pm by insolence »