draw_surface_stretched 함수 설명
draw_surface_stretched
함수는 주어진 너비와 높이에 맞게 서피스를 늘려서 그리는 기능을 제공합니다. 이 함수는 서피스를 지정하고, 서피스를 그릴 방의 (x, y) 위치를 설정한 후, 너비와 높이를 픽셀 값으로 지정할 수 있습니다.
문법
draw_surface_stretched(surface, x, y, w, h);
매개변수 설명
매개변수 | 타입 | 설명 |
---|---|---|
surface | Surface | 그릴 서피스 |
x | Real | 서피스를 그릴 x 위치 |
y | Real | 서피스를 그릴 y 위치 |
w | Real | 서피스를 그릴 너비 |
h | Real | 서피스를 그릴 높이 |
반환값
N/A
예제
draw_surface_stretched(surf, 10, 10, 100, 100);
위 코드는 surf
변수에 인덱스된 서피스를 (10, 10) 위치에 그립니다. 너비와 높이는 각각 100으로 설정되어 있으며, 이는 서피스의 실제 너비와 높이에 관계없이 차지하는 공간입니다.
활용 예제
- 게임 배경 그리기
draw_surface_stretched(background_surface, 0, 0, room_width, room_height);
- UI 요소 표시
draw_surface_stretched(ui_surface, 50, 50, 200, 100);
- 캐릭터 애니메이션
draw_surface_stretched(character_surface, player_x, player_y, 64, 128);
- 효과 적용
draw_surface_stretched(effect_surface, mouse_x, mouse_y, 150, 150);
- 타이틀 화면
draw_surface_stretched(title_surface, 0, 0, 800, 600);
이와 같이 draw_surface_stretched
함수를 활용하여 다양한 그래픽 요소를 화면에 표시할 수 있습니다.