View previous topic :: View next topic |
Author |
Message |
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Sun Nov 08, 2009 7:46 am Post subject: SDL 1.3 Teaser |
|
|
When SDL 1.3 is released, it is supposed to be branded SDL 2. It's a complete overhaul of SDL, with a new interface in addition to the internals. It provides for hardware acceleration via OpenGL, D3D, or whatever renderers are available on a given platform. It allows for smooth handling of multiple displays, creation of multiple windows (and the context management that requires), handling of different texture formats, and more. It's a real step up.
Once it is released, a new binding will go into the Derelict2 branch as DerelictSDL2. Since the interface seems to have fairly stabilized, I've already begun work on the new binding so that I can play around a bit. Here's a little teaser to give you an idea of just how different the new API is (using D2).
The following code queries the number of available video drivers, tells whether or not they work, and lists information about the renderers available for working drivers.
Code: |
module test.main;
import derelict.sdl2.sdl;
import std.stdio;
import std.conv;
void printRenderDriverInfo(int index)
{
SDL_RendererInfo info;
SDL_GetRenderDriverInfo(index, &info);
writefln("Render driver #%d:", index);
writefln("\t%s", to!string(info.name));
writef("\tmod_modes: %d\n\tblend_modes: %d\n\tscale_modes: %d\n", info.mod_modes, info.blend_modes, info.scale_modes);
writef("\tnum_texture_formats: %d\n\tmax_texture_width: %d\n\tmax_texture_height: %d\n", info.num_texture_formats, info.max_texture_width, info.max_texture_height);
}
int testVideoDriver(const char *drivername)
{
if(SDL_VideoInit(drivername, 0) == 0)
{
writefln("Driver %s works.", to!string(drivername));
int numdrivers = SDL_GetNumRenderDrivers();
writefln("Found %d render drivers.", numdrivers);
for(int i=0; i<numdrivers; ++i)
{
printRenderDriverInfo(i);
}
SDL_VideoQuit();
return 1;
}
else
{
writefln("Driver %s doesn't work.", to!string(drivername));
return 0;
}
}
void main()
{
DerelictSDL2.load();
if(SDL_Init(0) != 0)
{
throw new Exception("Failed to initialize SDL: " ~ to!string(SDL_GetError()));
}
scope(exit) SDL_Quit();
int numdrivers = SDL_GetNumVideoDrivers();
int working = 0;
for(int i=0; i<numdrivers; ++i)
{
const char* drivername = SDL_GetVideoDriver(i);
working += testVideoDriver(drivername);
}
writefln("\n%d video drivers total (%d work)", numdrivers, working);
} |
The output on my system is:
Quote: |
Driver win32 works.
Found 4 render drivers.
Render driver #0:
d3d
mod_modes: 3
blend_modes: 15
scale_modes: 7
num_texture_formats: 12
max_texture_width: 0
max_texture_height: 0
Render driver #1:
gdi
mod_modes: 2
blend_modes: 1
scale_modes: 1
num_texture_formats: 14
max_texture_width: 0
max_texture_height: 0
Render driver #2:
opengl
mod_modes: 3
blend_modes: 15
scale_modes: 3
num_texture_formats: 15
max_texture_width: 0
max_texture_height: 0
Render driver #3:
software
mod_modes: 3
blend_modes: 15
scale_modes: 1
num_texture_formats: 14
max_texture_width: 0
max_texture_height: 0
Driver dummy doesn't work.
2 video drivers total (1 work)
|
_________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
mutable
Joined: 22 Jun 2010 Posts: 87
|
Posted: Wed Dec 28, 2011 8:59 am Post subject: |
|
|
It is possible, that you offer the Beta Version of SDL 1.3?
And has it all functions who can found currently on the doku? |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|