Add System.allowScreenTimeout

This commit is contained in:
Joshua Granick
2015-09-30 12:46:14 -07:00
parent f4438d85ac
commit a069328efb
4 changed files with 67 additions and 0 deletions

View File

@@ -25,10 +25,12 @@ namespace lime {
public:
static bool GetAllowScreenTimeout ();
static const char* GetDirectory (SystemDirectory type, const char* company, const char* title);
static value GetDisplay (int id);
static int GetNumDisplays ();
static double GetTimer ();
static bool SetAllowScreenTimeout (bool allow);
};

View File

@@ -1029,6 +1029,13 @@ namespace lime {
}
bool lime_system_get_allow_screen_timeout () {
return System::GetAllowScreenTimeout ();
}
value lime_system_get_directory (int type, HxString company, HxString title) {
const char* path = System::GetDirectory ((SystemDirectory)type, company.__s, title.__s);
@@ -1058,6 +1065,13 @@ namespace lime {
}
bool lime_system_set_allow_screen_timeout (bool allow) {
return System::SetAllowScreenTimeout (allow);
}
void lime_text_event_manager_register (value callback, value eventObject) {
TextEvent::callback = new AutoGCRoot (callback);
@@ -1359,10 +1373,12 @@ namespace lime {
DEFINE_PRIME1v (lime_renderer_unlock);
DEFINE_PRIME2v (lime_render_event_manager_register);
DEFINE_PRIME2v (lime_sensor_event_manager_register);
DEFINE_PRIME0 (lime_system_get_allow_screen_timeout);
DEFINE_PRIME3 (lime_system_get_directory);
DEFINE_PRIME1 (lime_system_get_display);
DEFINE_PRIME0 (lime_system_get_num_displays);
DEFINE_PRIME0 (lime_system_get_timer);
DEFINE_PRIME1 (lime_system_set_allow_screen_timeout);
DEFINE_PRIME2v (lime_text_event_manager_register);
DEFINE_PRIME3 (lime_text_layout_create);
DEFINE_PRIME5 (lime_text_layout_position);

View File

@@ -80,6 +80,13 @@ namespace lime {
}
bool System::GetAllowScreenTimeout () {
return SDL_IsScreenSaverEnabled ();
}
const char* System::GetDirectory (SystemDirectory type, const char* company, const char* title) {
switch (type) {
@@ -312,6 +319,23 @@ namespace lime {
}
bool System::SetAllowScreenTimeout (bool allow) {
if (allow) {
SDL_EnableScreenSaver ();
} else {
SDL_DisableScreenSaver ();
}
return allow;
}
FILE* FILE_HANDLE::getFile () {
#ifndef HX_WINDOWS