os_get_info 함수 설명 및 활용 예제
os_get_info
함수는 게임이 실행되고 있는 운영 체제에 대한 자세한 정보를 포함하는 DS 맵을 반환합니다. 반환되는 정보는 운영 체제와 장치에 따라 다르므로, 목표로 하는 모든 플랫폼에서 이 함수를 테스트하고 show_debug_message()
와 같은 함수를 사용하여 반환된 값을 출력하는 것이 좋습니다. DS 맵은 자동으로 메모리에서 지워지지 않으므로 더 이상 필요하지 않을 때는 ds_map_destroy()
함수를 사용해야 합니다.
플랫폼별 추가 데이터
플랫폼 | 추가 데이터 |
---|---|
Windows | - udid : 기계 고유 식별자- video_d3d11_device : DX11 장치 포인터- video_adapter_description : 비디오 어댑터 설명 |
macOS | - udid : 기계 고유 식별자- gl_vendor_string : OpenGL 공급업체- gl_version_string : OpenGL 버전 |
Ubuntu | - macOS와 동일한 정보 |
Android | - android_tv : Android TV 여부- GL_VERSION : OpenGL 버전- MODEL : 장치 모델 |
iOS & tvOS | - name : 장치 이름- systemName : 시스템 이름- totalMemory : 총 메모리 |
GX.games | - mobile : 모바일 브라우저에서 실행 여부 |
HTML5 | -1 |
Nintendo Switch | -1 |
PlayStation 4 | - display_safe_area_ratio : 안전 영역 비율- is_neo_mode : Neo 모드 여부 |
PlayStation 5 | - display_resolution : 해상도- display_dynamic_range : 동적 범위 |
Xbox One & Series X/S | - video_d3d12_cmdqueue : DX12 명령 큐 포인터- device_type : 장치 유형 상수 |
함수 사용 예제
다음은 os_get_info
함수를 사용하는 몇 가지 예제입니다.
예제 1: Android TV 확인
if (os_type == os_android) {
var _info = os_get_info();
if (_info[? "android_tv"]) {
global.android_tv = true;
}
}
예제 2: macOS에서 OpenGL 정보 출력
if (os_type == os_mac) {
var _info = os_get_info();
show_debug_message("OpenGL 공급업체: " + _info[? "gl_vendor_string"]);
show_debug_message("OpenGL 버전: " + _info[? "gl_version_string"]);
}
예제 3: Windows에서 DX11 정보 출력
if (os_type == os_windows) {
var _info = os_get_info();
show_debug_message("비디오 어댑터 설명: " + _info[? "video_adapter_description"]);
show_debug_message("비디오 메모리 크기: " + _info[? "video_adapter_dedicatedvideomemory"]);
}
예제 4: iOS에서 시스템 정보 출력
if (os_type == os_ios) {
var _info = os_get_info();
show_debug_message("장치 이름: " + _info[? "name"]);
show_debug_message("시스템 버전: " + _info[? "systemVersion"]);
}
이와 같이 os_get_info
함수를 활용하여 다양한 플랫폼에서 시스템 정보를 얻고, 이를 기반으로 게임의 동작을 조정할 수 있습니다.