January 16, 2021, 06:19:09 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
Graphics
»
[bb] BBThugha by johnpeat [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] BBThugha by johnpeat [ 1+ years ago ] (Read 1170 times)
BlitzBot
Jr. Member
Posts: 1
[bb] BBThugha by johnpeat [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:43 AM »
Title :
BBThugha
Author :
johnpeat
Posted :
1+ years ago
Description :
Converted from JCthugha just to 'test out' BB's raw processing speed - which is about on a par with MSIE-based Java...
Code :
Code: BlitzBasic
; Converted from JCthugha
; http://www.afn.org/~cthugha/ for much much more...
;
; Blitz Note: Disable Debug or this runs WAY too slow...
;Set screen size
Const
gwidth=
400
,gheight=
200
Graphics
gwidth,gheight,
16
,
2
Dim
snd
(
gwidth
)
Dim
col
(
256
)
Dim
colmap
(
gwidth,gheight
)
; Make a "palette"
For
i =
0
To
63
col
(
i
)
=i*
4
*
256
*
256
; Reds
col
(
i+
64
)
=i*
4
*
256
; Greens
col
(
i+
128
)
=i*
4
; Blues
col
(
i+
192
)
=i*
4
*
256
*
256
+i*
4
*
256
+i*
4
; Greys
Next
Repeat
; Fake a 'sound wave'
snd
(
0
)
=
Rand
(
-gheight/
3
,gheight/
3
)
For
i =
1
To
gwidth-
1
snd
(
i
)
= snd
(
i-
1
)
+
Rand
(
-
10
,
10
)
If
snd
(
i
)
< -gheight
Then
snd
(
i
)
= snd
(
i
)
=
2
*gheight
If
snd
(
i
)
> gheight
Then
snd
(
i
)
= snd
(
i
)
-
2
*gheight
Next
;Draw black outline to ensure 'flameout'
Color
0
,
0
,
0
Line
0
,
0
,gwidth-
1
,
0
Line
0
,gheight-
1
,gwidth-
1
,gheight-
1
Line
0
,
0
,
0
,gheight
Line
gwidth-
1
,
0
,gwidth-
1
,gheight-
1
LockBuffer
FrontBuffer
(
)
; 'Flame' effect
For
x =
0
To
gwidth-
1
For
y =
0
To
gheight-
2
p1 = colmap
(
x+
1
,y
)
p2 = colmap
(
x,y+
1
)
p3 = colmap
(
x+
1
,y+
1
)
p4 = colmap
(
x,y
)
If
p1 <
0
Then
p1 = p1 +
256
If
p2 <
0
Then
p2 = p2 +
256
If
p3 <
0
Then
p3 = p3 +
256
If
p4 <
0
Then
p4 = p4 +
256
s = p1 + p2 + p3 + p4
;
s = s /
4
;
If
s >
0
Then
s = s -
1
colmap
(
x,y
)
=s
WritePixelFast
x,y,col
(
s
)
Next
colmap
(
x,gheight/
2
+snd
(
x
)
/
3
)
=
255
WritePixelFast
x,gheight/
2
+snd
(
x
)
/
3
,$ffffff
; White
Next
UnlockBuffer
FrontBuffer
(
)
Until
KeyHit
(
1
)
End
Comments :
none...
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
Graphics
»
[bb] BBThugha by johnpeat [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal