2009/11/2 Xzod
#1 is a planned feature, but would be implemented with the newer video API, not surfaces.
so this newer video API will allow to create custom none square main window ? (and will be able to interact with surfaces ?)
The renderer API does not work with surfaces directly, but you can
convert surfaces to textures, which do work, and you can get raw pixel
data through SDL_RenderReadPixels, which can be converted to a
surface.
Non-square / transparent / translucent windows are a planned feature,
but I have no idea how Sam plans to implement it. It’s unlikely to
use surfaces though, since surfaces are kinda being phased out or at
least separated from the rest of the video API.
hmmm this SDL_CreateWindowFrom isn’t in the wiki doc, how does it work to capture root desktop ?
It probably doesn’t. SDL_CreateWindowFrom converts a native window to
an SDL window, so that you can embed an SDL window in a larger
application for example. You could call SDL_CreateWindowFrom on the
root window, but because part of the conversion process involves
changing the window procedure, this is probably a bad idea. If there
were an API to create a read only SDL window from an existing native
window (where you could use SDL_RenderReadPixels but could not use
SDL_RenderWritePixels for example or receive events), then you could
probably get away with it.
Here’s the documentation for SDL_CreateWindowFrom:
SDL_WindowID SDL_CreateWindowFrom (
const void * data
)
Create an SDL window struct from an existing native window.
Parameters:
data A pointer to driver-dependent window creation data
Returns:
The id of the window created, or zero if window creation failed.
Warning:
This function is NOT SUPPORTED, use at your own risk!
See also:
SDL_DestroyWindow()
Though it’s not immediately obvious from the documentation, on
Windows, data is the window handle (HWND) for the window you want to
convert.