Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Your best "Hello, world!" program in FreeBasic
#22
Okay.. =)

It's set to "Hello, world",. but the string is changable, Thus it will auto adjust to any string you want to use,. Given it's under 40 chars,. 39 to be safe.. :wink:

Code:
'Hello World Demo by Rattrapmax6(x.t.r.GRAPHICS)

SCREENRES 320, 200, 32, 2

#DEFINE PI 3.14

DIM AS STRING DSPL, TEXT
TEXT = "Hello, World!"

DIM AS UBYTE START
START = 20 - INT(LEN(TEXT)/2)

DIM AS INTEGER AMP, VAMP, P1, P2 = 1
DIM AS INTEGER BLUR(320*200*4+4)

AMP = 1: VAMP = 1

FOR i = 1 TO LEN(TEXT)
    FOR y = 1 TO 12
        SCREENSET P1, P2
        SWAP P1, P2
        CLS
        PUT (0,0), BLUR, ALPHA, 220
        LOCATE 12, START: PRINT DSPL
        COLOR RGB(0,255,255)
        LOCATE y, START + (i - 1): PRINT MID$(TEXT, i, 1)
        GET(0,0)-(319,199), BLUR
        COLOR RGB(0,0,255)
        LOCATE y, START + (i - 1): PRINT MID$(TEXT, i, 1)
        SLEEP 100
    NEXT
    DSPL += MID$(TEXT, i, 1)
NEXT

DO
    SCREENSET P1, P2
    SWAP P1, P2
    CLS
    PUT (0,0), BLUR, ALPHA, 180
    AMP += VAMP
    IF AMP > 5 THEN VAMP = -1
    IF AMP < -5 THEN VAMP = 1
    COLOR RGB(0,255,255)
    FOR i = 1 TO LEN(TEXT)
        Y = INT(AMP * SIN((i * (330 / LEN(TEXT))) * PI / 180))
        LOCATE Y + 12, START + (i - 1): PRINT MID$(TEXT, i, 1)
    NEXT
    GET(0,0)-(319,199), BLUR
    COLOR RGB(0,0,255)
    FOR i = 1 TO LEN(TEXT)
        Y = INT(AMP * SIN((i * (330 / LEN(TEXT))) * PI / 180))
        LOCATE Y + 12, START + (i - 1): PRINT MID$(TEXT, i, 1)
    NEXT
    SLEEP 100
LOOP UNTIL INKEY$ <> ""
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply


Messages In This Thread
Your best "Hello, world!" program in FreeBasic - by Rattrapmax6 - 02-01-2006, 10:41 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)