Merge: glesv2: more services from OpenGL ES 2.0 to prepare for gamnit
authorJean Privat <jean@pryen.org>
Mon, 14 Sep 2015 20:23:01 +0000 (16:23 -0400)
committerJean Privat <jean@pryen.org>
Mon, 14 Sep 2015 20:23:01 +0000 (16:23 -0400)
This PR adds a few services to the low-level graphics modules to prepare for gamnit.

This is the 2nd PR to use a new style for the glesv2 module. The old code has not yet been fully updated, so the style may vary in the same module. The new style try to stay as close as possible to the names and signatures used by the OpenGL ES 2.0 C API and by webgl.

As usual with this module, for more documentation please refer to the official doc at https://www.khronos.org/opengles/sdk/docs/man/.

Pull-Request: #1708
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

contrib/friendz/res/raw/music.ogg [new file with mode: 0644]
lib/android/audio.nit

diff --git a/contrib/friendz/res/raw/music.ogg b/contrib/friendz/res/raw/music.ogg
new file mode 100644 (file)
index 0000000..8dcfa3b
Binary files /dev/null and b/contrib/friendz/res/raw/music.ogg differ
index b729219..b361b4f 100644 (file)
@@ -138,7 +138,6 @@ private extern class NativeMediaPlayer in "Java" `{ android.media.MediaPlayer `}
                        self.setDataSource(fd, start_offset, length);
                        return 1;
                }catch(Exception e) {
-                       Log.e("Error loading the Media Player with a file descriptor", e.getMessage());
                        return 0;
                }
        `}
@@ -537,8 +536,8 @@ redef class Sound
        end
 
        redef fun play do
-               if self.error != null then return
                if not is_loaded then load
+               if self.error != null then return
                soundpool.play(soundpool_id)
        end
 
@@ -599,8 +598,8 @@ redef class Music
        end
 
        redef fun play do
-               if self.error != null then return
                if not is_loaded then load
+               if self.error != null then return
                media_player.start
        end