自分でヘッダーファイルを作成し、関数を次のように定義します
ヘッダーファイル
#pragma once
#include "SFML/Graphics.hpp"
class MyClass
{
public:
sf::Sprite Sprite;
MyClass();
void Setup(sf::Texture& texture);
void Draw(sf::RenderWindow& window);
};
Cpp ファイル
#include "Bullet.h"
MyClass::MyClass()
{
}
void MyClass::Setup(sf::Texture& texture)
{
Sprite.setTexture(texture);
Sprite.setPosition(0, 0);
}
void MyClass::Draw(sf::RenderWindow& window)
{
window.draw(Sprite);
}
次に、描画用のゲームループで、次のようなものを呼び出すことができます
// myClass is an object of type MyClass
// renderWindow is your sf::RenderWindow object
myClass.Draw(renderWindow);
お役に立てれば。さらにガイダンスが必要な場合はお知らせください。