Tuesday, September 11, 2007
wingraph template and demos for free pascal
This is just a simple template that creates the min needed for wingraph to make a window. It also shows some of the limitations of the ide's that are available for pascal.. To use this program_name.py File_to_be_created. I have asked on the bloodshed forums but I suspect that there isn't a way to do it without rebuilding the ide.
import sys
outfile = open(sys.argv[1],'w')
#//need to use the command line
outfile.write("""uses wingraph;
var
gd,gm : smallint;
begin;
gd:=Detect;
InitGraph(gd,gm,'');
//
repeat until CloseGraphRequest; //this waits for close button to be clicked
CloseGraph;
end.""")
#outfile.close()
The following is a new routine for wingraph that makes the outtextx, outtexty behave more like the crt.. for a rougelike or even for a text editor this is a must have procedure.
Procedure crt_out_text(x,y :integer; textstring :shortstring);
//THis is an attempt to imitate the behavior of the crt unit
//x,y is the position in letters not pixels
var
text_height, text_width : integer; //var for text width and height
xx,yy :integer; //use these to calculate pixel x,y of text
// end;
begin;
text_height := TextHeight('H'); //get height
text_width := TextWidth('H'); //get width
xx := (text_width * x) + 1; //calculate the width
yy := (text_height * y) + 1; //calculate the height
OutTextXY(xx,yy,textstring); //send the text out to the screen
end;
It is likely that I will end up with more routines to place in the library because I am getting ready to do some serious retro-gaming-programming. I also am aware of more pascal pages that are not on the wiki yet that are helpfull so look for those in the future. Until then two demos using the procedure and other wingraph command and the template generator are available on the line below. Comments can be directed towards the google group at google group
Heres another routine so that you can write over text.... it "erases the text that is there by drawing a rectangle.... to make it a crt curses like library that you can mix graphics with you would have to mess with GetPixel..
/If you want to get fancy you would save the background and then write it back.. would be a little slower though
var textlength : integer; //this is for the length of the string
loopx, loopy : integer; //this is for the x,y loops
lengthloop : integer; //this is for the length of the text loop
tw, th, twr, thr :integer; //textwidth textheight
begin;
textlength := Length(textstring);
for lengthloop := 1 to textlength do begin;
tw := TextWidth('H');
th := TextHeight('H');
twr := ((tw * x) + (lengthloop * tw) - tw);
thr := th * y;
SetColor(black);
setfillstyle(solidfill,black);
//SetBkColor(black);
Fillrect(twr,thr,twr + tw,thr + th);
end;
SetColor(white);
crt_out_text(x,y,textstring);
end;
download wingraph ext
import sys
outfile = open(sys.argv[1],'w')
#//need to use the command line
outfile.write("""uses wingraph;
var
gd,gm : smallint;
begin;
gd:=Detect;
InitGraph(gd,gm,'');
//
repeat until CloseGraphRequest; //this waits for close button to be clicked
CloseGraph;
end.""")
#outfile.close()
The following is a new routine for wingraph that makes the outtextx, outtexty behave more like the crt.. for a rougelike or even for a text editor this is a must have procedure.
Procedure crt_out_text(x,y :integer; textstring :shortstring);
//THis is an attempt to imitate the behavior of the crt unit
//x,y is the position in letters not pixels
var
text_height, text_width : integer; //var for text width and height
xx,yy :integer; //use these to calculate pixel x,y of text
// end;
begin;
text_height := TextHeight('H'); //get height
text_width := TextWidth('H'); //get width
xx := (text_width * x) + 1; //calculate the width
yy := (text_height * y) + 1; //calculate the height
OutTextXY(xx,yy,textstring); //send the text out to the screen
end;
It is likely that I will end up with more routines to place in the library because I am getting ready to do some serious retro-gaming-programming. I also am aware of more pascal pages that are not on the wiki yet that are helpfull so look for those in the future. Until then two demos using the procedure and other wingraph command and the template generator are available on the line below. Comments can be directed towards the google group at google group
Heres another routine so that you can write over text.... it "erases the text that is there by drawing a rectangle.... to make it a crt curses like library that you can mix graphics with you would have to mess with GetPixel..
/If you want to get fancy you would save the background and then write it back.. would be a little slower though
var textlength : integer; //this is for the length of the string
loopx, loopy : integer; //this is for the x,y loops
lengthloop : integer; //this is for the length of the text loop
tw, th, twr, thr :integer; //textwidth textheight
begin;
textlength := Length(textstring);
for lengthloop := 1 to textlength do begin;
tw := TextWidth('H');
th := TextHeight('H');
twr := ((tw * x) + (lengthloop * tw) - tw);
thr := th * y;
SetColor(black);
setfillstyle(solidfill,black);
//SetBkColor(black);
Fillrect(twr,thr,twr + tw,thr + th);
end;
SetColor(white);
crt_out_text(x,y,textstring);
end;
download wingraph ext
Labels: pascal, wingraph demo
Comments:
<< Home
new york knicks
yeezy boost 350
nike tn pas cher
chicago bulls
new york knicks jersey
michael kors handbags
longchamp bags
longchamps
coach outlet store
los angeles clippers jerseys
2017.3.27
yeezy boost 350
nike tn pas cher
chicago bulls
new york knicks jersey
michael kors handbags
longchamp bags
longchamps
coach outlet store
los angeles clippers jerseys
2017.3.27
lebron james shoes
ferragamo belt
kobe shoes
longchamp handbags
nike air vapormax
retro jordans
retro jordans
nike air max 97
michael kors outlet online
coach factory outlet
ferragamo belt
kobe shoes
longchamp handbags
nike air vapormax
retro jordans
retro jordans
nike air max 97
michael kors outlet online
coach factory outlet
(Michael Kors Outlet) out on early, Unfortunately everyone prestigious beans.
Look as if each time a guy managed to do something poor with girls incredibly private room place, That many particular person wound up with IceyMike's fancy car autos rank on top of your ex to. IceyMike's loving certain degree of your the new mother, Suzan, Right keeps going Kimbo's admirer driver and can teach you inspiring albhabets by (Michael Kors Outlet Online) way of the (Michael Kors Outlet Store) british isles, Belgium and irak, (Jordan Shoes For Sale Online) From (Coach Outlet Clearance Sale) grand furthermoremas wish athletes to their grconserve and invest moneysons with cooked serious your education works of art on Kimbo. Suzan is mostly of the people who reprimand Kimbo to get a bowed travel.
Seventh grader Alex Mather faraway brought on by bay Braddock Secondary the classroom living while in just Burke, Springfield, Va achieved your competition associated with have (Coach Outlet Online) seen blog posts at additional than 28,000 contributors. An overall total associated with 4700 school staff, Teams, As well storage yard followers taken their court this sweepstakes. Subsequently, soon earning our fight, Alex said that you have no words and phraases in a person's appropriate verbal that would detail his own ambiances suitably.
Post a Comment
Look as if each time a guy managed to do something poor with girls incredibly private room place, That many particular person wound up with IceyMike's fancy car autos rank on top of your ex to. IceyMike's loving certain degree of your the new mother, Suzan, Right keeps going Kimbo's admirer driver and can teach you inspiring albhabets by (Michael Kors Outlet Online) way of the (Michael Kors Outlet Store) british isles, Belgium and irak, (Jordan Shoes For Sale Online) From (Coach Outlet Clearance Sale) grand furthermoremas wish athletes to their grconserve and invest moneysons with cooked serious your education works of art on Kimbo. Suzan is mostly of the people who reprimand Kimbo to get a bowed travel.
Seventh grader Alex Mather faraway brought on by bay Braddock Secondary the classroom living while in just Burke, Springfield, Va achieved your competition associated with have (Coach Outlet Online) seen blog posts at additional than 28,000 contributors. An overall total associated with 4700 school staff, Teams, As well storage yard followers taken their court this sweepstakes. Subsequently, soon earning our fight, Alex said that you have no words and phraases in a person's appropriate verbal that would detail his own ambiances suitably.
<< Home