link: http://game-editor.com/forum/tp-3662-Pa ... aker-.html
to start off:
put this code in the global code area,
- Code: Select all
void readpaint(char filename[255], int size, int clr1, int clr2, int clr3, int clr4)
{
FILE*bmp;
int image01[36][36];
int image101[36][36];
int image201[36][36];
int i, i2;
erase(clr1, clr2, clr3, clr4);
i = 0;
for(i = 0; i < 36; i++)
{
i2 = 0;
for(i2 = 0; i2 < 36; i2++)
{
image01[i][i2] = -1;
image101[i][i2] = -1;
image201[i][i2] = -1;
}
}
bmp = fopen(filename, "r+b");
fread(image01, sizeof(image01), 1, bmp);
fread(image101, sizeof(image101), 1, bmp);
fread(image201, sizeof(image201), 1, bmp);
fclose(bmp);
i = 0;
for(i = 0; i < 36; i++)
{
i2 = 0;
for(i2 = 0; i2 < 36; i2++)
{
if(image01[i][i2] > -1)
{
if(image01[i][i2] < 255 && image101[i][i2] < 255 && image201[i][i2] < 255)
{
setpen(image01[i][i2], image101[i][i2], image201[i][i2], 0, size);
putpixel(i * size, i2 * size);
}
}
}
}
}
//(c) Sgt Games 2007 by Sgt. Sparky
for use on any event you must place the image in the same folder or a folder near by,
its just like loading a variable.
here is the function in use taken apart:
- Code: Select all
readpaint("your file name.paint", image size 5 is default, colourtoreplacewhiteR, colourtoreplacewhiteG, colourtoreplacewhiteB, colourtoreplacewhitetransparency);
another examle with using a transparent background(will replace white.) and the default size of 5(the image as you draw it.) and the image name of player_left_01,
- Code: Select all
readpaint("player_left_01.paint", 5, 0, 0, 0, 1);
I will make a game of all painter images soon, and I will post the source.
and I will make a painter animator as well.
(All I must do is modify the image writing and reading which is alot more complex than the plain image reading function because of the way I read pixels and with the undo everything.)