Page 1 of 1
Question about sdl library usage??
Posted: October 2nd, 2014, 2:46 am
by salvadorc17
Hi, im learning basics of sdl and using it for my editor for the pop net, i want to know some things about sdl library usage, firts of all how to use it inside the editor window, becuase it creates a new window for the sdl surface...
-How to draw multiple tiles(images) at same time??
-How to update the tiles positions and how to use layers???
Re: Question about sdl library usage??
Posted: October 2nd, 2014, 11:10 am
by David
salvadorc17 wrote:
using it for my editor for the pop net
I suppose you mean your
Prince 2 xna editor in Chsarp.
That is, you're using C#.
salvadorc17 wrote:
how to use it inside the editor window, becuase it creates a new window for the sdl surface...
I found this:
http://www.gamedev.net/topic/464649-sdl ... try4062874
By the way, why do you want to use SDL for this?
Is there something you can't do with the tools in System.Drawing?
salvadorc17 wrote:
-How to draw multiple tiles(images) at same time??
Just draw them one by one.
salvadorc17 wrote:
-How to update the tiles positions
I'm not sure what do you mean here.
salvadorc17 wrote:
how to use layers???
SDL does not have built-in support for layers.
You can draw the images of the back layer first, and then the images of the front layer.
Re: Question about sdl library usage??
Posted: October 2nd, 2014, 3:45 pm
by Norbert
I also found the file segment of the URL mentioned there here:
http://www.matrix44.net/old/sdl_inside_winform.html
No idea if that code is useful in any way.
David wrote:salvadorc17 wrote:
-How to update the tiles positions
I'm not sure what do you mean here.
Maybe salvadorc17 means how to apply changes in response to user input (
events; keyboard, mouse).
salvadorc17, you can find several SDL tutorials here
http://lazyfoo.net/tutorials/SDL/ including information about
"Key Presses" and
"Mouse Events"
David wrote:By the way, why do you want to use SDL for this?
Is there something you can't do with the tools in System.Drawing?
If you use the .NET Framework to create a GUI (with the WinForms API), the question is why would you use another multimedia library (SDL) if the .NET Framework you are already using has a System.Drawing API.
If it's because you don't want to use proprietary technologies, you'd also have to replace the WinForms API with a free widget toolkit (like wxWidgets, QT or GTK+) or use images to create your own buttons and such.
If it's to tap into certain SDL(2) features that the .NET Framework does not (easily) offer, I guess it makes sense to work with SDL, but I doubt that's the case here.
Re: Question about sdl library usage??
Posted: October 2nd, 2014, 10:12 pm
by salvadorc17
Im asking about sld becuase i want to create a cross platform version of the editor, with the mono csharp, the image i show is for the windows testing, but i will use gtk + sdl to create the editor for windows/linux/mac.
Re: Question about sdl library usage??
Posted: October 3rd, 2014, 11:16 am
by David
I tried that, and it works.
(The code displays a window with a "Draw" button. Clicking on the button draws a 20x20 pixel red square, first at the top-left corner, after that 10 pixels down and right from the previous.)
In its original form, it needs
Tao Framework, but it can be rewritten for other bindings.
salvadorc17 wrote:
becuase it creates a new window for the sdl surface...
So you can already create an SDL window, right?
In the CreateSdlWindow() function, you can see how to move it into a panel within the main window.
Note that the "Retrieve the Handle to the SDL Window" part was written for SDL 1.2.
Under SDL 2 you need to do it a bit differently.
salvadorc17 wrote:
i will use gtk + sdl to create the editor for windows/linux/mac.
My question is again: Is there something that GTK (GDK, GdkPixbuf) can not do but SDL can?
Re: Question about sdl library usage??
Posted: October 3rd, 2014, 12:32 pm
by Norbert
David wrote:salvadorc17 wrote:
i will use gtk + sdl to create the editor for windows/linux/mac.
My question is again: Is there something that GTK (GDK, GdkPixbuf) can not do but SDL can?
Well, for one SDL2's 2D is automatically accelerated. I remember when I first tried SDL2 and
wrote on this forum that
"I already have SDL2 running and apoplexy is so much faster with SDL2". Just for fun, download apoplexy v1.9b (bottom of the page
here) and zoom the interface (press z), then quickly move your mouse over the tiles, either on the main screen or on the tiles screen. Then try the same with v2.1b or newer, which use SDL2.
The last time I
really used GTK+ was in 2000, so I don't know much about GTK's current feature set. However... SDL has joystick and game controller support including force feedback, multi-touch gesture support, surround sound support, audio in a separate thread, fullscreen that doesn't change videomodes, allows Alt+Tabbing out, and understands multiple displays. I doubt GTK (properly) does all that.
But it's an interesting question. GTK (and QT, wxWidgets) can draw graphics, so unless a developer really needs the speed or certain (low-level) features of SDL, there's no reason to use SDL.
Re: Question about sdl library usage??
Posted: October 3rd, 2014, 9:18 pm
by salvadorc17
My question is again: Is there something that GTK (GDK, GdkPixbuf) can not do but SDL can?
To clarify better im using this version of gtk:
http://www.mono-project.com/docs/gui/gtksharp/, that is csharp and not c++. By using it i need a sdl from tao.sdl to allow drawing tiles fast way, and to have other functionalities. This is why i think youre not understanding what version of the library im needing to allow draw into same gtk window, also as Norbert say, sdl2 is better, but im not using the c++ native implementation to have chance to use it...
Re: Question about sdl library usage??
Posted: October 21st, 2014, 12:26 am
by salvadorc17
Right now im testing and learn the basics of csharp sdl, im trying to draw a 2d tile engine with 3 layers, "for now using this advance wars sprites as example"
