Hi there,
i am at the moment attempting to get my head round all this java and android
stuff in the hope to making one of my games run on the android platform.
The game i am hoping to port / convert is a tile base puzzle game, where you
put pices onto a board, these pieces are shapes of different colours.
Right now all my stuff is C and SDL based, so to create the pieces i have a
grey shaded image of the shape, a black outline of the shape, and several
colour textures, so to save having hundreds of images of all the shapes in
all the colours, i create all the game pieces in the code, by putting the
colour onto the grey with alpha, creating a coloured shape then overlaying
the outline then set a mask, creating my game coloured outlined and masked
game piece.
is there any fucntions in the android set that i can achieve this sort of
thing?
here is my original c code...
SDL_Surface *makeshape( int colourn , int shapen )
{
// handlers for working surfaces
SDL_Surface *surface ;
SDL_Surface *image ;
SDL_Surface *color;
SDL_Surface *shae;
SDL_Surface *shaem;
// sdl rect to choose areas of surfaces
SDL_Rect pos;
// get the base images we are going to use
color=SDL_DisplayFormat(colour[colourn]);
shae=SDL_DisplayFormat(shape[shapen]);
shaem=SDL_DisplayFormat(shapem[shapen]);
// make the inside of the outline masked ready to go ober the shape at tyhe
end
setmaskwhite(shaem);
// create a random texture to plot over grey shape
surface=SDL_CreateRGBSurface(SDL_SWSURFACE, PCS, PCS, 32, rmask, gmask,
bmask, amask);
pos.x=randoon(64)-64;
pos.y=randoon(64)-64;
SDL_BlitSurface(texbase[randoon(2)+1] , NULL , shae , &pos);
pos.x=randoon(64)-64;
pos.y=randoon(64)-64;
SDL_BlitSurface(texbase[randoon(2)+1] , NULL , shae , &pos);
pos.x=randoon(64)-64;
pos.y=randoon(64)-64;
// plot the colour over the grey shape creating a coloured shape
SDL_BlitSurface(color , NULL , shae , &pos);
// put the coloured shape into a fresh surface, not sure why this is here :/
SDL_BlitSurface(shae, NULL , surface , NULL);
// put the outline over the new coloured shape
SDL_BlitSurface(shaem, NULL , surface , NULL);
// set the outside of the shape to mask
setmaskblack(surface);
// create the final coloured outlined masked shape at current screen
settings
image = SDL_DisplayFormat(surface);
SDL_FreeSurface(surface);
SDL_FreeSurface(color);
SDL_FreeSurface(shae);
SDL_FreeSurface(shaem);
// return the new coloured shape
return image;
}
hope this all makes sence...
thanks.
Neil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---