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???
Question about sdl library usage??
-
- Calif
- Posts: 553
- Joined: August 27th, 2011, 2:04 am
Question about sdl library usage??
Check my Prince in C# https://github.com/salvadorc17/Prince-Monogame
Re: Question about sdl library usage??
I suppose you mean your Prince 2 xna editor in Chsarp.salvadorc17 wrote: using it for my editor for the pop net
That is, you're using C#.
I found this: http://www.gamedev.net/topic/464649-sdl ... try4062874salvadorc17 wrote: how to use it inside the editor window, becuase it creates a new window for the sdl surface...
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?
Just draw them one by one.salvadorc17 wrote: -How to draw multiple tiles(images) at same time??
I'm not sure what do you mean here.salvadorc17 wrote: -How to update the tiles positions
SDL does not have built-in support for layers.salvadorc17 wrote: how to use 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??
I also found the file segment of the URL mentioned there here:David wrote:I found this: http://www.gamedev.net/topic/464649-sdl ... try4062874salvadorc17 wrote: how to use it inside the editor window, becuase it creates a new window for the sdl surface...
http://www.matrix44.net/old/sdl_inside_winform.html
No idea if that code is useful in any way.
Maybe salvadorc17 means how to apply changes in response to user input (events; keyboard, mouse).David wrote:I'm not sure what do you mean here.salvadorc17 wrote: -How to update the tiles positions
salvadorc17, you can find several SDL tutorials here http://lazyfoo.net/tutorials/SDL/ including information about "Key Presses" and "Mouse Events"
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.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 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.
-
- Calif
- Posts: 553
- Joined: August 27th, 2011, 2:04 am
Re: Question about sdl library usage??
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.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?
Check my Prince in C# https://github.com/salvadorc17/Prince-Monogame
Re: Question about sdl library usage??
I tried that, and it works.Norbert wrote: 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.
(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.
So you can already create an SDL window, right?salvadorc17 wrote: becuase it creates a new window for the sdl surface...
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.
My question is again: Is there something that GTK (GDK, GdkPixbuf) can not do but SDL can?salvadorc17 wrote: i will use gtk + sdl to create the editor for windows/linux/mac.
Re: Question about sdl library usage??
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.David wrote:My question is again: Is there something that GTK (GDK, GdkPixbuf) can not do but SDL can?salvadorc17 wrote: i will use gtk + sdl to create the editor for windows/linux/mac.
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.
-
- Calif
- Posts: 553
- Joined: August 27th, 2011, 2:04 am
Re: Question about sdl library usage??
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...My question is again: Is there something that GTK (GDK, GdkPixbuf) can not do but SDL can?
Check my Prince in C# https://github.com/salvadorc17/Prince-Monogame
-
- Calif
- Posts: 553
- Joined: August 27th, 2011, 2:04 am
Re: Question about sdl library usage??
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"


Check my Prince in C# https://github.com/salvadorc17/Prince-Monogame