Original Post
Hello!
I've only just started to learn SDL. I've got some previous knowledge on OpenGL from when i was in school (created a simple game in class).
Anyways I've followed Lazy Foo' Productions tuturial on SDL to become accustomed with the new functions ect. One of the mayor things i've notices in different is how you draw on the screen. If i understand this right i have to write a code similar to this to get a image to show in SDL:
[source lang="cpp"]SDL_Surface *screen = NULL;
SLD_Surface *image = IMG_load("hello.png);
SDL_BlitSurface(image, NULL, screen, NULL);
SDL_Flip(screen)// to update the scene[/source]
Now this isn't to hard if you've only got one file, i did however run into some problems when i added a Player class.
When i worked in C++/OpenGL all i had to do was to add stuff into the "renderScene" function which was easily done by doing this for example: "player.draw();" withing in renderScene function.
I am now stuck since i don't know how to transfer the image of my character (from the player class) into main to then get blitted onto the screen.
Could anyone give me some insight of how to tackle this problem? Seems much simpler in OpenGL to draw stuff to the scene.
Thanks in advance!
I've only just started to learn SDL. I've got some previous knowledge on OpenGL from when i was in school (created a simple game in class).
Anyways I've followed Lazy Foo' Productions tuturial on SDL to become accustomed with the new functions ect. One of the mayor things i've notices in different is how you draw on the screen. If i understand this right i have to write a code similar to this to get a image to show in SDL:
[source lang="cpp"]SDL_Surface *screen = NULL;
SLD_Surface *image = IMG_load("hello.png);
SDL_BlitSurface(image, NULL, screen, NULL);
SDL_Flip(screen)// to update the scene[/source]
Now this isn't to hard if you've only got one file, i did however run into some problems when i added a Player class.
When i worked in C++/OpenGL all i had to do was to add stuff into the "renderScene" function which was easily done by doing this for example: "player.draw();" withing in renderScene function.
I am now stuck since i don't know how to transfer the image of my character (from the player class) into main to then get blitted onto the screen.
Could anyone give me some insight of how to tackle this problem? Seems much simpler in OpenGL to draw stuff to the scene.
Thanks in advance!