-
Notifications
You must be signed in to change notification settings - Fork 0
/
window_close_function.cpp
51 lines (45 loc) · 1.7 KB
/
window_close_function.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* Copyright (c) 2012 Cheese and Bacon Games, LLC */
/* This file is licensed under the MIT License. */
/* See the file docs/LICENSE.txt for the full license text. */
#include "window.h"
#include "world.h"
#include <boost/algorithm/string.hpp>
using namespace std;
void Window::exec_close_function(){
if(close_function.length()>0){
if(close_function=="configure_command"){
engine_interface.configure_command=-1;
}
else if(close_function=="scan_acceleration"){
android.disable_sensor("accelerometer");
android.disable_sensor("gravity");
android.disable_sensor("linear_acceleration");
}
else if(close_function=="scan_environment"){
android.disable_sensor("ambient_temperature");
android.disable_sensor("pressure");
android.disable_sensor("relative_humidity");
android.disable_sensor("light");
}
else if(close_function=="scan_magnetic"){
android.disable_sensor("magnetic_field");
}
else if(close_function=="scan_rotation"){
android.disable_sensor("gyroscope");
android.disable_sensor("rotation_vector");
android.disable_sensor("geomagnetic_rotation_vector");
}
else if(close_function=="scan_other"){
android.disable_sensor("proximity");
android.disable_sensor("step_counter");
}
else if(close_function=="scan_position"){
android.disable_sensor("pressure");
android.disable_gps();
game.world.gps_altitude.stop();
}
else{
Log::add_error("Invalid close function: '"+close_function+"'");
}
}
}