home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 16
/
CD_ASCQ_16_0994.iso
/
news
/
572
/
xgrafic2
/
util
/
edpixel.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-07-20
|
8KB
|
311 lines
{EDPIXEL : Programme qui permet de créer des boutons graphiques}
{Ces sprites,boutons,etc... sont ensuite utilisables par XGRAPHIC pour Turbo pascal}
{dans tous les modes graphiques disponibles}
program edibouton;
{Réalisé avec fonctions de XGRAPHIC v2.0 pour Pascal}
{Dominique DELAIRE - 1994}
Uses XGRAPHIC, GRAPH, CRT;
var boucle,passage : integer;
a : integer;
coulcour : integer;
b,c : integer;
d,e : integer;
fichier : string;
F : File;
img : Pointer;
Size,pixelcolor : word;
procedure dessclcour(num : integer);
begin
panneau3d(590,10,610,30,num);
end;
procedure dessmatrice;
begin
setcolor(15);
a := 0;
while a <= 25
do begin
line(190,100 + (a * 10),440,100 + (a * 10));
line(190 + (a * 10),100,190 + (a * 10),350);
a := a + 1;
end;
end;
procedure colorepointgrille(x1,y1,x2,y2,num : integer);
begin
remplissage(x1,y1,x2,y2,num);
end;
{PROGRAMME PRINCIPAL}
BEGIN
modevga480;
initsouris;
affichesouris;
coulcour := 0;
boucle := 0;
passage := 0;
while boucle = 0
do begin
if passage = 0
then begin
cachesouris;
efface;
affichepcx('edpixel.pcx');
cadre3d(570,40,620,480,7);
panneau3din(580,70,610,472,7);
Choisirpolice(2,2);
texte3d(580,50,16,15,'COULEURS');
{couleurs possibles}
panneau3d(585,75,605,95,1);
panneau3d(585,100,605,120,2);
panneau3d(585,125,605,145,3);
panneau3d(585,150,605,170,4);
panneau3d(585,175,605,195,5);
panneau3d(585,200,605,220,6);
panneau3d(585,225,605,245,7);
panneau3d(585,250,605,270,8);
panneau3d(585,275,605,295,9);
panneau3d(585,300,605,320,10);
panneau3d(585,325,605,345,11);
panneau3d(585,350,605,370,12);
panneau3d(585,375,605,395,13);
panneau3d(585,400,605,420,14);
panneau3d(585,425,605,445,15);
panneau3d(585,450,605,470,16);
dessclcour(coulcour);
Choisirpolice(2,4);
panneau3din(190,50,216,76,16);
choisirpolice(2,4);
icone3d(130,400,220,425,7,16,' QUITTER');
icone3d(230,400,320,425,16,2,' CHARGER');
icone3d(330,400,420,425,16,2,' SAUVER');
afficheXgr(430,400,'new.xgr');
remplissage(190,100,440,350,16);
dessmatrice;
EffetChaine(10,5,11,'EDPIXEL - Dominique Delaire - 1994');
EffetChaine(10,15,14,'Editeur de Boutons,de petits sprites,etc... pour Xgraphic');
affichesouris;
passage := 1;
end;
{QUITTER}
if clickobjet(130,400,220,425) = 1
then begin
efface;
cachesouris;
finmodegraphique;
halt;
end;
{CHARGER}
{on demande le nom du fichier}
if clickobjet(230,400,320,425) = 1
then begin
cadre3d(10,315,110,360,1);
choisirpolice(2,2);
texte(20,320,11,'FICHIER :');
fichier := SaisieChaine3din(8,20,328,16,14);
remplissage(10,315,110,360,9);
{CHARGE IMAGE A PARTIR DU FICHIER DISQUE}
{$I-}
assign(F,fichier+'.XGR');
reset(F,1);
if ioresult = 0
then begin
size := FileSize(F);
Getmem(Img,Size);
Blockread(F,img^,size);
close(F);
Putimage(191,51,img^,normalput);
Freemem(Img,size);
end;
{Remplissage de la grille}
b := 0;
while b < 25
do begin
b := b + 1;
c := 0;
while c < 25
do begin
c := c + 1;
Pixelcolor := getpixel(190 + b,50 + c);
colorepointgrille(181 + (10 * b),91 + (10 * c),181 + (10 * b) + 9,91 + (10 * c) + 9,pixelcolor);
end;
end;
dessmatrice;
end;
{SAUVER}
{on demande le nom du fichier}
if clickobjet(330,400,420,425) = 1
then begin
cadre3d(10,315,110,360,1);
choisirpolice(2,2);
texte(20,320,11,'FICHIER :');
fichier := SaisieChaine3din(8,20,328,16,14);
remplissage(10,315,110,360,9);
{SAUVEGARDE IMAGE SUR FICHIER DISQUE}
size := ImageSize(191,51,215,75);
Getmem(Img,Size);
Getimage(191,51,215,75,img^);
assign(F,fichier+'.XGR');
rewrite(F,1);
Blockwrite(F,img^,size);
close(F);
Freemem(Img,size);
end;
{NEW}
{On efface la grille et le panneau correspondant}
if clickobjetxgr(430,400) = 1
then begin
remplissage(190,100,440,350,16);
dessmatrice;
panneau3din(190,50,216,76,16);
end;
{CLICK_COULEUR}
if clickobjet(585,75,605,95) = 1
then begin
coulcour := 1;
dessclcour(coulcour);
end;
if clickobjet(585,100,605,120) = 1
then begin
coulcour := 2;
dessclcour(coulcour);
end;
if clickobjet(585,125,605,145) = 1
then begin
coulcour := 3;
dessclcour(coulcour);
end;
if clickobjet(585,150,605,170) = 1
then begin
coulcour := 4;
dessclcour(coulcour);
end;
if clickobjet(585,175,605,195) = 1
then begin
coulcour := 5;
dessclcour(coulcour);
end;
if clickobjet(585,200,605,220) = 1
then begin
coulcour := 6;
dessclcour(coulcour);
end;
if clickobjet(585,225,605,245) = 1
then begin
coulcour := 7;
dessclcour(coulcour);
end;
if clickobjet(585,250,605,270) = 1
then begin
coulcour := 8;
dessclcour(coulcour);
end;
if clickobjet(585,275,605,295) = 1
then begin
coulcour := 9;
dessclcour(coulcour);
end;
if clickobjet(585,300,605,320) = 1
then begin
coulcour := 10;
dessclcour(coulcour);
end;
if clickobjet(585,325,605,345) = 1
then begin
coulcour := 11;
dessclcour(coulcour);
end;
if clickobjet(585,350,605,370) = 1
then begin
coulcour := 12;
dessclcour(coulcour);
end;
if clickobjet(585,375,605,395) = 1
then begin
coulcour := 13;
dessclcour(coulcour);
end;
if clickobjet(585,400,605,420) = 1
then begin
coulcour := 14;
dessclcour(coulcour);
end;
if clickobjet(585,425,605,445) = 1
then begin
coulcour := 15;
dessclcour(coulcour);
end;
if clickobjet(585,450,605,470) = 1
then begin
coulcour := 16;
dessclcour(coulcour);
end;
{CLICK_SUR_LA_GRILLE}
b := 0;
while b < 25
do begin
b := b + 1;
c := 0;
while c < 25
do begin
c := c + 1;
if clickobjet(181 + (10 * b),91 + (10 * c),181 + (10 * b) + 9,91 + (10 * c) + 9) = 1
then begin
cachesouris;
colorepointgrille(181 + (10 * b),91 + (10 * c),181 + (10 * b) + 9,91 + (10 * c) + 9,coulcour);
putpixel(190 + b,50 + c,coulcour);
dessmatrice;
affichesouris;
end;
end;
end;
end;
END.