# limitations under the License.
# OpenGL ES1 general support (most of it)
-module opengles1 is pkgconfig("glesv1_cm", "x11", "egl")
+module opengles1 is pkgconfig("glesv1_cm", "egl")
import mnit_display
in "C header" `{
#include <EGL/egl.h>
#include <GLES/gl.h>
- #define GL_GLEXT_PROTOTYPES 1
- #include <GLES/glext.h>
- #include <errno.h>
EGLDisplay mnit_display;
EGLSurface mnit_surface;
EGLConfig mnit_config;
int32_t mnit_width;
int32_t mnit_height;
- float mnit_zoom;
struct mnit_opengles_Texture {
GLuint texture;
mnit_config = config;
mnit_width = w;
mnit_height = h;
- mnit_zoom = 1.0f;
LOGI("surface", (int)surface);
LOGI("display", (int)display);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(x, x+w, y+h, y, 0.0f, 1.0f);
- mnit_zoom = ((float)w)/mnit_width;
glMatrixMode(GL_MODELVIEW);
glFrontFace( GL_CW );
`}
- redef fun blit( image, x, y ) is extern `{
+ redef fun blit(image, x, y) do native_blit(image, x.to_f, y.to_f)
+
+ private fun native_blit(image: Opengles1Image, x, y: Float) `{
GLfloat texture_coord[4][2] =
{
{image->src_xo, image->src_yi},
}
`}
- redef fun blit_centered( img, x, y )
+ redef fun blit_centered(img, x, y)
do
- x = x - img.center_x
- y = y - img.center_y
- blit( img, x, y )
+ x = x.sub(img.center_x)
+ y = y.sub(img.center_y)
+ blit(img, x, y)
end
- redef fun blit_rotated( image, x, y, angle ) is extern `{
+ redef fun blit_rotated(image, x, y, angle) do native_blit_rotated(image, x.to_f, y.to_f, angle)
+
+ private fun native_blit_rotated(image: Opengles1Image, x, y, angle: Float) `{
GLfloat texture_coord[4][2] =
{
{image->src_xo, image->src_yi},
`}
# a = top left, b = bottom left, c = bottom right, d = top right
- redef fun blit_stretched( image, ax, ay, bx, by, cx, cy, dx, dy ) is extern `{
+ redef fun blit_stretched(image, ax, ay, bx, by, cx, cy, dx, dy)
+ do
+ native_blit_stretched(image,
+ ax.to_f, ay.to_f, bx.to_f, by.to_f,
+ cx.to_f, cy.to_f, dx.to_f, dy.to_f)
+ end
+
+ private fun native_blit_stretched(image: I, ax, ay, bx, by, cx, cy, dx, dy: Float) `{
GLfloat texture_coord[4][2] =
{
{image->src_xo, image->src_yi},