Drawing Sprites with SFML - C++ Tutorial
Автор: Zenva
Загружено: 2020-07-02
Просмотров: 22374
Описание:
ACCESS the FULL COURSE here: https://academy.zenva.com/product/cpp...
TRANSCRIPT
We’ve seen how to draw a basic shape but realistically, most of our games will use more than shapes. We will want to place graphics, icons, and other images into our games and we do so via Sprites. Setting up a Sprite is generally done in two steps with SFML: first, we load in a texture, then we create a sprite and pass in the texture. Once we have the sprite set up, we can set attributes such as the size and position and then display it by drawing it into the window during the run loop.
In our project, we should create a folder called assets that contains any assets needed in our game. We only have 4 so there’s no need to further divide the assets folder. Copy the “enemy.png” and “background.png” images, the “damage.ogg” audio file, and the “Arial.ttf” font files from your provided files and paste them into the assets folder. We will only work with the Enemy.png image for now. To create a texture, we first create a texture variable and then call the loadFromFile() function, passing in the path to the file as a string. It returns true if successful and false otherwise so we should perform a boolean test to see if the load was successful
Повторяем попытку...

Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: