Kill Window without SDL_Quit()

Hello Everyone,

I have a quick question (hopefully quick)

I’d explain what I’m trying to do, but that wouldn’t be quick. The basic idea
is that I’m using FLTK with SDL. FLTK is the original window, it spawns an SDL
window.

I need/want to keep SDL initialized for the length of the program execution. So
I need a way to kill the SDL window and yet keep SDL Initialized.

The only reason I have for this is that I’ve stored pointers to the
SDL_ListModes result, and if SDL quits, those pointers are no longer valid.

So the request:
Kill SDL window without killing SDL. Is it possible? How is it done?

If it isn’t possible… It’ll be my request for SDL1.3/2.0

Hello Everyone,

I have a quick question (hopefully quick)

I’d explain what I’m trying to do, but that wouldn’t be quick. The basic
idea
is that I’m using FLTK with SDL. FLTK is the original window, it spawns
an SDL
window.

I need/want to keep SDL initialized for the length of the program
execution. So
I need a way to kill the SDL window and yet keep SDL Initialized.

The only reason I have for this is that I’ve stored pointers to the
SDL_ListModes result, and if SDL quits, those pointers are no longer
valid.

How many nanoseconds are you saving by doing that? Is the CPU time saved by
this worth anyone enough to make this problem worth the timeneeded to solve
it?

Seriously, just get the pointer again when you restart SDL. Or, if that just
isn’t possible then waste a few bytes of memory and store the whole table,
or just the parts you need, and keep the copy around for as long as you need
it.

So the request:

Kill SDL window without killing SDL. Is it possible? How is it done?

If it isn’t possible… It’ll be my request for SDL1.3/2.0

Why? To save a handful of nanoseconds or a handful of bytes? Anyway,
1.3supports multiple windows so the problem would be very different.

Bob PendletonOn 2/20/08, Micah Brening <micah.brening at gmail.com> wrote:


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Bob Pendleton <bob pendleton.com> writes:

How many nanoseconds are you saving by doing that? Is the CPU time saved by
this worth anyone enough to make this problem worth the timeneeded to solve
it?Seriously, just get the pointer again when you restart SDL. Or, if that just
isn’t possible then waste a few bytes of memory and store the whole table, or
just the parts you need, and keep the copy around for as long as you need it.
So the request: Kill SDL window without killing SDL. Is it possible? How is
it done? If it isn’t possible… It’ll be my request for SDL1.3/2.0

Why? To save a handful of nanoseconds or a handful of bytes? Anyway, 1.3
supports multiple windows so the problem would be very different. Bob Pendleton

heh, actually, it isn’t about saving time. It was a convieniance feature FLTK
offered I was hoping to take advantage of. I guess I could do what you said, it
just seems redundant to do.

  1. initialize fltk window.
  2. initialize sdl video data.
  3. initialize drop down box with video data.
  4. let user do whatever.
  5. show sdl video
  6. kill sdl video

My hopes were to then loop back to the fourth procedure, but if I have to go all
the way back to the second, then that is what I’ll do.

I could store them too, true. And it would be less redundant.

It doesn’t cause any issues to call SDL_Quit, and then reinitialize shortly
after, or after at all, right?

So, copy and store the data, and Init and Quit SDL as needed.

Thanks for the reply! I think I got what I needed.

Bob Pendleton <bob pendleton.com> writes:

How many nanoseconds are you saving by doing that? Is the CPU time
saved by
this worth anyone enough to make this problem worth the timeneeded to
solve
it?Seriously, just get the pointer again when you restart SDL. Or, if that
just
isn’t possible then waste a few bytes of memory and store the whole table,
or
just the parts you need, and keep the copy around for as long as you need
it.
So the request: Kill SDL window without killing SDL. Is it
possible? How is
it done? If it isn’t possible… It’ll be my request for SDL1.3/2.0

Why? To save a handful of nanoseconds or a handful of bytes? Anyway, 1.3
supports multiple windows so the problem would be very different. Bob
Pendleton

heh, actually, it isn’t about saving time. It was a convieniance feature
FLTK
offered I was hoping to take advantage of. I guess I could do what you
said, it
just seems redundant to do.

Sorry, you hit a bit of a hot button. I teach programming and I have been a
programmer for 35 years. I can’t tell you the number of times I have seen
programmers, including myself, tie them selves up in knots trying to avoid
doing something twice in piece of code. It seems to be an instinct in people
who become programmers to want to avoid doing anything twice.

  1. initialize fltk window.
  1. initialize sdl video data.
  2. initialize drop down box with video data.
  3. let user do whatever.
  4. show sdl video
  5. kill sdl video

My hopes were to then loop back to the fourth procedure, but if I have to
go all
the way back to the second, then that is what I’ll do.

I could store them too, true. And it would be less redundant.

It doesn’t cause any issues to call SDL_Quit, and then reinitialize
shortly
after, or after at all, right?

No issue at all.

So, copy and store the data, and Init and Quit SDL as needed.

Yep.

Thanks for the reply! I think I got what I needed.

I’m glad to be of help.

Bob PendletonOn 2/20/08, Micah Brening <micah.brening at gmail.com> wrote:


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Bob Pendleton <bob pendleton.com> writes:

Sorry, you hit a bit of a hot button. I teach programming and I have been a
programmer for 35 years. I can’t tell you the number of times I have seen
programmers, including myself, tie them selves up in knots trying to avoid doing
something twice in piece of code. It seems to be an instinct in people who
become programmers to want to avoid doing anything twice.

I have to admit, that is what what happening. I was juggling function calls to
avoid calling somethings more than once. But after doing some opengl, I should
have realized that sometimes you have to call functions more than once to get
the correct results.

No issue at all.

I should have known that SDL would have been set up so that it knows when it is
actually initialized and when it isn’t. That was my error.

I set up the code to copy the information, and as soon as the user is done with
the video, it kills SDL. So your information worked perfectly.

Thanks again, and sorry for the stupid question.