home *** CD-ROM | disk | FTP | other *** search
- /*============================================================
-
- N_Button sample program
-
- ============================================================*/
- #include "N_Library.h"
-
- short Data_Rsrc = 0;
- short Snd_List0[] = {1000,1001,0};
- long counter1 = 2000;
- long counter2 = 2000;
- long counter3 = 2000;
-
- void main(void)
- {
- WindowPtr window;
- short bt;
- Point mp;
-
- ToolboxInit();
- ColorCheck();
- HideMenuBar();
- HideCursor();
- window = GetNewWindow (128,nil,(WindowPtr)-1L );
- N_Window_Set(window,-(window->portBits.bounds.left),-(window->portBits.bounds.top),640,480);
- Open_Resource_File(128,1,&Data_Rsrc);
- N_Sp_Make(640,480);
- N_Cel_Make(50000);
- N_Pict_Draw(128,0,0,(GrafPtr)SP_off,true);
- N_Button_Init();
- N_Font_Init();
- N_Sprite_Set(129,0,14,24,1,11,1,0);
- N_Sprite_Set(130,11,32,32,1,6,1,0);
- N_Sprite_Set(131,20,12,16,0,1,1,0);
- N_Sound_Load(&Snd_List0[0]);
- N_Font_Set(0,0,0,0,0);
- Close_Resource_File(&Data_Rsrc);
-
- N_Button_Set(0,0,1,40,410,0,0x80000000+11,0x80000000+12,1000,1001);
- N_Button_Set(0,1,1,80,410,0,0x80000000+13,0x80000000+14,1000,1001);
- N_Button_Set(0,2,1,160,410,40,0x80000000+11,0x80000000+12,1000,1001);
- N_Button_Set(0,3,1,200,410,40,0x80000000+13,0x80000000+14,1000,1001);
- N_Button_Set(0,4,1,280,410,512,0x80000000+11,0x80000000+12,1000,1001);
- N_Button_Set(0,5,1,320,410,512,0x80000000+13,0x80000000+14,1000,1001);
- N_Button_Set(0,6,1,410,410,513,0x80000000+15,0x80000000+16,1000,1001);
- N_Button_Set(0,7,1,470,410,514,0x80000000+15,0x80000000+16,1000,1001);
- N_Button_Set(0,8,1,562,410,512,0x80000000+15,0x80000000+16,1000,1001);
- N_Button_Put(0);
- N_Num_Put(counter1,30,320,5,16,0,2,0);
- N_Num_Put(counter2,150,320,5,16,0,2,0);
- N_Num_Put(counter3,270,320,5,16,0,2,0);
- N_Cel_Loop(0,0);
-
- do
- {
- GetMouse(&mp);
- N_Cel_Put(2040,0x80000000+20,mp.h,mp.v);
- bt = N_Button_Check(0);
- if (bt == 1) counter1++;
- if (bt == 3) counter2++;
- if (bt == 5) counter3++;
- if (counter1 == 10000) counter1 = 0;
- if (counter2 == 10000) counter2 = 0;
- if (counter3 == 10000) counter3 = 0;
- if (bt == 0) counter1--;
- if (bt == 2) counter2--;
- if (bt == 4) counter3--;
- if (counter1 == -1) counter1 = 9999;
- if (counter2 == -1) counter2 = 9999;
- if (counter3 == -1) counter3 = 9999;
- if(bt != -1)
- {
- N_Num_Put(counter1,30,320,5,16,0,2,0);
- N_Num_Put(counter2,150,320,5,16,0,2,0);
- N_Num_Put(counter3,270,320,5,16,0,2,0);
- }
- N_Cel_Loop(0,0);
- }
- while (bt != 8);
- N_Sound_Close();
- FlushEvents( everyEvent, 0 );
- ShowMenuBar();
- ShowCursor();
- ColorRevert();
- }
-
-
-
-
-
-