void DrawFrame(int layer, int bitmapID, int x, int y, int width, int height, int tile, int cset){
Screen->SetRenderTarget(bitmapID);
Screen->Rectangle(0, 0, 0, 256, 224, 0, 1, 0, 0, 0, true, 128);
Screen->DrawTile(0, 0, 0, tile, 2, 2, cset, -1, -1, 0, 0, 0, 0, true, 128);
Screen->SetRenderTarget(RT_SCREEN);
//The Vertices.
Screen->DrawBitmap(layer, bitmapID, 0, 0, 8, 8, x, y, 8, 8, 0, true);
Screen->DrawBitmap(layer, bitmapID, 24, 0, 8, 8, x+width*8-8, y, 8, 8, 0, true);
Screen->DrawBitmap(layer, bitmapID, 0, 24, 8, 8, x, y+height*8-8, 8, 8, 0, true);
Screen->DrawBitmap(layer, bitmapID, 24, 24, 8, 8, x+width*8-8, y+height*8-8, 8, 8, 0, true);
//Horizontal Edges.
for(int i = 1; i < width - 1; i++){
int offset = 8;
if(i > width/2) offset += 8;
Screen->DrawBitmap(layer, bitmapID, offset, 0, 8, 8, x+(i*8), y, 8, 8, 0, true);
Screen->DrawBitmap(layer, bitmapID, offset, 24, 8, 8, x+(i*8), y+height*8-8, 8, 8, 0, true);
}
//Vertical Edges.
for(int i = 1; i < height - 1; i++){
int offset = 8;
if(i > width/2) offset += 8;
Screen->DrawBitmap(layer, bitmapID, 0, offset, 8, 8, x, y+(i*8), 8, 8, 0, true);
Screen->DrawBitmap(layer, bitmapID, 24, offset, 8, 8, x+width*8-8, y+(i*8), 8, 8, 0, true);
}
//Center Regions.
for(int i = 1; i < width - 1; i++){
int xoffset = 8;
if(i > width/2) xoffset += 8;
for(int j = 1; j < height - 1; j++){
int yoffset = 8;
if(j > height/2) yoffset += 8;
Screen->DrawBitmap(layer, bitmapID, xoffset, yoffset, 8, 8, x+i*8, y+j*8, 8, 8, 0, true);
}
}
}