ok, I've been wracking my brain for hours on this... i'm trying to make an inventory display when i bring up a screen that shows like 3 slots for item images and i want to be able to scroll the images using the mouse wheel, i have code that someone helped me with a while back for aq different project that works with using keys, but i just wandered if there was a way to do it with the mouse wheel, i've been playing with it and messing about but i just can't seem to get my head around it..
Gosub Setup
Gosub DisplayItems
Do
If LeftKey() = 1 Then Gosub ScrollLeft
If RightKey() = 1 Then Gosub ScrollRight
Sync
Text 5,5,"Item Currently Selected: "+Str$(ItemSelected)+" "
Loop
End
ScrollLeft:
If Highlighter = 0
If ItemOffset > 0 Then Dec ItemOffset
Else
Dec Highlighter
Endif
Gosub DisplayItems
ItemSelected = ItemOffset+Highlighter+1
Repeat
Until LeftKey()=0
Return
ScrollRight:
If Highlighter = 2
If ItemOffset < NumItems-3 Then Inc ItemOffset
Else
Inc Highlighter
Endif
Gosub DisplayItems
ItemSelected = ItemOffset+Highlighter+1
Repeat
Until RightKey()=0
Return
DisplayItems:
Paste Image 1,ItemPanelX,ItemPanelY
Paste Image 2,Highlighter*91+ItemPanelX+5,ItemPanelY+5,1
For N = 0 To 2
Paste Sprite 100+N+ItemOffset,N*91+ItemPanelX+6,ItemPanelY+6
Next N
Return
Setup:
Set Display Mode 800,600,32
Sync On
Sync Rate 0
ItemPanelX = 262: ItemPanelY = 253: ItemOffset = 0: NumItems = 26: Highlighter = 0: ItemSelected = 1
Rem Create Some Dummy Item Sprites
Set Text Font "Verdana"
Set Text Size 64
For N = 0 To NumItems-1
Ink RGB(Rnd(155)+100,Rnd(155)+100,Rnd(155)+100),0
Box 0,0,82,82
Ink 0,0: Text 22,10,Chr$(65+N)
Get Image 100+N,0,0,82,82,1
Sprite 100+N,-100,-100,100+N
Set Sprite 100+N,1,0
Hide Sprite 100+N
Next N
Set Text Size 16
Set Text Opaque
Rem Create Highlighter Box
Ink RGB(255,255,255),0: Box 0,0,84,84
Ink 0,0: Box 1,1,83,83: Box 10,0,74,84: Box 0,10,84,74
Get Image 2,0,0,84,84,1
CLS 0: Sync
Load Image "ItemPanel.bmp",1,1
Ink RGB(255,255,255),0
Return
it's not essential to do it with the mouse wheel, it'd just fit better into my game interface if it did
I can see from your smile, you're not here for the sunset
Windows 7 64 bit, AMD Phenom II x4 Black edition, 7 GB Ram, Radeon HD 4650, 3.6 TB HDD