![]() |
MIR Engine
미래 지향 설계에 초점을 맞춘 자체 제작 게임 엔진
|
렌더링 가능한 스프라이트 정보를 담는 컴포넌트 더 자세히 ...
#include <Sprite.hpp>
Public 멤버 함수 | |
Sprite () | |
기본 생성자 | |
Sprite (std::shared_ptr< sf::Texture > texture) | |
텍스처를 지정하는 생성자 | |
Sprite (std::shared_ptr< sf::Texture > texture, std::uint16_t width, std::uint16_t height) | |
텍스처와 스프라이트 크기를 지정하는 생성자 | |
![]() | |
virtual | ~Component ()=default |
가상 소멸자 | |
데이터 필드 | |
std::shared_ptr< sf::Texture > | texture |
스프라이트에 할당할 텍스처를 가리키는 shared_ptr | |
sf::Sprite | sprite |
SFML의 스프라이트 객체 | |
std::uint16_t | width |
스프라이트의 폭(가로 길이) | |
std::uint16_t | height |
스프라이트의 높이(세로 길이) | |
추가로 상속된 멤버들 | |
![]() | |
using | Tag = std::uint32_t |
컴포넌트를 식별하기 위한 태그 타입 정의 | |
렌더링 가능한 스프라이트 정보를 담는 컴포넌트
이 컴포넌트는 SFML의 텍스처(sf::Texture)와 스프라이트(sf::Sprite) 관리. 엔티티에 부착함으로써 그래픽 렌더링 가능. width, height 필드는 스프라이트의 가로, 세로 크기를 저장.
|
inline |
기본 생성자
texture를 nullptr로, width와 height를 0으로 초기화. 텍스처가 설정되지 않은 상태로 시작하며, 이후 필요 시 setTexture를 호출하거나 다른 생성자를 통해 텍스처 지정 가능.
|
inline |
|
inline |
텍스처와 스프라이트 크기를 지정하는 생성자
texture | 스프라이트에 적용할 텍스처의 shared_ptr |
width | 스프라이트의 가로 길이 |
height | 스프라이트의 세로 길이 |
texture가 유효한 경우 sprite에 텍스처를 설정하고, 지정한 width와 height를 통해 이후 렌더링 논리나 충돌 판정에 활용 가능.
std::uint16_t MIR::Sprite::height |
스프라이트의 높이(세로 길이)
엔티티 그래픽의 실제 세로 길이.
sf::Sprite MIR::Sprite::sprite |
SFML의 스프라이트 객체
texture를 할당받은 후, sprite에 텍스처를 설정함으로써 실제 화면에 렌더링 가능한 그래픽 개체를 정의.
std::shared_ptr<sf::Texture> MIR::Sprite::texture |
스프라이트에 할당할 텍스처를 가리키는 shared_ptr
std::shared_ptr를 사용하여 텍스처 리소스를 공유하고, 텍스처가 더 이상 필요하지 않을 때 자동으로 메모리 해제.
std::uint16_t MIR::Sprite::width |
스프라이트의 폭(가로 길이)
엔티티 그래픽의 실제 가로 길이.