Ejemplo n.º 1
0
/* ** PENGESETAN PADA PAPAN MONOPOLY ** */
void setboard( place *tempat, player *p) //menset board papan monopoly kosong hanya ada nama
{
    int i, j;
    point sb;

    //tampilan board
    //ukuran board 6x6
    for(i=1;i<=6;i++)
    {
        for(j=1;j<=6;j++)
        {
            if((i==1)||(i==6)||(j==1)||(j==6))//board tuh kan tengahnya bolong jadi cuma sisinya aja 1 dan 6
            {
                sb.x=j;
                sb.y=i;
                kotak(sb, (*tempat), (*p));//memanggil satu kotak satu kotak
            }
        }
    }
    //setstatuspemain(&m, &(*p));
}
Ejemplo n.º 2
0
void menu_OK(unsigned char p, unsigned char mesin, unsigned char jok)
{
	unsigned int key_press;
	unsigned char key_index=0;
	unsigned char mesin_index=0;
	int i;
	int jum_aktif=0;
	int loop;
	unsigned char terus;
	
	//menu_pilih(p, mesin);
	if (p == 7 && jok == 1)
	{	
		// cari jumlah sumber aktif
		for (i=0; i<JML_SUMBER; i++)
		{
			if (sumber[i].status == 1) jum_aktif++;
		}
		
		key_index = 0;
		
		for (;;)
		{
			if(cek_keypad())
			{
				cls_layar();
				// cek tombol apa yang ditekan
				key_press = (FIO1PIN & KEY_DAT);
				
				if (key_press == ATAS)
				{
					key_index--;

					if (key_index == 255) key_index = (jum_aktif-1);
				}
				else if ( key_press == BAWAH )
				{
					key_index++;	
					if (key_index > (jum_aktif-1)) key_index = 0;
				}
				else if ( key_press == OK)
				{
					//jum_OK++;	
				}
				else if ( key_press == CANCEL)
				{
					//jum_OK--;
					return;	
				}
				
				menu_monita(7);
				menu_pilih(7, mesin, 0);
				//kotak(68, 25+(9*key_index), 300, 35+(9*key_index));
				data_sumber(1, key_index);
				update_lcd();
				loop = 0;
			}
			vTaskDelay(100);
			
			loop++;
			if (loop > 5)
			{
				loop = 0;
				cls_layar();
				menu_monita(7);
				menu_pilih(7, mesin, 0);
				data_sumber(1, key_index);
				update_lcd();	
			}
		}
	}
	
	/* menu titik */
	else if (p == 8 && jok == 1)
	{
		key_index = 0;
		terus = 0;
		jum_aktif = 15;
		
		for (;;)
		{
			if(cek_keypad())
			{
				cls_layar();
				// cek tombol apa yang ditekan
				key_press = (FIO1PIN & KEY_DAT);
				
				if (key_press == ATAS)
				{
					if (terus < 15)
						key_index--;
					
					terus--;
					if (terus == 255)
					{
						terus = TIAP_MESIN-1;	
						key_index = (jum_aktif-1);
					}
					
					//if (key_index == 255) key_index = (jum_aktif-1);
				}
				else if ( key_press == BAWAH )
				{
					key_index++;	
					terus++;
					
					if (terus > (TIAP_MESIN -1))
					{
						terus = 0;
						key_index = 0;	
					}
					//if (key_index > (jum_aktif-1)) key_index = 0;
					if (key_index > (jum_aktif-1)) key_index--;
				}
				else if ( key_press == OK)
				{
					//jum_OK++;	
				}
				else if ( key_press == CANCEL)
				{
					//jum_OK--;
					return;	
				}
				
				menu_monita(8);
				menu_pilih(8, mesin, terus);
				kotak(68, 36+(9*key_index), 312, 46+(9*key_index));
				//data_sumber(1, key_index);
				update_lcd();
				loop = 0;
			}
			vTaskDelay(100);
		}	
	}
}