FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SDL 1.3 Teaser

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sun Nov 08, 2009 7:46 am    Post subject: SDL 1.3 Teaser Reply with quote

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
View user's profile Send private message Send e-mail
mutable



Joined: 22 Jun 2010
Posts: 87

PostPosted: Wed Dec 28, 2011 8:59 am    Post subject: Reply with quote

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
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Thu Dec 29, 2011 10:07 pm    Post subject: Reply with quote

No, not yet. I'm still waiting for the API to be finalized.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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