Ok, a little background. I am a 13 year old guy who's been using Windows computers for 4 years for general stuff and hardcore gaming. My natural interest in computers attracted me to the idea of coding. It's a very overwhelming idea to me, I first became motivated after seeing the Code.org commercial on youtube, and then I started learning HTML, wasn't my thing, then took up C++ knowing it is a fundamental.
I just finished learning what cout and cin does and I am flipping out on the mechanics of it, projecting cin to x, to assign a variable, then say x which will then transfer to what you just said. IT'S GENIUS! I understand, after some studying, the lines of code in the Hello World program, and I'm taking a tutorial class thing online. But when I see lines of code in, for example, Runescape botting scripts or Minecraft plugin scripts it's very confusing for me. How do you link something up with an image? How do you even create a game? I guess it's just all very new for me, but how do you guys deal with it? How should I do this and that is my question, it feels I've just learned a very small piece of a very giant puzzle.
My advice: get a game lib and start cracking. The best way to learn is to do.
Graphics are easily accomplished with a game lib. I personally recommend SFML. It might be a little difficult to set up, but it's a very good library that is powerful and easy to use. Get the latest 2.0 release (don't get 1.6)
// Create a 640x480 window, titled "My First Game"
sf::RenderWindow mainWindow( sf::VideoMode(640,480), "My First Game" );
// limit display output to 60 fps
mainWindow.setFramerateLimit( 60 );
// Load a texture (an image file)
// put that texture in a "Sprite" - ie something that actually gets drawn to the screen
// (these are separated because multiple sprites can use the same texture -- you do
// not want to have multiple copies of the same texture loaded in memory)
// start the game loop! Game to keep running as long as this boolean is true
bool rungame = true;
while( rungame )
// Process any user/os messages/events
while( mainWindow.pollEvent( evt ) ) // as long as there are events to process... keep processing them
switch( evt.type ) // what type of event is it?
case sf::Event::Closed: // it's a "close" event - the user wants to exit the program
rungame = false; // so mark our boolean to shut down the program
// other events we don't care about
// Now that we're done with events, let's check the keyboard state and see if the
// player wants to move around
if(sf::Keyboard::isKeyPressed( sf::Keyboard::Up )) // is the "up" key pressed?
sprite.move( 0, -1 ); // if yes, move our sprite up 1 pixel
if(sf::Keyboard::isKeyPressed( sf::Keyboard::Down ))// is the "down" key pressed?
sprite.move( 0, 1 ); // then move our sprite down 1 pixel
// Now that user input has been processed... render a scene
mainWindow.clear(); // wipe the screen clear
mainWindow.draw(sprite); // draw our sprite
mainWindow.display(); // display our generated image (makes it actually visible to the user)
// Since we also set a framerate limit above... display() will also wait 1/60th of a second, ensuring
// that the above logic runs at a fixed rate. (you don't have to worry about faster computers running
// faster -- all machines will run at an even 60 fps.
// the while loop ends here... so the program will just keep looping until the user decides to quit
// That's it!
SFML is a game lib. It's a series of functions and classes that you can use to do something. In this case, it can be used to draw graphics, get realtime keyboard and gamepad input, play audio, etc, etc.
It would help me to give advise if I knew what program your using to make your programs. I'm old, so i learned command line, I like command line and I use it very well. Someday I may learn visual C++, and hope to, but today I use mostly command line stuff.
I'm not sure if it's easier to go from command line into visual C++ programming or not but I do think it's easier to understand starting out programming.
A lot of the post people make here are high school and college students taking classes, look at all their post and learn what they are learning.
When I started out, my motive was to see my creation come to life on the screen. I had ambition to do something that I found interesting, and hopefully those around me would notice. It seems everyone wants to learn programming as a method to create games. I'm one of those people, as games are a great test of skill. Great goal, however, a full on game is much harder than it seems. I find myself starting up with many ideas and learning as I go. Looking up concepts and how-tos, making test programs to practice in isolation from my main game. I still find GUI's extremely hard to get into, but it might just be because I don't like using pre-made code. (but I mean that's the point of libraries right). While I'm learning I like to get in touch with basics and build upon them.