Hidding the windowtitle

Is their a way to hide the windows title bar, and
use your own titlebar. I would have to be able
to access the window position structure ( so I can
move the window ) , but have no knowledge of
windows programming.

Can anyone help?

I can help with getting rid of the title bar. Just or SDL_NOFRAME with
the flags in SDL_SetVideoMode(). Setting and getting the Windows
position would require some calls to the Windows OS (or whatever OS
you’re using) and that’s not so much beyond my knowledge as it’s not in
my memory banks right now.–
Lilith

On 1/13/2007 at 8:38 PM, Kevin Macey wrote:
Is their a way to hide the windows title bar, and
use your own titlebar. I would have to be able
to access the window position structure ( so I can
move the window ) , but have no knowledge of
windows programming.

Can anyone help?


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

I’m using SDL_Image to load heightmap data for a terrain engine, encoding that data in both the red and green color channels, because I need a height range of greater then 256. The code I used to fetch a pixel was:

uint32 srcPixel = (uint32)((uint8*)surf->pixels+(i*surf->format->BytesPerPixel));

where “surf” is the surface from IMG_Load, and “i” is the index of the pixel to be grabbed. I got very strange results when I ran the program, though. Analyzing them in detail, it appeared that every row had an addition byte of padding at the end. For my initial test, I used an image that only had data in the green channel, and the result was that only every third row actually had data in it, because the other two rows were offset one byte, shuffling the color channels. I fixed it by changing it to:

if (i != 0 && i % xres == 0) offset++;
uint32 srcPixel = (uint32)((uint8*)surf->pixels+(i*surf->format->BytesPerPixel+offset));

Of course, there was also a “uint32 offset = 0;” outside the loop. Once I made this change, the code worked perfectly.

However, I remain rather confused why this extra byte is appearing there. I’ve used SDL_Image to load images for a lot of projects in the past, and I’ve experienced this padding before. Does anybody know what could cause that?

Mike Powell wrote:

uint32 srcPixel =
(uint32)((uint8*)surf->pixels+(i*surf->format->BytesPerPixel));

However, I remain rather confused why this extra byte is appearing
there. I’ve used SDL_Image to load images for a lot of projects in
the past, and I’ve experienced this padding before. Does anybody know
what could cause that?

Usually rows are padded to a multiple of 4 bytes because 4-byte-aligned
stuff is what the usual 32-bit processors can access most efficiently.
But don’t rely on that number, rows may be padded to any length. The
proper way to deal with this is to use the “pitch” field: Pixel (x,y) is
located at (Uint8*)surf->pixels + ysurf->pitch +
x
surf->format->bytesPerPixel.

-Christian

Christian Walther wrote:

Mike Powell wrote:

uint32 srcPixel =
(uint32)((uint8*)surf->pixels+(i*surf->format->BytesPerPixel));

However, I remain rather confused why this extra byte is appearing
there. I’ve used SDL_Image to load images for a lot of projects in
the past, and I’ve experienced this padding before. Does anybody know
what could cause that?

Usually rows are padded to a multiple of 4 bytes because 4-byte-aligned
stuff is what the usual 32-bit processors can access most efficiently.
But don’t rely on that number, rows may be padded to any length. The
proper way to deal with this is to use the “pitch” field: Pixel (x,y) is
located at (Uint8*)surf->pixels + ysurf->pitch +
x
surf->format->bytesPerPixel.

Ah, I suppose that makes sense. I imagine I never encountered that before because I’ve always worked with images that had 4 bytes per pixel, or 1 byte per pixel with power-of-2 dimensions. Somehow I didn’t imagine it would adding padding for this at the row edges, since the pixels are all stored in a big 1-dimensional array anyway, but knowing that’s how it works it’s easy to deal with. Thanks.

to get the window position in windows you would have to do
it like that:

SDL_SysWMinfo sysWMInfo;
SDL_GetWMInfo(&sysWMInfo);
RECT rWindow;
GetWindowRect(sysWMInfo.window, &rWindow);

cant verify atm but that shoudl do the trick.

Also how would I resize the windows window.
Allowing me to implement shading support.
where it resizes to just the size of the
titlebar when the mouse leaves the window
area.

Thanks for any help ahead of time
Kevin

Benjamin Sonnemann wrote:> to get the window position in windows you would have to do

it like that:

SDL_SysWMinfo sysWMInfo;
SDL_GetWMInfo(&sysWMInfo);
RECT rWindow;
GetWindowRect(sysWMInfo.window, &rWindow);

cant verify atm but that shoudl do the trick.

I’m getting a problem compiling similar code related
to this, that uses the SetWindowPos() function and
I also had similar errors getting the code
you submitted compiling.

attached are the error logs and the
main window source file.

Trying to make a movable, shadable , resizable
windows window that uses my alternate
gui lib, the source is a test of the
replacement titlebar and border.

Any help will be appreciated.

  • Kevin

Benjamin Sonnemann wrote:

to get the window position in windows you would have to do
it like that:

SDL_SysWMinfo sysWMInfo;
SDL_GetWMInfo(&sysWMInfo);
RECT rWindow;
GetWindowRect(sysWMInfo.window, &rWindow);

cant verify atm but that shoudl do the trick.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: ERRORS.TXT
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070212/22779b26/attachment.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: testing-main-window.c
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070212/22779b26/attachment.asc