Weekly Qbasic and Qb64 Lesson Topics
March 29, 2024, 06:49:43 am
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

Hello World

Pages: 1 [2]
  Print  
Author Topic: Hello World  (Read 1469 times)
Cyperium
Newbie
*
Posts: 8


« Reply #15 on: March 24, 2011, 07:41:27 pm »

I guess that you could make each letter images and use _PUTIMAGE to make them bigger then use the same principle as with the letters. I'll give it a try:


Code:
DIM a$(11), x(11), y(11), image(11)
scrhandle = _NEWIMAGE(640, 480, 13)
SCREEN scrhandle
a$(1) = "H"
a$(2) = "e"
a$(3) = "l"
a$(4) = "l"
a$(5) = "o"
a$(6) = " "
a$(7) = "W"
a$(8) = "o"
a$(9) = "r"
a$(10) = "l"
a$(11) = "d"
FOR k = 1 TO 11
    x(k) = 1 'they should differ by angles and radius only
    y(k) = 1 'they should differ by angles and radius only
NEXT

FOR im = 1 TO 11
    image(im) = _NEWIMAGE(8, 10, 13) 'make a new image the same size as the letter
    _DEST image(im) 'make image(im) the destination image (for drawing)
    _PRINTSTRING (0, 0), a$(im) 'print the letter to the image
NEXT
_DEST scrhandle 'make scrhandle the destination image to draw on (scrhandle is set as the SCREEN)

size = 2 'set default size (double the size)

1
CLS
_LIMIT 100
round = round + .02 'angle
FOR k = 1 TO 11

    x(k) = COS(round + (.5 * k)) * k * 10 * size '       (.5 * k) gives the letter position in angle from the round angle
    y(k) = SIN(round + (.5 * k)) * k * 10 * size '       k * 10 is the radius (progressing inward to out using k in steps of 10).
    '                                                    * size is to adjust the radius according to the new size.
    _PUTIMAGE (x(k) + 320, y(k) + 240)-(x(k) + 320 + (8 * size), y(k) + 240 + (10 * size)), image(k), scrhandle, (0, 0)-(8, 10)
    '                                     destination coordinates (*size)                    source  destination  source coordinates
NEXT
'handles keyboard input:
kbd$ = INKEY$
IF kbd$ = "+" THEN size = size + .5
IF kbd$ = "-" THEN size = size - .5
IF kbd$ = CHR$(27) THEN END
'display the screen
_DISPLAY


GOTO 1


Use + to increase size, - to decrease size and ESC to end.

There are other ways of achieving this, but I wanted to avoid treating the pixels individually. Right now I treat the letters as images instead.
« Last Edit: March 24, 2011, 07:57:59 pm by Cyperium » Report Spam   Logged

Pages: 1 [2]
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy