Extend Out Animation in AndEngine ?

  ... the case you feel the need for a new feature or want to submit one.

Extend Out Animation in AndEngine ?

Postby akv_2006 » Fri Aug 31, 2012 7:54 am

Hi All,
I'm new to Android and AndEngine.
I want to know, What's the alternative of setClip() method(J2me) in Andengine?
I want to achieve animation like in attached file.
Please help.

Thanks in Advance !!!!
Last edited by akv_2006 on Fri Nov 09, 2012 9:14 am, edited 2 times in total.
akv_2006
 
Posts: 11
Joined: Fri Aug 31, 2012 7:23 am

Re: Alternative of setClip() method ?

Postby akv_2006 » Fri Aug 31, 2012 7:28 pm

Or alternatively can i display attached gif as it is, without any memory issue / distortion in image quality. And how to do that?
akv_2006
 
Posts: 11
Joined: Fri Aug 31, 2012 7:23 am

Re: Alternative of setClip() method ?

Postby akv_2006 » Sun Sep 02, 2012 6:10 am

Plz help me out.
Whether Shaders will do the job? But I guess its supported only in android 2.2 and above. Am I right?
I want to support all the versions above 1.5. Please Help!!
akv_2006
 
Posts: 11
Joined: Fri Aug 31, 2012 7:23 am

Re: Extend Out Animation in AndEngine ?

Postby akv_2006 » Thu Sep 06, 2012 1:38 pm

Hey All,
Is there anyone who can answer me. Plz.
akv_2006
 
Posts: 11
Joined: Fri Aug 31, 2012 7:23 am

Re: Extend Out Animation in AndEngine ?

Postby korn3l » Thu Sep 06, 2012 7:45 pm

https://github.com/nicolasgramlich/AndE ... ntity.java

There's a Clip Entity in the Anchor Branch , maybe this helps you. I never worked with gles1, but I think that this can be done.

Hope this helps you.
korn3l
 
Posts: 214
Joined: Thu Apr 12, 2012 4:20 pm
Location: Iasi, Romania

Re: Extend Out Animation in AndEngine ?

Postby akv_2006 » Fri Oct 12, 2012 1:39 pm

Thanks korn3l....
but that is not of much help i tried
akv_2006
 
Posts: 11
Joined: Fri Aug 31, 2012 7:23 am

Re: Extend Out Animation in AndEngine ?

Postby OzLark » Fri Oct 12, 2012 2:33 pm

Are you using GLES1 or GLES2?
Did this post help you? Feel free to return the gesture by downloading Ninja Bees, creating a level (or more) and sharing it to the Ninja Bees website!

Ninja Bees - Our latest Android game, check it out on Google Play (free) or paid with no ads
OzLark
 
Posts: 1130
Joined: Sun Feb 05, 2012 3:19 am

Re: Extend Out Animation in AndEngine ?

Postby akv_2006 » Fri Oct 12, 2012 3:33 pm

i'm using GLES1. I converted ur code to suit GLES1. but didn't got satisfactory output on all the devices(working fine on htc desire but not on motorolla). However Alternatively I used scale modifier which somewhat mimic the required output....
akv_2006
 
Posts: 11
Joined: Fri Aug 31, 2012 7:23 am

Re: Extend Out Animation in AndEngine ?

Postby OzLark » Fri Oct 12, 2012 4:04 pm

akv_2006 wrote:i'm using GLES1. I converted ur code to suit GLES1. but didn't got satisfactory output on all the devices(working fine on htc desire but not on motorolla). However Alternatively I used scale modifier which somewhat mimic the required output....


What code did you try? What was unsatisfactory about it? Did you try using glScissor()?

This code is for GLES2 but should be almost identical for GLES1 - and you should be able to modify this to get the effect you want.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class ClippedRectangle extends Rectangle {
  2.  
  3.         private final float point[] = new float[2];
  4.         private boolean clippingOn = true;
  5.  
  6.         public ClippedRectangle(float pX, float pY, float pWidth, float pHeight, VertexBufferObjectManager pVertexBufferObjectManager) {
  7.                 super(pX, pY, pWidth, pHeight, pVertexBufferObjectManager);    
  8.         }
  9.        
  10.         public void setClippingOn(boolean value) {
  11.                 clippingOn = value;
  12.         }
  13.  
  14.         @Override
  15.         protected void onManagedDraw(final GLState pGLState, final Camera pCamera) {
  16.  
  17.                 if (clippingOn) {
  18.  
  19.                         int clipX = (int) 0;
  20.                         int clipY = (int) 0;
  21.                         int clipW = (int) mWidth;
  22.                         int clipH = (int) mHeight;
  23.  
  24.                         this.convertLocalToSceneCoordinates(0, 0, point);
  25.  
  26.                         pGLState.pushModelViewGLMatrix();
  27.                         {
  28.                                 GLES20.glEnable(GLES20.GL_SCISSOR_TEST);
  29.  
  30.                                 // Calculation for y position
  31.                                 // 1. clip y + global y = global clip y
  32.                                 // 2. global clip y + clip height = bottom of clip
  33.                                 // 3. camera height - bottom of clip = y position from bottom edge
  34.                                 // 4. y position from bottom edge * ratio = y position in display size for glScissor()
  35.  
  36.                                 final float screenRatioX = 1.0f;
  37.                                 final float screenRatioY = 1.0f;
  38.                                 final float cameraH = pCamera.getHeightRaw();
  39.  
  40.                                 // @formatter:off
  41.                 GLES20.glScissor(
  42.                         Math.round(((clipX + point[0])) * screenRatioX),
  43.                         Math.round((cameraH - ((clipY + point[1]) + clipH)) * screenRatioY),
  44.                         Math.round(clipW * screenRatioX),
  45.                         Math.round(clipH * screenRatioY));
  46.                 // @formatter:on
  47.  
  48.                                 super.onManagedDraw(pGLState, pCamera);
  49.  
  50.                                 GLES20.glDisable(GLES20.GL_SCISSOR_TEST);
  51.  
  52.                         }
  53.                         pGLState.popModelViewGLMatrix();
  54.                 } else {
  55.                         super.onManagedDraw(pGLState, pCamera);
  56.                 }
  57.         }
  58.  
  59. }
Parsed in 0.014 seconds, using GeSHi 1.0.8.4
Did this post help you? Feel free to return the gesture by downloading Ninja Bees, creating a level (or more) and sharing it to the Ninja Bees website!

Ninja Bees - Our latest Android game, check it out on Google Play (free) or paid with no ads
OzLark
 
Posts: 1130
Joined: Sun Feb 05, 2012 3:19 am

Re: Extend Out Animation in AndEngine ?

Postby akv_2006 » Mon Oct 15, 2012 9:40 am

hi OzLark ,

When I tried on htc desire(480x800), with below code
rect = new ClippedRectangle(0,0,100,100) ;

Sprite mysprite= new Sprite(10,10,100,100)
mysprite.attachChild(rect );//I want my whole sprite area to be clipped

thats fine, but when i tried the same apk on motorola(320x480)
my clipping area goes beyond the mysprite area


Is that because of resolution of the devices or something else???
Last edited by akv_2006 on Tue Oct 16, 2012 8:22 am, edited 2 times in total.
akv_2006
 
Posts: 11
Joined: Fri Aug 31, 2012 7:23 am

Next

Return to Features

Who is online

Users browsing this forum: No registered users and 6 guests