March 01, 2021, 09:45:11 PM
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
»
[bmx] Randomly Generated Icons by GW [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bmx] Randomly Generated Icons by GW [ 1+ years ago ] (Read 426 times)
BlitzBot
Jr. Member
Posts: 1
[bmx] Randomly Generated Icons by GW [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:39 AM »
Title :
Randomly Generated Icons
Author :
GW
Posted :
1+ years ago
Description :
This function will create small 32x32 pinwheel style graphic for use as an icon or anything else.
Code :
Code: BlitzMax
SuperStrict
Framework
brl.glmax2d
Import
brl.basic
AppTitle
=
"Hit space for more icons"
Graphics
320
,
240
While
Not
KeyHit
(
key_escape
)
Cls
DrawImage
(
makeIcon
(
)
,
0
,
0
)
'x*32,y*32)
Flip
WaitKey
Wend
Function
makeIcon:TImage
(
)
For
Local
i% =
0
Until
50
Local
x% = Rand
(
-
5
,
50
)
Local
y% = Rand
(
-
5
,
50
)
SetColor
(
Rand
(
255
)
,Rand
(
255
)
,Rand
(
255
)
)
SetRotation Rand
(
300
)
SetLineWidth
(
Rand
(
1
,
2
)
)
Select
i
Mod
3
Case
0
DrawRect
(
x,y,Rand
(
20
)
,Rand
(
20
)
)
Case
1
DrawOval
(
x,y,Rand
(
20
)
,Rand
(
20
)
)
Case
2
DrawLine
(
x,y,Rand
(
64
)
,Rand
(
64
)
)
End
Select
Next
SetColor
(
255
,
255
,
255
)
SetRotation
0
SetLineWidth
1
Local
img:TImage = CreateImage
(
16
,
16
,
1
,
0
)
; GrabImage
(
img,
0
,
0
)
SetImageHandle img,
16
,
16
For
Local
j% =
0
Until
360
/
4
SetRotation
(
360
/
4
)
*j
DrawImage
(
img,
16
,
16
)
Next
SetRotation
0
Local
outimg:TImage = CreateImage
(
32
,
32
,
1
,
0
)
GrabImage
(
outimg,
0
,
0
)
Cls
Return
outimg
End
Function
Comments :
Bobysait(Posted 1+ years ago)
Nice code !ps : You should not put a waitkey and a keyhit() for exitthe program can't be closed while the keys are consumed before the Keyhit(escape) is checked.
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
Graphics
»
[bmx] Randomly Generated Icons by GW [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal