QB / QB64 Discussion Forum      Other Subforums, Links and Downloads
 

 Return to Index  

I made another 'cause I was bored:

June 22 2008 at 1:23 AM
  (Login ComputerGhost)
R


Response to Best least efficient and longest I can do:

 
'---- Subs/Functions ----

DECLARE SUB Init ()
DECLARE SUB LoadChars ()
DECLARE SUB SetupPalette (red!, green!, blue!)
DECLARE SUB PrintChar (n%)
DECLARE SUB ChangePos (x!, y!)
DECLARE SUB Main ()
DECLARE SUB ShutDown ()


'---- Variable/Constants --

CONST C.CharCount = 30
CONST C.CharWidth = 8
CONST C.CharHeight = 8
CONST C.CharSize = (C.CharWidth * C.CharHeight)
DIM SHARED charSet%(C.CharCount, C.CharSize)

DIM SHARED posX!, posY!


'---- Program ----

CALL Init

CALL Main

CALL ShutDown

SYSTEM


'---- Data ----

'0 - null
DATA 0, 0, 0, 0, 0, 0, 0, 0
DATA 0, 0, 0, 0, 0, 0, 0, 0
DATA 0, 0, 0, 0, 0, 0, 0, 0
DATA 0, 0, 0, 0, 0, 0, 0, 0
DATA 0, 0, 0, 0, 0, 0, 0, 0
DATA 0, 0, 0, 0, 0, 0, 0, 0
DATA 0, 0, 0, 0, 0, 0, 0, 0
DATA 0, 0, 0, 0, 0, 0, 0, 0

'1 - A
DATA 0, 0, 0, 0, 4, 9, 0, 0
DATA 0, 0, 0, 0, 7, 9, 0, 0
DATA 0, 0, 0, 6, 0, 9, 0, 0
DATA 0, 0, 4, 8, 0, 9, 0, 0
DATA 0, 0, 9, 0, 0, 9, 9, 9
DATA 0, 4, 9, 9, 9, 9, 4, 0
DATA 0, 9, 0, 0, 0, 9, 0, 0
DATA 0, 4, 0, 0, 0, 9, 0, 0

'2 - B
DATA 0, 0, 5, 9, 9, 0, 0, 0
DATA 0, 4, 4, 3, 4, 8, 0, 0
DATA 0, 0, 7, 0, 0, 9, 0, 0
DATA 0, 0, 9, 0, 4, 9, 0, 0
DATA 0, 0, 9, 0, 8, 4, 7, 4
DATA 0, 0, 9, 0, 0, 0, 7, 7
DATA 0,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 0)

END SUB

'
'
'
SUB LoadChars

iUpper% = C.CharCount - 1

FOR i% = 0 TO iUpper%

xUpper% = C.CharWidth - 1
yUpper% = C.CharHeight - 1

FOR y% = 0 TO yUpper%
FOR x% = 0 TO xUpper%
READ colour%
charSet%(i%, y% * C.CharWidth + x%) = colour%
NEXT x%
NEXT y%

NEXT i%

END SUB

'
'
'
SUB Main

text$ = "08051212152800231518120429"
iUpper% = LEN(text$) \ 2 - 1

dtheta! = (3.14159 * 2) / CSNG(iUpper%)
theta! = 0

red% = 90
green% = 41
blue% = 0


k$ = INKEY$
WHILE k$ = ""

red% = (red% + 7) MOD 100
green% = (green% + 2) MOD 100
blue% = (blue% + 3) MOD 100
CALL SetupPalette(red% / 100, green% / 100, blue% / 100)

FOR i% = 0 TO iUpper%

'Erase old
x% = (i% + 34) * C.CharWidth
y% = 29 * C.CharHeight
LINE (x%, y%)-(x% + C.CharWidth, y% + 3 * C.CharHeight), 0, BF

'Print new
theta! = theta! + dtheta!
CALL ChangePos(i% + 34, SIN(theta!) + 30)
char% = VAL(MID$(text$, i% * 2 + 1, 2))
CALL PrintChar(char%)

NEXT i%

timerEnd = TIMER + .1
DO: LOOP UNTIL timerEnd <= TIMER

k$ = INKEY$
WEND

END SUB

'
'
'
SUB PrintChar (n%)

IF n% >= C.CharCount OR n% < 0 THEN EXIT SUB

xUpper% = C.CharWidth - 1
yUpper% = C.CharHeight - 1

FOR y% = 0 TO yUpper%
FOR x% = 0 TO xUpper%
colour% = charSet%(n%, y% * C.CharWidth + x%)
px% = INT(posX! * C.CharWidth) + x%
py% = INT(posY! * C.CharHeight) + y%
PSET (px%, py%), colour%
NEXT x%
NEXT y%

END SUB

'
'
'
SUB SetupPalette (red!, green!, blue!)

FOR i% = 0 TO 9

shade& = i% * 6
r& = INT(red! * shade&)
g& = INT(green! * shade&)
b& = INT(blue! * shade&)
colour& = r& + g& * 256 + b& * 65536
PALETTE i%, colour&

NEXT i%

END SUB

'
'
'
SUB ShutDown

SCREEN 0
WIDTH 80, 25
COLOR 15, 0
CLS

END SUB


 
 Respond to this message   
 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement