Welcome, Guest. Please login or register.
July 31, 2010, 08:09:37 PM
Home Help Search Login Register
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base

Qbasicnews.com  |  Qbasic "like" compilers/interpreters  |  FB Discussion & Programming Help  |  FB Projects  |  Topic: Power ASCII Lib.. « previous next »
Pages: [1] 2 Print
Author Topic: Power ASCII Lib..  (Read 4254 times)
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
Power ASCII Lib..
« on: July 12, 2005, 12:01:09 AM »

Here is a lib to get some of the FreeBasic graphic commands as ASCII text, then some effects text commands! Try it out!! Test .bas included!

http://members.aol.com/rattrapmax6/download/pascii.zip

Code:

'GRAPHIC
ACSII_INIT
ASCII_LINE
ASCII_LINEB
ASCII_LINEBF
ASCII_PSET
ASCII_CIRCLE

'TEXT DISPLAY
ASCII_ALIGN
ASCII_TYPE
ASCII_ATYPE
ASCII_FADE
ASCII_AFADE
Logged

Kevin (x.t.r.GRAPHICS)

Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
Power ASCII Lib..
« Reply #1 on: July 12, 2005, 02:49:19 PM »

I updated that download.. repaired some bugs and added a new statment, Changelog and Keyword documentation added also..  :wink:
Logged

Kevin (x.t.r.GRAPHICS)

Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
Power ASCII Lib..
« Reply #2 on: July 15, 2005, 09:58:09 PM »

Download Updated! LINE bug repaired, Password input routine added,.. um,. just read the changelog.. lol.. and enjoy! ^_^
Logged

Kevin (x.t.r.GRAPHICS)

Dr_Davenstein
Na_th_an
*****
Posts: 2044



Power ASCII Lib..
« Reply #3 on: July 16, 2005, 02:08:47 AM »

Sorry for the late reply... I did check it out and it looks good. I might use it in a pure FB pinball game I'm making, if you don't mind.  Tongue
Logged
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
Power ASCII Lib..
« Reply #4 on: July 16, 2005, 12:46:18 PM »

Have you bumped your head or something? What's the point in making a library if you don't want any1 to use it? So, sure, I'd deffently be happy for any1 to use it..  :wink: .. Tho be on guard for any bugs, I think I got all the big problem causers, but there might be a few left that only turn up at certain uses that I've yet to come across..  Sad ... :wink:
Logged

Kevin (x.t.r.GRAPHICS)

MystikShadows
Ancient Guru
****
Posts: 542



WWW
Power ASCII Lib..
« Reply #5 on: July 16, 2005, 01:06:57 PM »

LOL RattTrap...that kind of library is called a proprietary library..roflmao
Logged

hen they say it can't be done, THAT's when they call me ;-).




need hosting:  http://www.jc-hosting.net
All about ASCII: http://www.ascii-world.com
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
Power ASCII Lib..
« Reply #6 on: July 16, 2005, 02:10:14 PM »

Um.. darnit,.. big words.. *Get dictionary* oh... lol  :lol:

If this has anything to do with not releasing the source, that's only because its a work-in-progress, not something I'm tring to bottle up... It is free to use, and will be, when done, open source..  :wink:
Logged

Kevin (x.t.r.GRAPHICS)

Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
Power ASCII Lib..
« Reply #7 on: July 16, 2005, 05:32:49 PM »

Um... well.... I fond a new bug, If you make a horzontal line:

---------------

And X1 is grater than X2, it locks up...  Sad sorting bug, should have that fixed soon...  :-? .....  :wink: And I thought the trig would give me the harder time, no, its my logic stuff... oh well..  :lol:
Logged

Kevin (x.t.r.GRAPHICS)

Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
Power ASCII Lib..
« Reply #8 on: July 16, 2005, 07:21:12 PM »

Download updated: Line bug fixed (Again  :-? it seems to be a moody routine), and I Ported my QuadGon Graphics demo to the lib for a really cool example!
Logged

Kevin (x.t.r.GRAPHICS)

Dr_Davenstein
Na_th_an
*****
Posts: 2044



Power ASCII Lib..
« Reply #9 on: July 16, 2005, 07:26:08 PM »

I have an excellent line algo, if you want to check it out. Wink
Logged
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
Power ASCII Lib..
« Reply #10 on: July 16, 2005, 08:17:31 PM »

I can... lol,. but so far, my line routine is finally looking solider,. I made a code to run it 3D, it goes all the way around w/o freezing, tho.. it seems it like to shift awkwardly at places... whether its the integer set up with LOCATE, or maybe some mis-calcs, not really sure... here is mine:

Code:
SUB ASCII_LINE(X01, Y01, X02, Y02, ASCII)
    IF X02 > X01 THEN XR01 = X02 - X01
    IF X02 < X01 THEN XR01 = X01 - X02
   
    IF Y02 > Y01 THEN YR01 = Y02 - Y01
    IF Y02 < Y01 THEN YR01 = Y01 - Y02
   
    RAD! = ATN(YR01 / XR01)
    ANG! = (RAD! / 3.1415926535897932384626433832795 * 180)
    XR02! = (1 * COS(ANG! * 3.1415926535897932384626433832795 / 180))
    YR02! = (1 * SIN(ANG! * 3.1415926535897932384626433832795 / 180))
   
    Hyp01! = ((YR01)^2 + (XR01)^2)^.5
   
    X00! = X01
    Y00! = Y01
    CONT01 = 0
    DO
        CONT01 += 1
        IF (Y00! > 0 AND Y00! < MAXY01) AND (X00! > 0 AND X00! < MAXX01) THEN
            LOCATE INT(Y00!), INT(X00!): PRINT CHR$(ASCII);
        END IF

        IF (Hyp01! < CONT01) THEN EXIT DO
       
        IF Y02 > Y01 THEN Y00! += YR02!
        IF X02 > X01 THEN X00! += XR02!
        IF Y02 < Y01 THEN Y00! -= YR02!
        IF X02 < X01 THEN X00! -= XR02!
    LOOP
END SUB


I took out REMed experiment code that didn't work, and a REMed debugger.. If it doesn't work like the current lib, I might have deleted something important in the process, tho I doubt it..  :wink: ..

You'll need to set the MAXX01 and MAXY01 variables to your max X, Y text screen output, otherwise it will cut the whole line thinking its off screen..  :wink:
Logged

Kevin (x.t.r.GRAPHICS)

Dr_Davenstein
Na_th_an
*****
Posts: 2044



Power ASCII Lib..
« Reply #11 on: July 16, 2005, 08:37:41 PM »

Give me a few minutes and I'll make this one for ascii. It'll take a couple of bounds checks, but it shouldn't slow it down too much. It's just a bresenham line algo... all integers. Wink

EDIT: Here it is. Wink


Code:
DECLARE SUB ASC_Line(x1, y1, x2, y2, c, Char)

Const ScreenWidth=80, ScreenHeight=60, MidX=(ScreenWidth-1)\2, MidY=(ScreenHeight-1)\2
Width ScreenWidth,ScreenHeight


Do
    Ang!=Ang!+.01
    X1=MidX+25*SIN(Ang!)
    Y1=MidY+25*COS(Ang!)
    X2=MidX-25*SIN(Ang!)
    Y2=MidY-25*COS(Ang!)
   
ASC_Line X1,Y1,X2,Y2, 14, ASC("*")
Sleep 1
CLS
Loop Until Inkey$=Chr$(27)
END


SUB ASC_Line(x1, y1, x2, y2, c, char)
     COLOR(C)
     Xdif = x2 - x1
     Ydif = y2 - y1
   
     IF Xdif < 0 THEN
         Xdif = -Xdif
     END IF
   
     IF Ydif < 0 THEN
         Ydif = -Ydif
     END IF
   
IF Xdif >= Ydif THEN
     IF x2 < x1 THEN
         SWAP x2, x1
         SWAP y2, y1
     END IF
     
     IF y2 < y1 THEN
         Xit = -1
     ELSE
         Xit = 1
     End If
     
     TempY = y1
     
     If TempY>0 And TempY<=ScreenHeight Then
        FOR TempX = x1 TO x2
            If TempX>0 And TempX<ScreenWidth Then
                Locate TempY,TempX
                Print Chr$(Char)
         
                Yit = Yit - Ydif
         
                IF Yit < 0 THEN
                    Yit = Yit + Xdif
                    TempY = TempY + Xit
                END IF
            End If    
        NEXT
     End If  
     
ELSE
     
     IF y2 < y1 THEN
         SWAP x2, x1
         SWAP y2, y1
     END IF
   
     IF x2 < x1 THEN
         Xit = -1
     ELSE
         Xit = 1
     End If
   
     TempX = x1
     If TempX>0 And TempX<= ScreenWidth Then
   
        FOR TempY = y1 TO y2
            If TempY>0 and TempY<ScreenHeight Then
                Locate TempY,TempX
                Print Chr$(Char)
         
                Yit = Yit - Xdif
       
                IF Yit < 0 THEN
                    Yit = Yit + Ydif
                    TempX = TempX + Xit
                END IF
            End If    
        NEXT
     End If
   
END IF
END SUB
Logged
Dr_Davenstein
Na_th_an
*****
Posts: 2044



Power ASCII Lib..
« Reply #12 on: July 17, 2005, 02:17:08 AM »

*bump*
Wink
Logged
MystikShadows
Ancient Guru
****
Posts: 542



WWW
Power ASCII Lib..
« Reply #13 on: July 17, 2005, 07:55:05 AM »

Nice one Dr :-)..Worked great for me when I tried it just now :-)
Logged

hen they say it can't be done, THAT's when they call me ;-).




need hosting:  http://www.jc-hosting.net
All about ASCII: http://www.ascii-world.com
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
Power ASCII Lib..
« Reply #14 on: July 17, 2005, 11:41:00 AM »

Sad Darn,. it makes my comp go all blue-screen-of-death.... What's up with that?
Logged

Kevin (x.t.r.GRAPHICS)

Pages: [1] 2 Print 
Qbasicnews.com  |  Qbasic "like" compilers/interpreters  |  FB Discussion & Programming Help  |  FB Projects  |  Topic: Power ASCII Lib.. « previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
SMF Theme © Gaia, Hosting by Employers Job Post
Valid XHTML 1.0! Valid CSS!