Working with graphics

So I've been learning c++ for some time now, and I'm really waiting for the use of graphics. Back when I used Game Maker, I would create my own sprites in Photoshop and import them. However, I'm having a really hard time understanding graphics libraries; it seems like, from stuff I've read, you tell the libraries what to draw. How advanced is using graphics, because I would think that using sprites was one of the most simple things you can do, but that's obviously not the case. I made some images in Photoshop, among them are a Tetrion(The boarder in a Tetris game), and the Tetriminos(The pieces in a Tetris game). Now, assuming I knew the code of a Tetris game, which I don't, how would I use those images?

I read another forum post where some guy claimed to have been learning c++ for a year and still hasn't started learning how to use graphics yet. Is that seriously how long I'll likely wait? Because I've been at it for a couple weeks and I'm growing impatient, the most advanced program I've made is Tic-Tac-Toe in a windows console app.
Get a lib like SFML.

1
2
3
4
5
6
sf::Texture texture;
texture.loadFromFile("your_image.png");  // <- load a texture from an image file

sf::Sprite sprite(texture);  // <- put that texture in a sprite

window.draw( sprite );  // <- draw it to your window 



It's that easy.

The reason for the separation of Texture and sprite is so you can have multiple sprites sharing the same texture. Loading the same image multiple times would be expensive and wasteful.
Last edited on
Topic archived. No new replies allowed.