Merge: Give top-level methods some rules
[nit.git] / lib / mnit / opengles1.nit
index 347613f..dd5af2d 100644 (file)
@@ -15,9 +15,9 @@
 # limitations under the License.
 
 # OpenGL ES1 general support (most of it)
-module opengles1
+module opengles1 is pkgconfig("glesv1_cm", "x11", "egl")
 
-import display
+import mnit_display
 
 in "C header" `{
        #include <EGL/egl.h>
@@ -421,9 +421,17 @@ class Opengles1Display
                glClearColor( r, g, b, a );
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        `}
+
+       # Set the current color applied to all drawing
+       #
+       # require: r, g, b, a in [0.0 .. 1.0]
+       fun color(r, g, b, a: Float) `{ glColor4f(r, g, b, a); `}
+
+       # Reset the current color to opaque white
+       fun reset_color `{ glColor4f(1.0f, 1.0f, 1.0f, 1.0f); `}
 end
 
-extern Opengles1Image in "C" `{struct mnit_opengles_Texture *`}
+extern class Opengles1Image in "C" `{struct mnit_opengles_Texture *`}
        super Image
 
     redef fun destroy is extern `{ free( recv ); `}
@@ -467,7 +475,7 @@ extern Opengles1Image in "C" `{struct mnit_opengles_Texture *`}
 end
 
 # FIXME this class is broken
-extern Opengles1DrawableImage in "C" `{struct mnit_opengles_DrawableTexture*`}
+extern class Opengles1DrawableImage in "C" `{struct mnit_opengles_DrawableTexture*`}
        super DrawableImage
     new ( w, h: Int ) is extern `{
                struct mnit_opengles_DrawableTexture *image =