nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
a_star: don't crash on deserialization errors and limit static types
[nit.git]
/
lib
/
egl.nit
diff --git
a/lib/egl.nit
b/lib/egl.nit
index
d188c29
..
a39b1c6
100644
(file)
--- a/
lib/egl.nit
+++ b/
lib/egl.nit
@@
-42,12
+42,7
@@
extern class EGLDisplay `{ EGLDisplay `}
fun is_valid: Bool `{ return self != EGL_NO_DISPLAY; `}
fun initialize: Bool `{
fun is_valid: Bool `{ return self != EGL_NO_DISPLAY; `}
fun initialize: Bool `{
- EGLBoolean r = eglInitialize(self, NULL, NULL);
- if (r == EGL_FALSE) {
- fprintf(stderr, "Unable to eglInitialize");
- return 0;
- }
- return 1;
+ return eglInitialize(self, NULL, NULL);
`}
fun major_version: Int `{
`}
fun major_version: Int `{
@@
-88,7
+83,7
@@
extern class EGLDisplay `{ EGLDisplay `}
}
configs = (EGLConfig*)malloc(sizeof(EGLConfig)*n_configs);
}
configs = (EGLConfig*)malloc(sizeof(EGLConfig)*n_configs);
-
+
r = eglChooseConfig(self, c_attribs, configs, n_configs, &n_configs);
if (r == EGL_FALSE) {
r = eglChooseConfig(self, c_attribs, configs, n_configs, &n_configs);
if (r == EGL_FALSE) {
@@
-103,7
+98,7
@@
extern class EGLDisplay `{ EGLDisplay `}
}
`}
}
`}
- private fun report_egl_error(cmsg: NativeString)
+ private fun report_egl_error(cmsg: CString)
do
var msg = cmsg.to_s
print "libEGL error: {msg}"
do
var msg = cmsg.to_s
print "libEGL error: {msg}"
@@
-136,11
+131,7
@@
extern class EGLDisplay `{ EGLDisplay `}
`}
fun make_current(draw, read: EGLSurface, context: EGLContext): Bool `{
`}
fun make_current(draw, read: EGLSurface, context: EGLContext): Bool `{
- if (eglMakeCurrent(self, draw, read, context) == EGL_FALSE) {
- fprintf(stderr, "Unable to eglMakeCurrent");
- return 0;
- }
- return 1;
+ return eglMakeCurrent(self, draw, read, context);
`}
# Can be used directly, but it is preferable to use a `EGLSurfaceAttribs`
`}
# Can be used directly, but it is preferable to use a `EGLSurfaceAttribs`
@@
-173,15
+164,15
@@
extern class EGLDisplay `{ EGLDisplay `}
end
end
end
end
- private fun query_string(name: Int): String import NativeString.to_s `{
- return NativeString_to_s((char *)eglQueryString(self, name));
+ private fun query_string(name: Int): String import CString.to_s `{
+ return CString_to_s((char *)eglQueryString(self, name));
`}
fun vendor: String do return query_string(0x3053)
fun version: String do return query_string(0x3054)
`}
fun vendor: String do return query_string(0x3053)
fun version: String do return query_string(0x3054)
- fun extensions: Array[String] do return query_string(0x3055).split_with(" ")
+ fun extensions: Array[String] do return query_string(0x3055).trim.split_with(" ")
fun client_apis: Array[String] do return query_string(0x308D).split_with(" ")
fun client_apis: Array[String] do return query_string(0x308D).split_with(" ")