Hi,
I would like to create an SDL surface as a child window in a Win32 app.
So that I can create level editors, sprite editors etc using game engine
code to blit to the child window surface. I have seen the GTK SDL
Widget project and i’m looking for something similar for Windows. Does
anyone know/have any ideas on the best way of doing this?, perhaps there
is an existing project? or maybe some existing internal SDL Win32GDI
functions can help?
Thanks,
Tom W wrote:
Hi,
I would like to create an SDL surface as a child window in a Win32 app.
So that I can create level editors, sprite editors etc using game engine
code to blit to the child window surface. I have seen the GTK SDL
Widget project and i’m looking for something similar for Windows. Does
anyone know/have any ideas on the best way of doing this?, perhaps there
is an existing project? or maybe some existing internal SDL Win32GDI
functions can help?
Thanks,
You want multiple windows, which SDL sadly does not support. It’s
possible to hack it, but it ain’t pretty.
At 11:46 24/02/2003 -0500, you wrote:
Tom W wrote:
Hi,
I would like to create an SDL surface as a child window in a Win32 app.
So that I can create level editors, sprite editors etc using game engine
code to blit to the child window surface. I have seen the GTK SDL
Widget project and i’m looking for something similar for Windows. Does
anyone know/have any ideas on the best way of doing this?, perhaps there
is an existing project? or maybe some existing internal SDL Win32GDI
functions can help?
Thanks,
You want multiple windows, which SDL sadly does not support. It’s possible
to hack it, but it ain’t pretty.
Speed is not critical, since it’s just for editors. So I was thinking of
creating an SDL surface in memory for each child window which can be
blitted to using standard SDL blit routine, then the SDL surface for each
child window is copied into a HBITMAP every time WM_PAINT is called.
My initial attempts at this have only been partially successful, the
colours in the HBITMAP do not come out properly, everything has a blue
’hue’. I think maybe it’s because I have to specify a palette in the
bmiColors member of the BITMAPINFO structure. I don’t have much experience
with Windows GDI though. So if anyone has a good method for getting SDL
Surface data onto a HDC/into a HBITMAP, then I would like to know
Hi,
my advise is to use GDI for a tool. When I did some windowed DirectX a long
time ago and I found out be messing around with clipping problems etc.
Unless you want fancy effects in your editor, I don’t think it’s much effort
to switch to GDI.
But, to answer you question of putting pixels (not API specific) into a
HBITMAP, you might find it here:
http://www.2dgame-tutorial.com/Tutorial_bmp_win.htm
Patrick.> ----- Original Message -----
From: t.wilson@hazid.com (Tom Wilson)
To:
Sent: Monday, February 24, 2003 6:33 PM
Subject: Re: [SDL] Re: SDL Surface as a child window Win32
At 11:46 24/02/2003 -0500, you wrote:
Tom W wrote:
Hi,
I would like to create an SDL surface as a child window in a Win32 app.
So that I can create level editors, sprite editors etc using game engine
code to blit to the child window surface. I have seen the GTK SDL
Widget project and i’m looking for something similar for Windows. Does
anyone know/have any ideas on the best way of doing this?, perhaps there
is an existing project? or maybe some existing internal SDL Win32GDI
functions can help?
Thanks,
You want multiple windows, which SDL sadly does not support. It’s
possible
to hack it, but it ain’t pretty.
Speed is not critical, since it’s just for editors. So I was thinking of
creating an SDL surface in memory for each child window which can be
blitted to using standard SDL blit routine, then the SDL surface for each
child window is copied into a HBITMAP every time WM_PAINT is called.
My initial attempts at this have only been partially successful, the
colours in the HBITMAP do not come out properly, everything has a blue
’hue’. I think maybe it’s because I have to specify a palette in the
bmiColors member of the BITMAPINFO structure. I don’t have much
experience
with Windows GDI though. So if anyone has a good method for getting SDL
Surface data onto a HDC/into a HBITMAP, then I would like to know
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Hi,
I would like to create an SDL surface as a child window in a Win32 app.
So that I can create level editors, sprite editors etc using game engine
code to blit to the child window surface. I have seen the GTK SDL
Widget project and i’m looking for something similar for Windows. Does
anyone know/have any ideas on the best way of doing this?, perhaps there
is an existing project? or maybe some existing internal SDL Win32GDI
functions can help?
Thanks,
I have now solved this problem. Thanks.
Could you post how you did? T’is a highly common question, and I’ve yet to
see an answer.On Wednesday 05 March 2003 10:38 am, Tom wrote:
Hi,
I would like to create an SDL surface as a child window in a Win32 app.
So that I can create level editors, sprite editors etc using game engine
code to blit to the child window surface. I have seen the GTK SDL
Widget project and i’m looking for something similar for Windows. Does
anyone know/have any ideas on the best way of doing this?, perhaps there
is an existing project? or maybe some existing internal SDL Win32GDI
functions can help?
Thanks,
I have now solved this problem. Thanks.
> >
> > I have now solved this problem. Thanks.
> >
> >
> > - Tom.
>
> Could you post how you did? T'is a highly common question, and I've yet to
> see an answer.
Yes, I will tidy up the source and post the entire thing as GPL later
this week. It’s a platform specific solution, i.e it will only work on
win32. But it allows you to create multiple child windows and blit from
one SDL_Surface to the child window using SDL_BlitSurface. So you don’t
have to modify existing code (hopefully/much) to use the windows.
For example you may want a couple of windows in an editor that let you
choose a tile to go on a map etc. It’s probably too slow to run a game
in on of the windows, because it involves some GDI stuff, it mimics the
GDI functions in SDL DIB video. And when I say slow, I don’t mean
sloooooowwwww I mean slow in terms of games performance, because it’s
blitting from one surface to another and then onto the child window’s
HDC.
Tom W wrote:
> >
> > I have now solved this problem. Thanks.
> >
> >
> > - Tom.
>
> Could you post how you did? T'is a highly common question, and I've yet to
> see an answer.
Yes, I will tidy up the source and post the entire thing as GPL later
this week. It’s a platform specific solution, i.e it will only work on
win32. But it allows you to create multiple child windows and blit from
one SDL_Surface to the child window using SDL_BlitSurface. So you don’t
have to modify existing code (hopefully/much) to use the windows.
For example you may want a couple of windows in an editor that let you
choose a tile to go on a map etc. It’s probably too slow to run a game
in on of the windows, because it involves some GDI stuff, it mimics the
GDI functions in SDL DIB video. And when I say slow, I don’t mean
sloooooowwwww I mean slow in terms of games performance, because it’s
blitting from one surface to another and then onto the child window’s
HDC.
I have now posted the source for my solution under the GPL at
http://www.polplex.co.uk/~tigger/sdl
HTH