Flex Panel 노드 방향 가져오기
이 문서는 Flex Panel 노드의 방향 속성을 가져오는 함수에 대해 설명합니다. 이 함수는 주어진 Flex Panel 노드의 방향 속성을 반환합니다.
함수 설명
함수명
flexpanel_node_style_get_direction
문법
flexpanel_node_style_get_direction(node);
인자 설명
인자 | 타입 | 설명 |
---|---|---|
node | Flex Panel Node | 읽어올 노드 |
반환값
- Flex Panel Layout Direction Constant
예제
var _layout_direction = flexpanel_node_style_get_direction(_node);
이 코드는 노드의 레이아웃 방향을 가져와서 로컬 변수에 저장합니다.
활용 예제
예제 1: 노드 방향에 따라 다른 스타일 적용하기
var _direction = flexpanel_node_style_get_direction(_node);
if (_direction == flexpanel_layout_direction_horizontal) {
// 수평 방향일 때 스타일 적용
flexpanel_node_style_set_background_color(_node, c_blue);
} else {
// 수직 방향일 때 스타일 적용
flexpanel_node_style_set_background_color(_node, c_red);
}
예제 2: 모든 노드의 방향 출력하기
for (var i = 0; i < flexpanel_node_count; i++) {
var _node = flexpanel_get_node(i);
var _direction = flexpanel_node_style_get_direction(_node);
show_message("노드 " + string(i) + "의 방향: " + string(_direction));
}
예제 3: 방향에 따른 레이아웃 조정
var _direction = flexpanel_node_style_get_direction(_node);
if (_direction == flexpanel_layout_direction_vertical) {
// 수직 방향일 때 레이아웃 조정
flexpanel_node_set_size(_node, 100, 200);
} else {
// 수평 방향일 때 레이아웃 조정
flexpanel_node_set_size(_node, 200, 100);
}
이 문서에서는 Flex Panel 노드의 방향을 가져오는 방법과 이를 활용한 다양한 예제를 살펴보았습니다.