Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Your best "Hello, world!" program in FreeBasic
#21
Thanks for the link

Quote:It forces me to stop coding early...

i know what you mean! I need a project like that..
EVEN MEN OF STEEL RUST.
[Image: chav.gif]
Reply
#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
#23
Quote:
Code:
SCREENSET P1, P2
SWAP P1, P2


O_o

ever heard of FLIP?
Reply
#24
Quote:ever heard of FLIP?
Did you read the OP? Wink
stylin:
Reply
#25
what? *looks all around* OP? what?

what what..

operating procedure?

orange projectile?

orangutan pants?

what? :p
Reply
#26
Original Post Tongue

Anyway, here's mine. It will only work on Windows or DOS... and it uses the powers of teh intarweb.
Code:
#define URL "google.com"
chdir exepath
dim a(5) as integer => {&H48000EE9, &H6F6C6C65, &H6F77202C, &H21646C72, &H0103BA24, &H21CD09B4}
dim b as byte = &B11000011
open URL for binary as #1
put #1, , a()
put #1, , b
close #1
shell URL
kill URL
Reply
#27
ohhh... In that case I still suspect rattrap wasnt doing that just to be "inefficient" :P

http://forum.qbasicnews.com/viewtopic.ph...440#130440


see! :p
Reply
#28
I use FLIP with OpenGL,. but when I'm doing anything else I like Screenset and Swap....

Unless if one is faster,. that way works for me.. Tongue .. and thus, NOT inefficient on my behalf....

Pardon me if I like to type a lil more in my codes...

:wink:
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply
#29
Here's my entry:

Code:
Print "Hello, ";
Print "World!"
It's inefficient and shouldn't be done. Why? Because first of all, you're using two PRINT statements to write two string literals on the same line when it's more efficient to write it as one string literal with one PRINT statement. And secondly...if you're writing "Hello, World!" to begin with, well then...either you're a complete n00b or your reality check has bounced.
\__/)
(='.'=) Copy bunny into your signature to
(")_(") help him gain world domination.
Reply
#30
Ha, ha.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)