forked from joseph-montanez/raylib-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraylib-cursor.c
141 lines (117 loc) · 4.84 KB
/
raylib-cursor.c
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/* If defined, the following flags inhibit definition of the indicated items.*/
#define NOGDICAPMASKS // CC_*, LC_*, PC_*, CP_*, TC_*, RC_
#define NOVIRTUALKEYCODES // VK_*
#define NOWINMESSAGES // WM_*, EM_*, LB_*, CB_*
#define NOWINSTYLES // WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_*
#define NOSYSMETRICS // SM_*
#define NOMENUS // MF_*
#define NOICONS // IDI_*
#define NOKEYSTATES // MK_*
#define NOSYSCOMMANDS // SC_*
#define NORASTEROPS // Binary and Tertiary raster ops
#define NOSHOWWINDOW // SW_*
#define OEMRESOURCE // OEM Resource values
#define NOATOM // Atom Manager routines
#define NOCLIPBOARD // Clipboard routines
#define NOCOLOR // Screen colors
#define NOCTLMGR // Control and Dialog routines
#define NODRAWTEXT // DrawText() and DT_*
#define NOGDI // All GDI defines and routines
#define NOKERNEL // All KERNEL defines and routines
#define NOUSER // All USER defines and routines
/*#define NONLS // All NLS defines and routines*/
#define NOMB // MB_* and MessageBox()
#define NOMEMMGR // GMEM_*, LMEM_*, GHND, LHND, associated routines
#define NOMETAFILE // typedef METAFILEPICT
#define NOMINMAX // Macros min(a,b) and max(a,b)
#define NOMSG // typedef MSG and associated routines
#define NOOPENFILE // OpenFile(), OemToAnsi, AnsiToOem, and OF_*
#define NOSCROLL // SB_* and scrolling routines
#define NOSERVICE // All Service Controller routines, SERVICE_ equates, etc.
#define NOSOUND // Sound driver routines
#define NOTEXTMETRIC // typedef TEXTMETRIC and associated routines
#define NOWH // SetWindowsHook and WH_*
#define NOWINOFFSETS // GWL_*, GCL_*, associated routines
#define NOCOMM // COMM driver routines
#define NOKANJI // Kanji support stuff.
#define NOHELP // Help engine interface.
#define NOPROFILER // Profiler interface.
#define NODEFERWINDOWPOS // DeferWindowPos routines
#define NOMCX // Modem Configuration Extensions
/* Type required before windows.h inclusion */
typedef struct tagMSG *LPMSG;
#include "php.h"
#undef LOG_INFO
#undef LOG_WARNING
#undef LOG_DEBUG
#include "raylib.h"
#include "raylib-cursor.h"
//------------------------------------------------------------------------------------------------------
//-- raylib Cursor PHP Custom Object
//------------------------------------------------------------------------------------------------------
zend_object_handlers php_raylib_cursor_object_handlers;
void php_raylib_cursor_free_storage(zend_object *object TSRMLS_DC)
{
php_raylib_cursor_object *intern = php_raylib_cursor_fetch_object(object);
zend_object_std_dtor(&intern->std);
}
zend_object * php_raylib_cursor_new(zend_class_entry *ce TSRMLS_DC)
{
php_raylib_cursor_object *intern;
intern = (php_raylib_cursor_object*) ecalloc(1, sizeof(php_raylib_cursor_object) + zend_object_properties_size(ce));
zend_object_std_init(&intern->std, ce TSRMLS_CC);
object_properties_init(&intern->std, ce);
intern->std.handlers = &php_raylib_cursor_object_handlers;
return &intern->std;
}
// PHP object handling
PHP_METHOD(Cursor, __construct)
{
php_raylib_cursor_object *intern = Z_CURSOR_OBJ_P(ZEND_THIS);
}
//void ShowCursor(void);
PHP_METHOD(Cursor, show)
{
ShowCursor();
}
//void HideCursor(void);
PHP_METHOD(Cursor, hide)
{
HideCursor();
}
//bool IsCursorHidden(void);
PHP_METHOD(Cursor, isHidden)
{
RETURN_BOOL(IsWindowReady());
}
//void EnableCursor(void);
PHP_METHOD(Cursor, enable)
{
EnableCursor();
}
//void DisableCursor(void);
PHP_METHOD(Cursor, disable)
{
DisableCursor();
}
const zend_function_entry php_raylib_cursor_methods[] = {
PHP_ME(Cursor, __construct, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Cursor, show, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Cursor, hide, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Cursor, isHidden, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Cursor, enable, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Cursor, disable, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_FE_END
};
// Extension class startup
void php_raylib_cursor_startup(INIT_FUNC_ARGS)
{
zend_class_entry ce;
INIT_NS_CLASS_ENTRY(ce, "raylib", "Cursor", php_raylib_cursor_methods);
php_raylib_cursor_ce = zend_register_internal_class(&ce TSRMLS_CC);
php_raylib_cursor_ce->create_object = php_raylib_cursor_new;
memcpy(&php_raylib_cursor_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
php_raylib_cursor_object_handlers.offset = XtOffsetOf(php_raylib_cursor_object, std);
php_raylib_cursor_object_handlers.free_obj = &php_raylib_cursor_free_storage;
php_raylib_cursor_object_handlers.clone_obj = NULL;
}