More progress on bindings

This commit is contained in:
Joshua Granick
2018-05-25 15:44:09 -07:00
parent 4d2e8febe3
commit 5dc5f47dd4
22 changed files with 2138 additions and 58 deletions

View File

@@ -30,6 +30,10 @@ import lime.media.fmod.FMODSound;
@:access(lime._backend.native.NativeCFFI)
@:access(lime.Assets)
#if hl
@:keep
#end
#if !lime_debug
@:fileXml('tags="haxe,release"')
@:noDebug

View File

@@ -17,6 +17,10 @@ import flash.display.Stage;
typedef Stage = Dynamic;
#end
#if hl
@:keep
#end
#if !lime_debug
@:fileXml('tags="haxe,release"')
@:noDebug

View File

@@ -2,6 +2,7 @@
#define LIME_APP_APPLICATION_EVENT_H
#include <hl.h>
#include <hx/CFFI.h>
@@ -16,6 +17,15 @@ namespace lime {
};
struct HL_ApplicationEvent {
hl_type* t;
int deltaTime;
ApplicationEventType type;
};
class ApplicationEvent {
public:

View File

@@ -21,12 +21,13 @@ namespace lime {
bool premultiplied;
bool transparent;
int width;
void* __srcBitmapData;
void* __srcCanvas;
void* __srcContext;
void* __srcCustom;
void* __srcImage;
void* __srcImageData;
vdynamic* __srcBitmapData;
vdynamic* __srcCanvas;
vdynamic* __srcContext;
vdynamic* __srcCustom;
vdynamic* __srcImage;
vdynamic* __srcImageData;
};

View File

@@ -2,6 +2,7 @@
#define LIME_GRAPHICS_RENDER_EVENT_H
#include <hl.h>
#include <hx/CFFI.h>
@@ -17,6 +18,14 @@ namespace lime {
};
struct HL_RenderEvent {
hl_type* t;
RenderEventType type;
};
class RenderEvent {
public:

View File

@@ -11,7 +11,7 @@ namespace lime {
struct HL_Rectangle {
hl_type* type;
hl_type* t;
double height;
double width;
double x;

View File

@@ -2,12 +2,23 @@
#define LIME_MATH_VECTOR2_H
#include <hl.h>
#include <hx/CFFI.h>
namespace lime {
struct HL_Vector2 {
hl_type* t;
double length;
double x;
double y;
};
class Vector2 {

View File

@@ -29,6 +29,25 @@
namespace lime {
struct HL_AudioBuffer {
hl_type* t;
int bitsPerSample;
int channels;
HL_ArrayBufferView* data;
int sampleRate;
vdynamic* __srcAudio;
vdynamic* __srcBuffer;
vdynamic* __srcCustom;
vdynamic* __srcFMODSound;
vdynamic* __srcHowl;
vdynamic* __srcSound;
vdynamic* __srcVorbisFile;
};
class AudioBuffer {

View File

@@ -24,10 +24,12 @@ namespace lime {
};
typedef void (*hl_finalizer)(void* v);
value CFFIPointer (void* ptr, hx::finalizer finalizer = 0);
value CFFIPointer (value handle, hx::finalizer finalizer = 0);
HL_CFFIPointer* HLCFFIPointer (void* ptr, hx::finalizer finalizer = 0);
HL_CFFIPointer* HLCFFIPointer (void* ptr, hl_finalizer finalizer = 0);
}

View File

@@ -2,6 +2,7 @@
#define LIME_SYSTEM_CLIPBOARD_EVENT_H
#include <hl.h>
#include <hx/CFFI.h>
@@ -15,6 +16,14 @@ namespace lime {
};
struct HL_ClipboardEvent {
hl_type* t;
ClipboardEventType type;
};
class ClipboardEvent {
public:

View File

@@ -2,6 +2,7 @@
#define LIME_SYSTEM_SENSOR_EVENT_H
#include <hl.h>
#include <hx/CFFI.h>
@@ -15,6 +16,18 @@ namespace lime {
};
struct HL_SensorEvent {
hl_type* t;
int id;
double x;
double y;
double z;
SensorEventType type;
};
class SensorEvent {
public:

View File

@@ -2,6 +2,7 @@
#define LIME_UI_DROP_EVENT_H
#include <hl.h>
#include <hx/CFFI.h>
@@ -15,6 +16,15 @@ namespace lime {
};
struct HL_DropEvent {
hl_type* t;
vbyte* file;
DropEventType type;
};
class DropEvent {
public:

View File

@@ -2,6 +2,7 @@
#define LIME_UI_GAMEPAD_EVENT_H
#include <hl.h>
#include <hx/CFFI.h>
@@ -19,6 +20,18 @@ namespace lime {
};
struct HL_GamepadEvent {
hl_type* t;
int axis;
int button;
int id;
GamepadEventType type;
double value;
};
class GamepadEvent {
public:

View File

@@ -2,6 +2,7 @@
#define LIME_UI_JOYSTICK_EVENT_H
#include <hl.h>
#include <hx/CFFI.h>
@@ -21,6 +22,19 @@ namespace lime {
};
struct HL_JoystickEvent {
hl_type* t;
int id;
int index;
JoystickEventType type;
int value;
double x;
double y;
};
class JoystickEvent {
public:

View File

@@ -2,6 +2,7 @@
#define LIME_UI_KEY_EVENT_H
#include <hl.h>
#include <hx/CFFI.h>
#include <stdint.h>
@@ -17,6 +18,17 @@ namespace lime {
};
struct HL_KeyEvent {
hl_type* t;
int keyCode;
int modifier;
KeyEventType type;
int windowID;
};
class KeyEvent {
public:

View File

@@ -2,6 +2,7 @@
#define LIME_UI_MOUSE_EVENT_H
#include <hl.h>
#include <hx/CFFI.h>
#include <stdint.h>
@@ -19,6 +20,20 @@ namespace lime {
};
struct HL_MouseEvent {
hl_type* t;
int button;
double movementX;
double movementY;
MouseEventType type;
int windowID;
double x;
double y;
};
class MouseEvent {
public:

View File

@@ -2,6 +2,7 @@
#define LIME_UI_TEXT_EVENT_H
#include <hl.h>
#include <hx/CFFI.h>
#include <stdint.h>
@@ -17,6 +18,19 @@ namespace lime {
};
struct HL_TextEvent {
hl_type* t;
int id;
int length;
int start;
vbyte* text;
TextEventType type;
int windowID;
};
class TextEvent {
public:

View File

@@ -2,6 +2,7 @@
#define LIME_UI_TOUCH_EVENT_H
#include <hl.h>
#include <hx/CFFI.h>
#include <stdint.h>
@@ -18,6 +19,21 @@ namespace lime {
};
struct HL_TouchEvent {
hl_type* t;
int device;
double dx;
double dy;
int id;
double pressure;
TouchEventType type;
double x;
double y;
};
class TouchEvent {
public:

View File

@@ -6,6 +6,7 @@
#undef CreateWindow
#endif
#include <hl.h>
#include <app/Application.h>
#include <graphics/ImageBuffer.h>
#include <system/DisplayMode.h>
@@ -15,6 +16,57 @@
namespace lime {
// struct HL_Window {
// hl_type* t;
// HL_Application* application;
// bool borderless;
// vdynamic* config;
// vdynamic* display;
// int id;
// vdynamic* onActivate;
// vdynamic* onClose;
// vdynamic* onCreate;
// vdynamic* onDeactivate;
// vdynamic* onDropFile;
// vdynamic* onEnter;
// vdynamic* onFocusIn;
// vdynamic* onFocusOut;
// vdynamic* onFullscreen;
// vdynamic* onKeyDown;
// vdynamic* onKeyUp;
// vdynamic* onLeave;
// vdynamic* onMinimize;
// vdynamic* onMouseDown;
// vdynamic* onMouseMove;
// vdynamic* onMouseMoveRelative;
// vdynamic* onMouseUp;
// vdynamic* onMouseWheel;
// vdynamic* onMove;
// vdynamic* onResize;
// vdynamic* onRestore;
// vdynamic* onTextEdit;
// vdynamic* onTextInput;
// HL_Renderer* renderer;
// double scale;
// vdynamic* stage;
// vdynamic* backend;
// bool __borderless;
// bool __fullscreen;
// int __height;
// bool __maximized;
// bool __minimized;
// bool __resizable;
// double __scale;
// vbyte* __title;
// int __width;
// int __x;
// int __y;
// };
class Window {

View File

@@ -2,6 +2,7 @@
#define LIME_UI_WINDOW_EVENT_H
#include <hl.h>
#include <hx/CFFI.h>
#include <stdint.h>
@@ -27,6 +28,19 @@ namespace lime {
};
struct HL_WindowEvent {
hl_type* t;
int height;
WindowEventType type;
int width;
int windowID;
int x;
int y;
};
class WindowEvent {
public:

File diff suppressed because it is too large Load Diff

View File

@@ -40,12 +40,12 @@ namespace lime {
}
HL_CFFIPointer* HLCFFIPointer (void* handle, hx::finalizer finalizer) {
HL_CFFIPointer* HLCFFIPointer (void* handle, hl_finalizer finalizer) {
if (handle) {
HL_CFFIPointer* pointer = (HL_CFFIPointer*)hl_gc_alloc_finalizer (sizeof (HL_CFFIPointer));
pointer->finalizer = finalizer ? finalizer : 0;
pointer->finalizer = finalizer ? (void*)finalizer : 0;
pointer->ptr = handle;
return pointer;