Jump to content

  • Log In with Google      Sign In   
  • Create Account


Creating classes with SDL library


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 GrimV5   Members   -  Reputation: 99

Like
0Likes
Like

Posted 26 November 2013 - 02:33 AM

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?



Sponsor:

#2 Rld_   Members   -  Reputation: 1329

Like
0Likes
Like

Posted 26 November 2013 - 02:54 AM

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.



#3 Bregma   Crossbones+   -  Reputation: 4741

Like
2Likes
Like

Posted 26 November 2013 - 07:43 AM

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.


Stephen M. Webb
Professional Free Software Developer

#4 Rld_   Members   -  Reputation: 1329

Like
0Likes
Like

Posted 26 November 2013 - 09:45 AM

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. :)



#5 exOfde   Members   -  Reputation: 807

Like
1Likes
Like

Posted 27 November 2013 - 04:23 AM

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, 27 November 2013 - 07:09 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS