#include <acknex.h>;
BMAP* b_button="button.tga";
BMAP* b_buttontrans="buttontrans.png";
BMAP* b_mousemap="arrow.pcx";
#define num_buttons 2
#define num_animationsteps 4
#define animationsize 200
var anivars[num_buttons];
var button_states[num_buttons];
void button_over(var button_num,PANEL* panel);
PANEL* buttonani=
{
flags=SHOW;
layer=1;
pos_x=250;
pos_y=250;
window(0,0,200,100,b_button,anivars[0],0);
button(0,0,b_buttontrans,NULL,NULL,NULL,button_over,button_over);
window(0,250,200,100,b_button,anivars[1],0);
button(0,250,b_buttontrans,NULL,NULL,NULL,button_over,button_over);
}
void button_over(var button_num,PANEL* panel)
{
if(event_type==EVENT_RELEASE)
{
button_states[button_num-1]=0;
}
else
if(event_type==EVENT_TOUCH)
{
button_states[button_num-1]=1;//highlight
}
}
void handlebuttons_startup()
{
var i,temp_vars[num_buttons];
while(1)
{
for(i=0;i<num_buttons;i++)
{
if(button_states[i]==1)
{
anivars[i]=animationsize*num_animationsteps;
}
else
{
temp_vars[i]=cycle(temp_vars[i]+time_step*0.25,0,num_animationsteps);
anivars[i]=integer(temp_vars[i])*animationsize;
}
}
wait(1);
}
}
void main()
{
video_screen=2;
video_mode=10;
wait(1);
mouse_mode=2;
mouse_map=b_mousemap;
while(!key_esc)
{
mouse_pos.x=mouse_cursor.x;
mouse_pos.y=mouse_cursor.y;
wait(1);
}
}