Hey everyone, I dunno how helpful this could be but I had a heck of a time getting the concept down so I'll release some working code that I believe to be a great example. My original goal was a menu system before ever loading map and or player models and all the stuff needed for a game (this also works for loading screens if used right) so it's a lil complex for the simplicity I was looking for but still more simple than using Nifty GUI (at least for me) and I think the overhead should be less as well, anyway to the code:

Setting up the object:This is an example of a game menu, it's a small black box that is centered and only uses a portion of the screen

//After the bitmap has been created with paint, this texture is what's rendered //I believe I'm going to remove the need for Paint and Canvas soon, and just require texture friendly sizes. private Texture menuTexture;

public void draw(FrameBuffer fb){ if(show){ //Take the created background and show it first (remember this is either a solid color or some supplied background image) fb.blit(menuTexture, 1, 1, X, Y, Width, Height, false); //Then draw each element on top of it. This is set up so that each element is a texture (or part of a texture) so they can be //manipulated in real time for(int i = 0; i < elementCount; i++){ elements[i].Blit(fb); } } }

///I know fixXY is in buttons too but the approach is different enough that seperate functions are needed ///This is for aligning the menu in the game screen, supplying negative values offests from the opposite side ///if you don't set gameHeight or gameWidth it will assume the menu you're supplying covers the entire screen public void FixXY(){ if(X == Menu.CENTER){ X = (gameWidth/2)-(Width/2); } if(Y == Menu.CENTER){ Y = (gameHeight/2)-(Height/2); } }

///This is the most annoying part of adding an element, but it's pretty straight forward //name: whatever you want for the element, also used against touch events //width and height: the size of the final element you want on screen ///this determins the touch size if you use this as a button //this also determins what on the source bitmap is copied //destX destY: where on the menu to place this button it's relative to the menu size and placement //srcX srcY: the texture image you are blitting, where in that texture do you want to start copying the element public void addElement(String name, int width, int height, int destX, int destY, int srcX, int srcY, Texture image){ //I read a long page about performance in Android and I specifically remember //setting the variable directly is faster than a getter or a setter so hey might as well do what I can elements[elementCount] = new Element(name); elements[elementCount].image = image; elements[elementCount].width = width; elements[elementCount].height = height; elements[elementCount].destX = destX; elements[elementCount].destY = destY; elements[elementCount].srcX = srcX; elements[elementCount].srcY = srcY; elements[elementCount].Width = Width; elements[elementCount].Height = Height; elements[elementCount].X = X; elements[elementCount].Y = Y; elements[elementCount].fixXY(); elementCount++; }

-I've done a bit of work on it today, now creating a menu that's not the entire size of the screen is possible--Ok, I went through and cleared up a bunch of junk, buttons are now elements, and elements can have a touch event checked against them---Added some comments and small fixes here and there

I am working on making three menus right now, one that's called at the game start and when you're not in game, one that's called while in the game and you hit the settings button on the android phone( this one will contain things like 'End Game', 'Change Settings', etc) and the last menu object will be a settings menu, that's called when you select 'Change Settings'

Thank you man! I'm back from my vacation and about to continue my project. Your GUI Code seams to be perfect for my intentions, so I'll give it a try today and report back, if everything works fine. If I'll have to modifie something, I'll report too.

Thanks rhine, But doing so wouldn't magically make jPCT's blit include a transparency variable. I'm assuming if I supply a PNG with some transparency it would be transparent but I haven't tested it. I just don't know how to supply an alpha to blit.