forked from mario-deluna/php-glfw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpglfw.c
137 lines (118 loc) · 3.59 KB
/
phpglfw.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
/**
* PHP-glfw
*
* Copyright (c) 2018-2022 Mario Döring
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <php.h>
#include <zend_API.h>
#include <ext/standard/info.h>
#include "phpglfw.h"
#include "phpglfw_arginfo.h"
#include "phpglfw_constants.h"
#include "phpglfw_functions.h"
#include "phpglfw_math.h"
#include "phpglfw_buffer.h"
#include "phpglfw_texture.h"
#include "phpglfw_objparser.h"
zend_module_entry glfw_module_entry = {
STANDARD_MODULE_HEADER,
PHP_GLFW_EXTNAME,
ext_functions,
PHP_MINIT(glfw),
PHP_MSHUTDOWN(glfw),
NULL,
NULL,
PHP_MINFO(glfw),
PHP_GLFW_VERSION,
STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_GLFW
ZEND_GET_MODULE(glfw)
#endif
/**
* MINIT
* --------------------------------
*/
PHP_MINIT_FUNCTION(glfw)
{
// register constants
phpglfw_register_constants(INIT_FUNC_ARGS_PASSTHRU);
// callbacks
phpglfw_init_callbacks();
// register IPOs
phpglfw_register_ipos();
// math module
phpglfw_register_math_module(INIT_FUNC_ARGS_PASSTHRU);
// buffer module
phpglfw_register_buffer_module(INIT_FUNC_ARGS_PASSTHRU);
// texture module
phpglfw_register_texture_module(INIT_FUNC_ARGS_PASSTHRU);
// object parser module
phpglfw_register_objparser_module(INIT_FUNC_ARGS_PASSTHRU);
return SUCCESS;
}
/**
* MSHUTDOWN
* --------------------------------
*/
PHP_MSHUTDOWN_FUNCTION(glfw)
{
// destruct registered callbacks
phpglfw_shutdown_callbacks();
return SUCCESS;
}
/**
* MINFO
* --------------------------------
*/
PHP_MINFO_FUNCTION(glfw)
{
php_info_print_table_start();
php_info_print_table_row(2, "GLFW extension support", "enabled");
php_info_print_table_row(2, "PHP-GLFW Version", PHP_GLFW_VERSION);
php_info_print_table_row(2, "PHP-GLFW Compiled API", PHPGLFW_C_PHPGLFW_COMPILED_API);
php_info_print_table_row(2, "PHP-GLFW Compiled API Version", PHPGLFW_C_PHPGLFW_COMPILED_API_VERSION);
php_info_print_table_row(2, "GLFW Version", glfwGetVersionString());
//php_info_print_table_row(2, "OpengGL Version", glGetString(PHPGLFW_C_GL_VERSION));
php_info_print_table_row(2, "Author", "Mario Döring");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
}
// /**
// * Register
// * --------------------------------
// */
// static zend_function_entry glfw_functions[] = {
// #ifdef PHP_FE_END
// PHP_FE_END
// #else
// {NULL, NULL, NULL}
// #endif
// };
// /* {{{ Return cURL version information. */
// PHP_FUNCTION(glGetVersion)
// {
// RETURN_TRUE;
// }
// /* }}} */