Archived

This topic is now archived and is closed to further replies.

Noro

2D Overhead Game Programming...?

Recommended Posts

Noro    122
Okay, again, this post may seem incredibly stupid and have you rolling off your chair in laughter at my extreme disability. (Hey, I was voted to be the President of the Committee of Slow Children, you know...) However, I read and absorb whatever I can, and more than one tutorial has said to "start building with a text RPG and then graduate up to a simple 2D system." Well, I''m to the 2D system. My question is, however, what would you suggest using to make this 2D system? I''ve built a simple RPG with 2D overhead view graphics back in the day with QBasic with the functions defaulted into the language. I''m not trying to go for speed and such in this practice run. I was going to try to use some C++ default pixel-placing commands (similar to QB''s PSET that I used), but all tutorials/source codes/info for it require to include a Graphics.h? I don''t seem to have that with my VC++ 6.0. Now, enough of my rambling. My point is simply this: I''m trying to learn basic map storing/loading information and such, and I would really like to try to with the basic C++ graphics system. I don''t care about speed right now. Any suggestions as to where I can get the Graphics.h or WHY I don''t have the header file? If not, what would be the best suggestion for this 2D engine, in your personal opinion? [ I have fiddled around with OpenGL a little bit, so I''m not a total idiot. :9 ] Any help, again, is totally and completely appreciated.

Share this post


Link to post
Share on other sites
micepick    122
C++ has absolutely no standard graphics. I'm not sure what "Graphics.h" this is, but it's either a header file that's part of each individual project, or it's some graphics system for a certain compiler (not MSVC++).

EDIT: Ah, yes, graphics.h is an old DOS header. You can't use it with Windows.

You could use DirectX or SDL to make 2D graphics. Depending on how much OpenGL you've played around with, it might be best to use that. Otherwise, I would recommend SDL just because it's simple.

[edited by - micepick on April 29, 2003 10:13:41 PM]

Share this post


Link to post
Share on other sites
Noro    122
Wow. Speedy posters here.

I was first thinking that Graphics.h was an individual header, but I noticed it came up again and again, so I was totally baffled.

Also, in OpenGL, I think I remember playing around and finding the.. glVertex2f() function? Something like that! (Sorry if it's totally off on that.) That sounds like something I should be interested in. Am I correct in assuming? (Hah, I'm more newbie-ish than I originally thought. .__. );

[Edit:] If I wanted to attempt making a simple 2D overhead in a console, is that a ridiculous idea? I'm so used to the old QBasic ways and felt more at home with it in graphics than in windows.

My suspect is that it's not included anymore, so it's totally obsolete and pointless? I should just keep with Windows, eh?

[edited by - Noro on April 29, 2003 10:16:00 PM]

Share this post


Link to post
Share on other sites
CaptainJester    523
graphics.h is part of the Borland compiler. I would suggest using SDL or DirectDraw to do your 2D. Some people suggest to use the newer Direct3D to do the 2D stuff, but DirectDraw may be easier to understand. Anyway if you want to use DirectDraw, you need to find a tutorial on DirectX v7 or older. The base SDL is 2D. Some people find it easier to use than DirectDraw. You can find SDL here.



First make it work,
then make it fast.

--Brian Kernighan

"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book

Share this post


Link to post
Share on other sites
micepick    122
Yeah, it might actually be better not to use OpenGL. It has no inherent support for sprites, so you'd have to do some extra work setting that up with 2D textured quads. As I mentioned, SDL is a great library because it's pure 2D and extremely simple.

Drawing graphics in a console isn't easy anymore. Just move on to basic Windows programming; it doesn't take any effort to set up a basic window to draw on. Most basic graphics tutorials set that up for you.

[edited by - micepick on April 29, 2003 10:18:58 PM]

Share this post


Link to post
Share on other sites
Noro    122
Okay, thank you for the speedy assistance. You've both given me a wonderful view of this forum already, and I only just joined today. First impressions are quite important, and you've both helped to set them very well. :D

[Edit, again..]: Thank you, ZealousElixer. :D Thank you for posting. I think I'll look into what you said. Sounds like a plan to me.

[edited by - Noro on April 29, 2003 10:26:03 PM]

Share this post


Link to post
Share on other sites
ZealousElixir    256
Yeah, glVertex2f would be pretty important for low-end 2D drawing

If you're interested in pixel-wise graphics like you might do with QuickBasic, you may wish to look into Windows GDI, which is the build-in graphics API of Windows.

For more centralized tutorials, you may want to start with NeHe's OpenGL tutorials. Most OGL or D3D tutorials you see will focus more on 3D, since that's what they're designed for, but searches will turn up useful 2D info. Just be prepared to spend a little more time learning the API before you get into the actual games part.

Most routes you take will lead you through basic Win32 programming before you even get to graphics, so be patient with the transition of foundations. Only move on when you're fairly sure of yourself on a particular topic.

EDIT: As some have said, a 3D API may not be the best choice. I've never used SDL, but it has some pretty rabid fans, so it might be worth a look.

Best of luck,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links


[edited by - zealouselixir on April 29, 2003 10:21:59 PM]

Share this post


Link to post
Share on other sites
evillive2    779
If your not worried about speed and you just want to use pixel plotting functions and such, Windows GDI might be a good place to start looking before you go into DirectX, OpenGL etc... Using GDI familiarizes you with all sorts of useful things that just become easier when you move on to other APIs like DirectDraw or SDL. Also, basic knowledge of GDI can come in handy for writing your own bitmap/image loading and saving routines. IMHO a basic knowledge of GDI is just very useful in windows programming and at the very least makes learning other graphics APIs that much easier.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Hi, people. May I ask if sprites and transparent colors can be implemented in GDI? I know a tiny bit about Win32 API and the Blt function. If someone can outline the API calls, or point me to a tutorial somewhere, that''ll be great.

Noro, given my question above, I''d recommend using DirectDraw from DirectX. However, if you''re want to actually draw the pictures (rather than loading bitmaps), then learning the GDI will suffice. It will also give you a good foundation for learning graphics API''s.

Share this post


Link to post
Share on other sites