hansb@ariel.unm.edu.unm.edu (Hans Bechtel) (02/12/88)
In Turbo C for the big blue computer, there exists a command called "gotoxy(x,y)" that is used to move to a certain column/row on the screen. Does anybody have a superfast source for that one in Amiga assembly, or in lattice C? I do not need one that requires the Text mode, just one that uses the common printf and scanf and other "ordinary" commands. Also, does anybody have any special routines of any type that they could share to the net?? Hans Bechtel
cmcmanis%pepper@Sun.COM (Chuck McManis) (02/17/88)
In article <2288@charon.unm.edu> hansb@ariel.unm.edu.UUCP (Hans Bechtel) writes: > In Turbo C for the big blue computer, there exists a command called > "gotoxy(x,y)" that is used to move to a certain column/row on the > screen. Well, you could always use the Ansi cursor positioning sequence for any console window, you know the one that goes $[row;colH (row and col are ascii strings and $ is the escape character). You could use printf("\033[%d;%dH",row,col); which would move your cursor for you. To the indicated row and column remember that row and column numbers start at 1. If you just wanted to move the graphics 'pointer', which is where the next line will be drawn, you use Move(rp,col,row); which would move to the Pixel addressed by (col,row). Following this with Draw(rp,newcol,newrow); Would draw a line from (col,row) to (newcol,newrow). Note that rp is a RastPort, and for a console device window you will have to ask the console device where its Window structure is to get the correct rastport. An example of this is given in ConsPackets.c (available on a Fish disk, on BIX, and probably in the comp.sources.amiga archives). > Does anybody have a superfast source for that one in Amiga assembly, > or in lattice C? It doesn't get anyfaster than this. > I do not need one that requires the Text mode, just one that uses > the common printf and scanf and other "ordinary" commands. Doing line draws with printf is impossible, but as you can see above you can use 'ordinary' Move and Draw commands to your hearts content, just pick up a copy of the RastPort first. And if your window is not a console device and you want to do character addressing anyway, then they thing to use are the macros #define CHARPOS(rp,x,y) Move(rp,x*rp->TxWidth,y*rp->TxHeight+rp->TxBaseline) --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com These opinions are my own and no one elses, but you knew that didn't you.