
-----------------------------------
wierdo1111
Sun Mar 24, 2013 2:07 pm

[Tutorial] Custom Buttons Using GIF Animation
-----------------------------------
This can have different uses other then custom buttons but I thought this was the best way to demonstrate the uses when I was tutoring people.

I have included the picture i used below.

This is some basic stuff you should know what it is.
[code]var winID : int
var mx, my, b : int
View.Set ("offscreenonly")
[/code]

Now here are the variables for the GIF
I'll talk about menuid and menuc later.  Menuf get the number of frames in map.gif This is unneeded because I made it and I know how many there are
but It's good to know you can use Pic.Frames to get them.  Menuff creates an array with an upper as the number of frames so that each frame can be saved later.
[code]const menu := "menu.gif"  % just the path to get the picture
var menuid : int := 1 
var menuc : int := 0 
var menuf : int := Pic.Frames (menu)
var menuff : array 1 .. menuf of int
[/code]

Pic.FileNewFrames is what saves each frame of menu into the menuff array, delaym is a variable used to determine the delay
between each frame, if it has no value it will use the GIFs delay or 0 if it has none.
[code]var delaym : int
Pic.FileNewFrames (menu, menuff, delaym)

View.Set ("offscreenonly")
winID := Window.Open ("position:center;center,graphics:410;320,nobuttonbar")
[/code]

Here is where we do some simple rectangle hit detection, depending on which rectangle the mouse in menuid is changed and
if it lies in none menuid := 1.
[code]
loop
    Mouse.Where (mx, my, b)

    if my >= 305 - 60 and my = 25 and mx = 225 - 60 and my = 25 and mx = 145 - 60 and my = 25 and mx = 65 - 60 and my = 25 and mx 