Qbasicnews.com

Full Version: QBasic syntax highlighted code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9
The code red_Marvin posted looks fine, but all the other code blocks in this thread are unreadable. I'm using the default PhpBB theme, subsilver.
Isn't it possible to implement different text colors for different skins?
Quote:Isn't it possible to implement different text colors for different skins?

yes. You can edit the text color and background color on code boxes through the admin control panel. He's in the code, so he'd just have to make a different file for each style I assume.
At the moment, it's just hard-coded in (the colours). But I'm gonna fix that ASAP.

Code:
QBASIC'3d vortex......2003
'Http://Relsoft.Ath.cx
'Here's my take on the starfield stuff...


1 IF I% = 0 THEN SCREEN 13 ELSE DIM Dist!(200), Rot!(200)
2 I% = (I% + 1) MOD 200
3 IF J% < 257 THEN J% = (J% + 1)
4 PSET (Dist!(I%) * COS(Rot!(I%) / 56.32716) + 160, Dist!(I%) * SIN(Rot!(I%) / 56.32716) + 100), 0
5 Rot!(I%) = (Rot!(I%) + .5 * (Dist!(I%) / 50)) * -(Rot!(I%) <= 360)
6 IF Dist!(I%) < 0 OR Dist!(I%) > 170 THEN Rot!(I%) = RND * 360
7 IF Dist!(I%) < 0 OR Dist!(I%) > 170 THEN Dist!(I%) = RND * 170 ELSE Dist!(I%) - (2 - (Dist!(I%) / 150))
8 IF J% > 255 THEN PSET (Dist!(I%) * COS(Rot!(I%) / 56.32716) + 160, Dist!(I%) * SIN(Rot!(I%) / 56.32716) + 100), Dist!(I%) + 50 ELSE PALETTE J%, 65536 * (J% \ 4) + 256 * (J% \ 4) + (63 - (J% \ 4))
9 IF INKEY$ = "" THEN 2
Light green on white background....


Just go with the center colors, no bright, no dark...

Blue, red, green, pink, purple, grey, cyan....

There are 14 colors in QBasic that are fully visible on both black and white, use them :wink:

Or, make it display a nice little QB IDE picture, and have the code on blue background, on all styles...
Code:
QBASIC
print "Just testing..."

Edit niiice! Autocaps too!
^_^

I though the autocaps would be cool Smile. I'm working on that colour switcher now.

EDIT: Colour switching works fine now Smile
Code:
QBASICPRINT "test"
Print "test"
print "test"
REM <--- hmmm
wait a minute.... if your code is already in caps it doesn't highlight also
Code:
QBASICprint "blah
blah
blah
"blah
"
blah
^^^ three quotes?
^^ Someone actually tested and found something, well done Big Grin

I've made it more DB driven, and slightly more automated. Now all you do is put "qbasic" at the front of the code, so like this:

[code]qbasic
' statements[/code]

Whitetiger: I don't think multiline strings are allowed anyway Wink. But I might have to change it for other languages though... but the REM is one I haven't done yet, thanks for finding that Smile

Code:
qbasic
' Here's some code just to show how nice it looks:
'
'

'$include: 'foo.bi'
'$dynamic
DEFINT A-Z

CLS
INPUT "what is your name?", yourname$
FOR I = 1 To 7
   LOCATE I, 10
   PRINT yourname$ + " RULES!"
   IF A$ = "19" THEN
      END
   END IF
   A$ = LTRIM$(STR$(INT(RND * 20) + 1))
NEXT I
' We're exiting now
END
Code:
qbasic

SCREEN 13
PRINT "Test"
PRINT Test
PRINT Test$
Print Test + Test
LINE (5,5)-(8,8),15,BF
PSET (5,5),15

Well, I see a few of the keywords aren't completely done... but you probably already said that, and I'm beating a dead horse...

Awesome work. This gives the forum even more diversity... Smile
Pages: 1 2 3 4 5 6 7 8 9