set up SDL2

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
BasicCoder2
Posts: 3205
Joined: Jan 01, 2009 7:03

Re: set up SDL2

Postby BasicCoder2 » Dec 27, 2017 5:13

paul doe wrote:The only thing that remains, then, is that he puts a little effort in learning how to make all of this work, don't you think?

In fact I spent all my spare time for over a week trying to get these examples working with code::blocks
http://www.grhmedia.com/tutorials_SDL2.html
The author George Hayes kindly exchanged emails with me until I had success. Now I have to study all the SDL2 code until it is second nature to me.
I was unable to follow his videos because the explanations came too fast and the pointer was all over the place. Videos are not how I would teach a subject. Apparently you get paid when people watch the video but not when they download a text tutorial. Also knowing a subject doesn't make you good at teaching a subject to beginners particularly when assumptions are made as to what they should already know. I see experienced programmers talking to a novice in the same terse cryptic jargon rich language they might use to explain something to their peer group.

Yes it is true I put as little work into how all this works as I need to but that is because I have limited time to learn it all and I just want to get on with actually writing code. That is the reason I used FreeBASIC. SCREENRES is very simple compared with the complex setup code I had to learn when using a window's API tutorials.
http://www.winprog.org/tutorial/start.html
I put a lot of effort into window api programming including using assembler code but it soon became clear the tutorials were not really showing how to find what you needed from the API documentation so if the tutorial didn't cover it you couldn't do it.

I need to get up to speed with SDL2 as I intend to use it in a project I am working on. It involves FreeBASIC and C++ thus my interest in using both with the SDL2 library.
paul doe
Posts: 549
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: set up SDL2

Postby paul doe » Dec 28, 2017 3:09

BasicCoder2 wrote:Yes it is true I put as little work into how all this works as I need to but that is because I have limited time to learn it all and I just want to get on with actually writing code. That is the reason I used FreeBASIC.

Ok then, that's fair enough. However, consider that time invested, not wasted. You'll gradually get better the more you practice, and eventually you'll be coding SDL with your eyes closed, but it will take time, there's no shortcuts in learning, unfortunately. Try to code one example yourself (if at all possible, one that isn't already coded =D), so as to hit some roadblocks (you'll never know how you'd have to pass them safely if you don't). Post the tutorial link here, and I'll do my best to help you. Agree?

PS: I absolutely hate video tutorials too, and try to avoid them as much as is humanly possible, so look for some nice example code, preferably written. But if it's a video, that's ok too.
BasicCoder2
Posts: 3205
Joined: Jan 01, 2009 7:03

Re: set up SDL2

Postby BasicCoder2 » Dec 28, 2017 22:55

paul doe wrote:Post the tutorial link here, and I'll do my best to help you. Agree?

All the compile problems seemed to come down to using the wrong dlls.
At this stage I am learning SLD2 using C++ so this is no longer the forum to post to.
Thanks for all you help for without it I probably would not have picked up on the problem being due to using the wrong dlls.
paul doe
Posts: 549
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: set up SDL2

Postby paul doe » Dec 29, 2017 1:21

BasicCoder2 wrote:All the compile problems seemed to come down to using the wrong dlls.
At this stage I am learning SLD2 using C++ so this is no longer the forum to post to.
Thanks for all you help for without it I probably would not have picked up on the problem being due to using the wrong dlls.

You're welcome. Feel free to shout if you need further assistance.
BasicCoder2
Posts: 3205
Joined: Jan 01, 2009 7:03

Re: set up SDL2

Postby BasicCoder2 » Dec 31, 2017 19:55

paul doe wrote: Feel free to shout if you need further assistance.


As I wrote I am at this stage learning SDL2 with C++ so I can't shout for help on this forum.
Once I feel comfortable with SDL2 and write some demo code maybe I will also write some FreeBASIC versions so maybe I will need help on that.

To be honest I have given up on FreeBASIC ever becoming a modern BASIC. FreeBASIC is essentially a BASIC syntax version of a reduced C++ with a graphics library thrown in and thus is library dependent for anything else. So I figure just treat it for what it is and learn to use a library. The big advantage with using a library like SLD2 is that it is the same for C++ and I see also for other languages like Python. Learn once use everywhere.
paul doe
Posts: 549
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: set up SDL2

Postby paul doe » Dec 31, 2017 23:45

BasicCoder2 wrote:As I wrote I am at this stage learning SDL2 with C++ so I can't shout for help on this forum.
Once I feel comfortable with SDL2 and write some demo code maybe I will also write some FreeBASIC versions so maybe I will need help on that.

No problem. Just ask.
BasicCoder2 wrote:To be honest I have given up on FreeBASIC ever becoming a modern BASIC. FreeBASIC is essentially a BASIC syntax version of a reduced C++ with a graphics library thrown in and thus is library dependent for anything else. So I figure just treat it for what it is and learn to use a library. The big advantage with using a library like SLD2 is that it is the same for C++ and I see also for other languages like Python. Learn once use everywhere.

Welcome to the world of portability =D

If you can get comfortable and proficient with C++ just stick to it, there's really nothing to be gained by using FreeBasic at that point. I code in FreeBasic mostly out of nostalgia (and other reasons that I won't state here), but the compiler is, to this day and age, still too barebones. I'm currently coding a little object framework that can be used as a codebase (much like the .NET framework) but without unnecessary bloat, just the bare minimum to get the ball rolling. It adds a little overhead, sure, but the gain in flexibility more than compensates.
BasicCoder2
Posts: 3205
Joined: Jan 01, 2009 7:03

Re: set up SDL2

Postby BasicCoder2 » Jan 03, 2018 20:02

paul doe wrote:If you can get comfortable and proficient with C++ just stick to it, there's really nothing to be gained by using FreeBasic at that point.

I was using C++ 9 years ago (how time passes!!) when I decided FreeBASIC was an easier way write visual processing programs so I am familiar with the C++ language although I never got to use some of its more advanced and abstract capabilities. Probably it was a mistake to learn FreeBASIC and I should have stuck with C++. Unlike FreeBASIC it was probably more likely I would find other C++ programmers with similar interests.

I code in FreeBasic mostly out of nostalgia (and other reasons that I won't state here), but the compiler is, to this day and age, still too barebones.

I have in the recent past asked why many of the posters to this forum who are proficient in C++ and probably other languages choose to use FreeBASIC without getting any convincing replies.

The idea of writing a program to translate my FreeBASIC programs to C++ interests me. Because my FB programs up to now have not used the SDL library it might be difficult. I can see translating something like,

Code: Select all

screenres 640,480,32

would be simple, just write a C++ function called screenres. Perhaps when I am more familiar with SDL I will be able to write a program that would automatically translate things like,

Code: Select all

screenres 640,480,32
dim as any ptr image
image = imagecreate(640,480)
for j as integer = 0 to 479
  for i as integer = 0 to 639
    pset image,(i,j),rgb(int(rnd(1)*256),int(rnd(1)*256),int(rnd(1)*256))
  next i
next j
put (0,0),image,trans
sleep

into C++ code that uses SDL for images.
paul doe
Posts: 549
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: set up SDL2

Postby paul doe » Jan 03, 2018 20:41

BasicCoder2 wrote:
paul doe wrote:If you can get comfortable and proficient with C++ just stick to it, there's really nothing to be gained by using FreeBasic at that point.

I was using C++ 9 years ago (how time passes!!) when I decided FreeBASIC was an easier way write visual processing programs so I am familiar with the C++ language although I never got to use some of its more advanced and abstract capabilities. Probably it was a mistake to learn FreeBASIC and I should have stuck with C++. Unlike FreeBASIC it was probably more likely I would find other C++ programmers with similar interests.

The C/C++ world (we frequently lump those together, but they're very different beasts!) is a wide one. You'll find hobbists like you and me, and professionals of many areas. It's very exciting and daunting, but you'll learn a lot. Dive on!
BasicCoder2 wrote:
I code in FreeBasic mostly out of nostalgia (and other reasons that I won't state here), but the compiler is, to this day and age, still too barebones.

I have in the recent past asked why many of the posters to this forum who are proficient in C++ and probably other languages choose to use FreeBASIC without getting any convincing replies.

Coding in FB (as much as coding the FB compiler itself) is a labor of love. There's not much more to say, don't you think? ;)
BasicCoder2 wrote:The idea of writing a program to translate my FreeBASIC programs to C++ interests me. Because my FB programs up to now have not used the SDL library it might be difficult. I can see translating something like,

Code: Select all

screenres 640,480,32

would be simple, just write a C++ function called screenres. Perhaps when I am more familiar with SDL I will be able to write a program that would automatically translate things like,

Code: Select all

screenres 640,480,32
dim as any ptr image
image = imagecreate(640,480)
for j as integer = 0 to 479
  for i as integer = 0 to 639
    pset image,(i,j),rgb(int(rnd(1)*256),int(rnd(1)*256),int(rnd(1)*256))
  next i
next j
put (0,0),image,trans
sleep

into C++ code that uses SDL for images.

It all boils down to get the know-how to write the equivalent constructs in whatever language/library you want to use. Once you have it, you can code freely. Keep pushing! =D

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 1 guest