Ooops
January 26, 2021, 12:07:38 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
»
User Input
»
[bmx] Mousewheel Menu by zoqfotpik [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bmx] Mousewheel Menu by zoqfotpik [ 1+ years ago ] (Read 627 times)
BlitzBot
Jr. Member
Posts: 1
[bmx] Mousewheel Menu by zoqfotpik [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:39 AM »
Title :
Mousewheel Menu
Author :
zoqfotpik
Posted :
1+ years ago
Description :
This is a menu that is activated and selected by the mousewheel. There are a lot of things you could do with this, like bind function pointers to the menu options, etc, but right now it just toggles the variable "currentitem."
This is from an editor of mine and I intended it to be simple. You could bind keyboard commands to it or whatever.
Code :
Code: BlitzMax
Strict
Global
numitems =
7
Global
currentitem:
Int
' Which item is currently selected
Global
olditem:
Int
Global
currenttextline:
Int
Graphics
640
,
480
Global
ticks =
0
Global
namearray:
String
[
100
]
Global
menufadeouttimer:
Int
' When this has elapsed, the menu disappears automatically
namearray
[
0
]
=
"Thing1"
namearray
[
1
]
=
"Thing2"
namearray
[
2
]
=
"Redthing"
namearray
[
3
]
=
"Bluething"
namearray
[
4
]
=
"BarThing"
namearray
[
5
]
=
"FooThing"
namearray
[
6
]
=
"Exit"
While
Not
KeyDown
(
KEY_ESCAPE
)
And
Not
(
currentitem=
6
And
menufadeouttimer<
0
)
ticks = ticks +
1
Cls
currenttextline=
0
olditem= currentitem
currentitem=
Abs
(
MouseZ
(
)
)
Mod
numitems
' Mousewheel Switches Tile Types
If
olditem<> currentitem
menufadeouttimer =
60
EndIf
menufadeouttimer:-
1
If
menufadeouttimer >
0
drawmenu
(
)
Flip
Wend
Function
drawmenu
(
)
SetBlend alphablend
SetAlpha .5
' draw semi-transparent menu background
SetColor
0
,
0
,
0
DrawRect
0
,
0
,
200
,
1000
SetAlpha
1
If
menufadeouttimer <
50
And
menufadeouttimer >
0
SetAlpha
1
*
(
51
/menufadeouttimer
)
'SetColor 255,0,0
Local
recty =
0
*
12
DrawRect
0
,recty,
200
,
24
SetScale
2
,
2
SetColor
255
,
0
,
0
DrawText namearray
[
currentitem
]
,
0
,-
2
SetScale
1
,
1
SetColor
255
,
255
,
255
recty = currentitem*
12
+
24
DrawRect
0
,recty,
200
,
12
For
Local
i =
0
To
numitems
If
i = currentitem
SetColor
0
,
0
,
0
Else
SetColor
255
,
255
,
255
EndIf
DrawText namearray
[
i
]
,
10
,i*
12
+
24
SetColor
255
,
255
,
255
Next
SetAlpha
1
End
Function
Function
consoleprint
(
toprint$
)
currenttextline:+
12
DrawText
(
toprint$,
10
,currenttextline
)
End
Function
Comments :
dw817(Posted 7 months ago)
Marvelous work ! I was completely unaware that BlitzMAX could read the roller. That has to be impressive !
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
User Input
»
[bmx] Mousewheel Menu by zoqfotpik [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal