texture_get_height 함수 설명
texture_get_height
함수는 주어진 ID를 가진 텍스처의 높이를 반환합니다. 반환되는 값은 항상 0에서 1 사이의 값입니다. 이 값은 텍스처를 모델이나 원시 도형에 매핑할 때 유용하게 사용될 수 있습니다.
문법
texture_get_height(tex);
인수 설명
인수 | 유형 | 설명 |
---|---|---|
tex | 텍스처 | 사용할 텍스처 페이지 자산 포인터 |
반환값
- 실수형 값 (Real)
예제
tex_h = texture_get_height(surface_get_texture(global.Surf));
위 코드는 이전에 생성된 서피스에서 가져온 텍스처의 높이를 얻는 예제입니다.
활용 예제
- 텍스처 높이 기반 스케일링
gml var tex_height = texture_get_height(my_texture); var scale_factor = 1 / tex_height; instance_create(x, y, obj_scaled_instance);
- UI 요소 위치 조정
gml var tex_height = texture_get_height(ui_texture); button_y = screen_height - tex_height - 10;
- 애니메이션 프레임 조정
gml var tex_height = texture_get_height(animation_texture); frame_height = tex_height / total_frames;
- 게임 오브젝트의 높이 설정
gml var tex_height = texture_get_height(object_texture); sprite_height = tex_height * scale;
- 배경 이미지 비율 유지
gml var tex_height = texture_get_height(background_texture); background_scale = screen_height / tex_height;
이와 같은 다양한 활용 예제를 통해 texture_get_height
함수를 효과적으로 사용할 수 있습니다.