Move get display index to C++
This commit is contained in:
@@ -128,17 +128,13 @@ class NativeWindow {
|
||||
|
||||
public function getDisplay ():Display {
|
||||
|
||||
var center = new Vector2 (parent.__x + (parent.__width / 2), parent.__y + (parent.__height / 2));
|
||||
var numDisplays = System.numDisplays;
|
||||
var display;
|
||||
if (handle != null) {
|
||||
|
||||
for (i in 0...numDisplays) {
|
||||
var index = lime_window_get_display (handle);
|
||||
|
||||
display = System.getDisplay (i);
|
||||
if (index > -1) {
|
||||
|
||||
if (display.bounds.containsPoint (center)) {
|
||||
|
||||
return display;
|
||||
return System.getDisplay (index);
|
||||
|
||||
}
|
||||
|
||||
@@ -307,6 +303,7 @@ class NativeWindow {
|
||||
@:cffi private static function lime_window_close (handle:Dynamic):Void;
|
||||
@:cffi private static function lime_window_create (application:Dynamic, width:Int, height:Int, flags:Int, title:String):Dynamic;
|
||||
@:cffi private static function lime_window_focus (handle:Dynamic):Void;
|
||||
@:cffi private static function lime_window_get_display (handle:Dynamic):Int;
|
||||
@:cffi private static function lime_window_get_enable_text_events (handle:Dynamic):Bool;
|
||||
@:cffi private static function lime_window_get_height (handle:Dynamic):Int;
|
||||
@:cffi private static function lime_window_get_id (handle:Dynamic):Int;
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace lime {
|
||||
virtual void Alert (const char* message, const char* title) = 0;
|
||||
virtual void Close () = 0;
|
||||
virtual void Focus () = 0;
|
||||
virtual int GetDisplay () = 0;
|
||||
virtual bool GetEnableTextEvents () = 0;
|
||||
virtual int GetHeight () = 0;
|
||||
virtual uint32_t GetID () = 0;
|
||||
|
||||
@@ -1300,6 +1300,14 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
int lime_window_get_display (value window) {
|
||||
|
||||
Window* targetWindow = (Window*)val_data (window);
|
||||
return targetWindow->GetDisplay ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool lime_window_get_enable_text_events (value window) {
|
||||
|
||||
Window* targetWindow = (Window*)val_data (window);
|
||||
@@ -1527,6 +1535,7 @@ namespace lime {
|
||||
DEFINE_PRIME5 (lime_window_create);
|
||||
DEFINE_PRIME2v (lime_window_event_manager_register);
|
||||
DEFINE_PRIME1v (lime_window_focus);
|
||||
DEFINE_PRIME1 (lime_window_get_display);
|
||||
DEFINE_PRIME1 (lime_window_get_enable_text_events);
|
||||
DEFINE_PRIME1 (lime_window_get_height);
|
||||
DEFINE_PRIME1 (lime_window_get_id);
|
||||
|
||||
@@ -179,6 +179,13 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
int SDLWindow::GetDisplay () {
|
||||
|
||||
return SDL_GetWindowDisplayIndex (sdlWindow);
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool SDLWindow::GetEnableTextEvents () {
|
||||
|
||||
return SDL_IsTextInputActive ();
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace lime {
|
||||
virtual void Alert (const char* message, const char* title);
|
||||
virtual void Close ();
|
||||
virtual void Focus ();
|
||||
virtual int GetDisplay ();
|
||||
virtual bool GetEnableTextEvents ();
|
||||
virtual int GetHeight ();
|
||||
virtual uint32_t GetID ();
|
||||
|
||||
Reference in New Issue
Block a user