Trying to hook up the first native function!
This commit is contained in:
@@ -36,7 +36,7 @@ class Display {
|
||||
|
||||
public static function get_numDisplays():Int {
|
||||
|
||||
return lime_display_get_num_video_displays();
|
||||
return lime_display_get_num_devices();
|
||||
|
||||
}
|
||||
|
||||
@@ -123,9 +123,13 @@ class Display {
|
||||
// Native Methods (stubs)
|
||||
|
||||
#if (cpp || neko || nodejs)
|
||||
private static var lime_display_get_num_video_displays = function():Int {
|
||||
|
||||
/*
|
||||
private static var lime_display_get_num_devices = function():Int {
|
||||
return 1;
|
||||
};
|
||||
*/
|
||||
|
||||
private static var lime_display_get_name = function(i:Int) {
|
||||
return "fake";
|
||||
};
|
||||
@@ -140,10 +144,11 @@ class Display {
|
||||
};
|
||||
#end
|
||||
|
||||
/*
|
||||
#if (cpp || neko || nodejs)
|
||||
private static var lime_display_get_num_video_displays = System.load("lime", "lime_display_get_num_video_displays", 0);
|
||||
|
||||
private static var lime_display_get_num_devices = System.load("lime", "lime_display_get_num_devices_displays", 0);
|
||||
|
||||
/*
|
||||
private static var lime_display_get_name = System.load ("lime", "lime_display_get_name", 1);
|
||||
private static var lime_display_get_num_display_modes = System.load ("lime", "lime_display_get_num_display_modes", 1);
|
||||
private static var lime_display_get_display_mode = System.load ("lime", "lime_display_get_display_mode", 2);
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef LIME_UI_DISPLAY_H
|
||||
#define LIME_UI_DISPLAY_H
|
||||
|
||||
#include <SDL.h>
|
||||
#include <ui/Gamepad.h>
|
||||
#include <map>
|
||||
|
||||
namespace lime {
|
||||
|
||||
|
||||
class Display {
|
||||
|
||||
public:
|
||||
|
||||
static int GetNumDevices ();
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <graphics/ImageBuffer.h>
|
||||
#include <graphics/Renderer.h>
|
||||
#include <graphics/RenderEvent.h>
|
||||
#include <system/Display.h>
|
||||
#include <system/System.h>
|
||||
#include <text/Font.h>
|
||||
#include <text/TextLayout.h>
|
||||
@@ -390,6 +391,11 @@ namespace lime {
|
||||
|
||||
}
|
||||
|
||||
value lime_display_get_num_devices () {
|
||||
|
||||
return alloc_int (Display::GetNumDevices());
|
||||
|
||||
}
|
||||
|
||||
value lime_gamepad_add_mappings (value mappings) {
|
||||
|
||||
@@ -1172,6 +1178,7 @@ namespace lime {
|
||||
DEFINE_PRIM (lime_font_render_glyph, 3);
|
||||
DEFINE_PRIM (lime_font_render_glyphs, 3);
|
||||
DEFINE_PRIM (lime_font_set_size, 2);
|
||||
DEFINE_PRIM (lime_display_get_num_devices, 0);
|
||||
DEFINE_PRIM (lime_gamepad_add_mappings, 1);
|
||||
DEFINE_PRIM (lime_gamepad_event_manager_register, 2);
|
||||
DEFINE_PRIM (lime_gamepad_get_device_guid, 1);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <system/Display.h>
|
||||
|
||||
|
||||
namespace lime {
|
||||
|
||||
|
||||
int SDLDisplay::GetNumDevices() {
|
||||
|
||||
return SDL_GetNumVideoDisplays();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user