4

I know you can do the same in lrrlicht, but I want to use SDL code/ functions to draw text, images inside Irrlicht (to handle 2d) and use Irrlicht to do the hardcore 3D thing, how can you apply text or images from sdl to this Irrlicht Engine, can you show me simple code, so that I can understand?

In the SDL you can do such:

// I start by declare the SDL video Name
SDL_Surface *screen; 

//  set the video mode:
screen = SDL_SetVideoMode(640, 480, 32, SDL_DOUBLEBUF | SDL_FULLSCREEN); if (screen == NULL) { printf("Unable to set video mode: %s\n", SDL_GetError()); return 1; }

// I can now display data, image, text on the screen by using the declared SDL video Name " screen "

SDL_BlitSurface(my_image, &src, screen, &dest);
Sangeeth Saravanaraj
  • 16,027
  • 21
  • 69
  • 98
John
  • 107
  • 1
  • 4
  • 11
  • have you tried to join the sdl code with the irrlicht code without care about anything just to see what happen? – Gustavo Maciel Dec 28 '11 at 23:03
  • No, i'm playing with SDL now on mac, but before trying to mix' them, i want to know if that even possible and how the right way is... – John Dec 28 '11 at 23:08
  • I have worked a little with these 2 libraries, but one at a time lol. SDL works pretty well together with opengl. I think if you take an OpenGL-SDL implementation as example, you could get somewhere. – Gustavo Maciel Dec 28 '11 at 23:11
  • By the way, this should help too: http://stackoverflow.com/questions/1978883/how-to-use-sdl-with-ogre – Gustavo Maciel Dec 28 '11 at 23:13
  • I will take a look and see if i find a way – John Dec 28 '11 at 23:19

1 Answers1

0

If you are using / targeting Windows , and are a little familiar with the WinApi, you may be able to use SDL with Irrlicht by running both inside a Win32 Window, using a combination of the SDL Window ID Hack (also see this thread) and running Irrlicht in a Win32 Window. The only problems you may face is that running SDL in a Win32 Window is extremely difficult and unpredictable.

You may be also be able to achieve a similar result using GTK+ (for cross-platform purposes), but I have personally never succeeded in running SDL or Irrlicht in a GTK+ Window.

Also, if you want a light graphics and media library like SDL , may I suggest SFML. It can run in Win32 and X/11 windows without any problems and may easily work with Irrlicht.

ApprenticeHacker
  • 21,351
  • 27
  • 103
  • 153