Support for First Live WallPaper

109 views
Skip to first unread message

Renjith KN

unread,
Oct 19, 2012, 6:45:37 AM10/19/12
to glwallpap...@googlegroups.com
Hi ALL,

I am trying to develop my first live wallpaper,
I created a simple sprite animation on another project and I am able to run our example of rotating triangle. 
I need to bring my sprite animation to my wallpaper
But the problem is I don't know how to load my texture atlas or other files when I am using GL wallpaper service,
The real pain is I don't know how to get the context to read files from assets or resources
Please any one help me...
Sample codes are much appreciated

Thank you guys

Mukul Dhankhar

unread,
Oct 19, 2012, 7:33:36 AM10/19/12
to glwallpap...@googlegroups.com
I can tell you how I do it. I don't have a neat sample code handy, but
I can give you an example below.

So 'GLWallpaperService' creates an 'Engine', which in turn creates the
'Renderer'. It's in your Renderer that you need
to access image or other resources. So I pass an instance of resources
to the constructor of the Renderer.

MyWallpaperService.java:
public class MyWallpaperService extends GLWallpaperService
{
.....
MyEngine engine = new MyEngine();
.....

class MyEngine extends GLEngine
{
MyRenderer myRend = new MyRenderer( getResources());
// Pass the instance of resources to the Renderer
}
}


MyRenderer.java:
public class MyRenderer implements GLWallpaperService.Renderer
{

public MyRenderer(Resources appR)
{
// now you can use appR to access your resources. ex To access an
image called 'myjpgimage' in the res/raw use appR.raw.myjpgimage
}
}

Hope that helps.
Mukul.

Renjith KN

unread,
Oct 19, 2012, 2:36:21 PM10/19/12
to glwallpap...@googlegroups.com
Thank you Mukul,

That was such a wonderful helping example  for me that i can't  express how much it helps me to sort out these things
Again Very very thank you MAN.......................

with Regards,
Renjith K N
Reply all
Reply to author
Forward
0 new messages