Sign in to follow this  
Crusable77

OOP and SDL problems

Recommended Posts

Crusable77    594
Hello, i am trying to setup a class for handling everything in my program so that the my main.cpp isn't cluttered. However i have some SDL_Surfaces that i need to use in different member functions of the class, but the program crashed when i defined them in the class and then initialize them in the constructor. So i initialize them in the class as const static SDL_Surfaces; I still got an error saying i need to have a const member to initialize them in the class. Could someone please show me a different method, or fix my method. Thanks Edited by Mathew Bergen

Share this post


Link to post
Share on other sites
fastcall22    10838
[quote name='Mathew Bergen' timestamp='1354168981' post='5005203']
... but the program crashed when i defined them in the class and then initialize them in the constructor. So i initialize them in the class as const static SDL_Surfaces; I still got an error saying i need to have a const member to initialize them in the class....[/quote]
Sounds to me like you're attempting to use SDL before initializing SDL.

Share this post


Link to post
Share on other sites
Crusable77    594
I initialized it in my constructor, but when the SDL_Surfaces are in the constructor it cannot find them through tho rest of the class, that's why i need help, i'm not sure what to do to fix it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this