Advertisement Jump to content
Sign in to follow this  
GrimV5

Creating classes with SDL library

This topic is 1880 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My only reason for asking this question is because in high school for a java project we had to use GridWorld and every class we made had to extend the Actor class in order to work properly.  Right now I am using C++ and the SDL library, and I have been trying to find as many resources as I can on it, but not all of the questions I have have been answered.  For now my only pressing concern is, when I create a class whether for a player character, npc, or an item, does that class need to extend from some SDL class like how in Gridworld every class had to extend from Actor?

Share this post


Link to post
Share on other sites
Advertisement

You don't need to in order to get things done with SDL. There might be a few classes in there that require this, but from my experience of making a character walk on the screen, I didn't need to.

 

The reason why I underlined need is simply because you probably can. I don't have a lot of experience with SDL so I don't know the structure of the classes, but you probably can inherit from some classes to make things easier/more clear.

Share this post


Link to post
Share on other sites

Well, SDL is a C library.  C doesn't have classes.  That should make the answer obvious.

 

If you're asking whether you should develop a massive rooted class hierarchy like Java requires, that's a different kettle of fish.  I don't recommend it but if it lets you finish your game because you can leverage the tool you already have and can focus on game writing instead of learning new techniques, it might be your best strategy.

Share this post


Link to post
Share on other sites

Well, SDL is a C library.  C doesn't have classes.  That should make the answer obvious.

 

If you're asking whether you should develop a massive rooted class hierarchy like Java requires, that's a different kettle of fish.  I don't recommend it but if it lets you finish your game because you can leverage the tool you already have and can focus on game writing instead of learning new techniques, it might be your best strategy.

 

Well, this. Shows how much I know about SDL. Probably mixed it up with SMFL I guess. :)

Share this post


Link to post
Share on other sites

Well, SDL is a C library.  C doesn't have classes.  That should make the answer obvious.

 

If you're asking whether you should develop a massive rooted class hierarchy like Java requires, that's a different kettle of fish.  I don't recommend it but if it lets you finish your game because you can leverage the tool you already have and can focus on game writing instead of learning new techniques, it might be your best strategy.

 

 

jup I can only agree. The only thing you could do, if you want  use classes, to create Wrapper classes for SDL. I do this often just for fun, but it helps alot if you want quick develop something with SDL and use classes. But that decision is up to you!!! You are completly free from what you are doing, but you have also the task to do all the work alone. ( I mean the work a managed language/framework do for you)

 

And I can suggest you SFML. It's a bit easier then SDL and do much more for you. you could say SDL is just a thin c like layer and SFML instead oop wall.

Edited by exOfde

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!