Adding Graphics C++

Started by
8 comments, last by daviangel 15 years, 11 months ago
Alright, I think I have a sturdy base of C++, OOP, Classes, Functions, Types, etc.. But the thing I dont understand is how to add graphics, I've been told to use SFML and move on from Dev C++ to Visual C++ or Code::Blocks. Any other ideas on this or something I should be studying?
-A.K.A SteveGravity is unreliable-DTD
Advertisement
What is it exactly that you want to understand?

Both SDL and SFML have basic examples of how to at least get the graphical equivalent of "Hello, World!" up there, and both have an at least usable reference for the rest of their functions.
C++ has no support for graphics. The IDE you use doesn't change that.

If you want to do anything practical on graphics hardware, you will need to use one graphics libraries (it can be done without them, but it's painful).

These, for purposes of game development, include SDL, as well as direct use of OpenGL or DirectX. But either way, you'll need to pick one of the APIs or libraries, C++ itself doesn't matter in this case.
Quote:Original post by monkey4sale
But the thing I dont understand is how to add graphics...

The ability to add graphics to your programs is found in API's. API's are basically sets of functions which are used for a specific purpose. You are still coding in C++; the language does not change.

Quote:I've been told to use SFML and move on from Dev C++ to Visual C++ or Code::Blocks.

And they would be right, but for reasons not related to graphics. Those are IDE's; essentially, they are just interfaces which make it easier to program since they have syntax highlighting, etc. You can use any C++ IDE to make graphical programs with C++. That is, IDE's don't add any functionality to a language. The reason you want to not use Dev-C++ is that it is no longer supported, and hasn't been for years. My personal experience is that it is buggy at best and doesn't really conform to standards. Using Code::Blocks will give you a similar experience to Dev-C++ but with updates and support. I'd also recommend Microsoft Visual C++ Express Edition 2008. It is more professional, but to a beginner it might be harder to navigate. Just Google them - they are both free to download.

Quote:Any other ideas on this or something I should be studying?

Back to API's: I'd suggest using SDL. You can find out how to set it up and to use it with Lazy Foo's tutorials. It is a fairly beginner friendly API. SDL is used to set up a window and to do 2D graphical functions. Also, it is cross-platform, so if you happen to be using something besides Windows, it should still work.
Alright, i'll check out the tutorials, the issue im having is that i've never had a classroom environment to leanr C++, im self taught, and all of the books i've cheecked out have nothing beyond console based commands.

I want to figure out how exactly to move from consoles to graphical displays.
-A.K.A SteveGravity is unreliable-DTD
Both SDL and SFML have tutorial on their sites:
http://www.libsdl.org/tutorials.php
http://www.sfml-dev.org/tutorials/

As to which one you should use...
SDL is much older, so there's probably more learning materials around, and more experience people who can help you on forums like this one.
SFML is much more modern and designed specifically for C++ (whereas SDL is designed to be used by any language) so it might be a bit easier to learn if you're also learning C++.
use gdi ,gdi++, dx
Im trying to figure out SFML right now, Lazy foo's tutorials dont really help, I seem to be having issues migrating and turning the code jargon from the tutorials into an actual program, none of the tutorials build on each other(at least none of the earlier ones). Is there any tutorial that goes from beginning to end of a completed graphical game, such as tic tac toe? SFML seems simplier to understand but it also doesnt do much in terms of building an actual project, just a jumble of thoughts....
-A.K.A SteveGravity is unreliable-DTD
I've been using SDL with OpenGL and it has been great, no problems, and does everything. I use SDL to make the game window, keyboard + mouse input, image loading, sound, plus more. And it's portable so it's good. I've never heard of SFML actually lol.
Quote:Original post by monkey4sale
Im trying to figure out SFML right now, Lazy foo's tutorials dont really help, I seem to be having issues migrating and turning the code jargon from the tutorials into an actual program, none of the tutorials build on each other(at least none of the earlier ones). Is there any tutorial that goes from beginning to end of a completed graphical game, such as tic tac toe? SFML seems simplier to understand but it also doesnt do much in terms of building an actual project, just a jumble of thoughts....

I don't know about any free online sources that do that but I do own several books that start with a simple game and build upon it throughout the book. Game programming All In One uses Allegro to build a simple tankwar clone. Game Programming with Direct X in 21 days builds an Ultima RPG clone from start to finish. The Mike Morrison "Game Programming" book uses straight win32/GDI to build a simple 2D game engine which would let you make a graphical tictactoe game but with alot more work than using Allegro or SDL.

[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe

This topic is closed to new replies.

Advertisement