Sign in to follow this  

2D Graphics/Game Library?

This topic is 4521 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

Hi all, I was just wondering if anyone can recommend an open source (cross platform) 2D graphics library that would be helpful in creating a 2D sprite/tile based game. I have found a lot of helpful 3D libraries, but I think I would like to start out with 2D. I once read (I forget where) that using OpenGL for a tile based game is often not the best way to do things. If you have any suggestions, please let me know. Thanks, Sam

Share this post


Link to post
Share on other sites
yes, sorry, I am talking about C/C++ (I can't decide which one I like better..)

SDL you say. Alright I will look into it. Performance wise it is alright?

Thanks for the suggestion.

Sam

Share this post


Link to post
Share on other sites
Like some of the above posters have mentioned, I'd say SDL. It is really good because it makes putting graphics onscreen a breeze. I read through 1 or 2 of the Cone3D tutorials and I was able to get a small sprite up on the screen that I could move around.

Share this post


Link to post
Share on other sites
Hmmm... that END_OF_MAIN() macro looks a little funny (Allegro) I am not sure what I think of trickery like this. I know SDL does something funny too with SDLmain. I have been using GLFW for OpenGL windowing etc... I like how it seems pretty standard.

Share this post


Link to post
Share on other sites
I have never seen anything like the END_OF_MAIN() before. Actually, it is the first time I have ever seen anything come after the main {}. I think it is some wanky MS Windows thing, but I am not sure what. I found it in the alwin.h header file, but I couldnt really follow what it was doing. I believe it has something to do with WinMain vs. main. I guess I don't really blame allegro as much as windows.

Sam

Share this post


Link to post
Share on other sites
I vote SDL sure it lacks primitve support that Allegro have, but instead you get a lightweight consistent API that simply doesn't surprise you by randomly changing paramater order and it does have a clear naming scheme.

Share this post


Link to post
Share on other sites
Quote:
Original post by swinchen
What about just using OpenGL? Would that work?
Yep, or even easier use SDL to create the window and handle input (all of about 10 lines of code) and stick OpenGL on top (rather than faff about with creating forms manually).

Share this post


Link to post
Share on other sites
Quote:
I once read (I forget where) that using OpenGL for a tile based game is often not the best way to do things. If you have any suggestions, please let me know.


I wouldn't totally agree with that statement. I use OGL for my 2D projects because you can easily rotate, scale, etc the quads you make. It's just a little tricky because you have to texture quads instead of blitting to the screen. I'd recommend starting with some SDL, getting comfortable in that, and then moving to OGL for its more advanced features. But that's just my opinion, its really up to you.

Share this post


Link to post
Share on other sites
Ok, so I have been doing a little reading over at wikipedia.org.

It looks like there is a difference between a sprite and blitting. Is it possible to blit a sprite?

Blitting looks like it uses a mask to "cut" holes in the background, and then copy the foreground image.

From what I understand a sprite works by subtracting a color (like magenta) and ... well that is about all I know about it.

So it seems like they are two differnt things.

Also I don't know how the depth of the sprites work... ground is on the bottom, character is top of ground, roof is above character .. etc.

So if I was doing this in OGL the two things I am not sure of is:
1) How to handle the transparency
2) How to handle the depth.

Thanks,

Sam

Share this post


Link to post
Share on other sites
Simple way to handle depth is by drawing order: ground.draw();house.draw();roof.draw();
If things are moving around you can sort by y value before drawing.

Share this post


Link to post
Share on other sites
All END_OF_MAIN() is, is a #define that makes sure your main function is compliant with whatever OS you're using. Seeing as Allegro is crossplatform this is actually a nice feature as far as im concerned. It means that you can compile an exe for DOS then take the same source and compile it for windows(that just means that #define WIN_32 has been done or that your compiler did that for ya) and without changing it get an exe for the correct platform. I loved allegro, great begginner library. I even spent quite awhile completing a clone of asteroids using it for gfx sound and input.

Share this post


Link to post
Share on other sites

This topic is 4521 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.

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