Example #1
0
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////FONCTIONS DISPLAY///////////////////////////////
///////////////////////////////////////////////////////////////////////////////
	void Cool_Display::ButtonControl()
{//??	A Revoir en Interrupt	??//
	
	if(ButtonPin == 0) return;	
	PushCounter = 0;
	if(digitalRead(ButtonPin) == HIGH)
	{
		LedBarLightSet(0);
		PushCounter++;
		PushResetTime = millis();
		while(millis() - PushResetTime < PushPicture)
		{
			if(digitalRead(ButtonPin) == HIGH) PushCounter++;
			if((PushCounter >= PushDispInfo)&&(PushCounter <= 2*PushDispInfo)) LedBarLightSet(20);
			else if((PushCounter > 2*PushDispInfo)&&(PushCounter <= 3*PushDispInfo)) LedBarLightSet(40);
			else if((PushCounter > 3*PushDispInfo)&&(PushCounter <= 4*PushDispInfo)) LedBarLightSet(60);
			else if((PushCounter > 4*PushDispInfo)&&(PushCounter <= 5*PushDispInfo)) LedBarLightSet(80);
			else if(PushCounter > PushDispPic) LedBarLightSet(100);
		}
		ButtonAction(PushCounter);
		return;
	}
	else if(millis()-PushResetTime>DisplayTimerOff)
	{
		PushCounter  = 0;
		PushResetTime = millis();
		ButtonAction(PushCounter);
		return;
	}
}
Example #2
0
void WinMenuButtonRelease(XEvent *event)
{
  StampTime(event->xbutton.time);
  if(ButtonCount(event->xbutton.state)>1) {
    switch(event->xbutton.button){
      case Button1: ButtonAction(0); break;
      case Button2: ButtonAction(1); break;
      case Button3: ButtonAction(2); break;
      case Button4: break;
      case Button5: break;
    }
  } else {
    StopWinMenu(selectedHex, event);
  }
  
}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{

    if ( !LayerColor::initWithColor(Color4B(255,255,255,255)) )
    {
        return false;
    }
    
    /////////////////////////////
	//백그라운드
	bg = Sprite::create("Background/Background.png");
	bg->setPosition(Vec2(320, 480));
	this->addChild(bg);

	//물고기 스프라이트
	fish1 = Sprite::create("Fish_Effect/Fish_001.png");
	fish1->setPosition(Vec2(0, 450));
	this->addChild(fish1);

	fish2 = Sprite::create("Fish_Effect/Fish_002.png");
	fish2->setPosition(Vec2(640, 400));
	this->addChild(fish2);

	fish3 = Sprite::create("Fish_Effect/Fish_001.png");
	fish3->setPosition(Vec2(-20, 200));
	this->addChild(fish3);

	//버블 스프라이트
	bubble = Sprite::create("Bubble_Effect/Title_Bubble_001.png");
	bubble->setPosition(Vec2(320, -20));
	this->addChild(bubble);

	bubble2 = Sprite::create("Bubble_Effect/Title_Bubble_002.png");
	bubble2->setPosition(Vec2(320, -20));
	this->addChild(bubble2);

	bubble3 = Sprite::create("Bubble_Effect/Title_Bubble_003.png");
	bubble3->setPosition(Vec2(320, -20));
	this->addChild(bubble3);

	bubble4 = Sprite::create("Bubble_Effect/Title_Bubble_004.png");
	bubble4->setPosition(Vec2(320, -20));
	this->addChild(bubble4);

	bubbleStar = Sprite::create("Bubble_Effect/Bubble_Star_003.png");
	bubbleStar->setPosition(Vec2(320, 50));
	bubbleStar->setScale(0.5f);
	this->addChild(bubbleStar);

	bubbleStar2 = Sprite::create("Bubble_Effect/Bubble_Star_002.png");
	bubbleStar2->setPosition(Vec2(100, 100));
	bubbleStar2->setScale(0.2f);
	this->addChild(bubbleStar2);

	bubbleStar3 = Sprite::create("Bubble_Effect/Bubble_Star.png");
	bubbleStar3->setPosition(Vec2(600, 100));
	bubbleStar3->setScale(0.3f);
	this->addChild(bubbleStar3);


	//버튼 스프라이트
	////////////////////////////////////
	auto pMenuItem1 = MenuItemImage::create(
		"Create_Button/Play_Button_01.png",
		"Create_Button/Play_Button_02.png");
	pMenuItem1->setPosition(Vec2(290, 300));

	auto pMenuItem2 = MenuItemImage::create(
		"Create_Button/Vibration_ON.png",
		"Create_Button/Vibration_OFF.png");
	pMenuItem2->setPosition(Vec2(420, 180));

	auto pMenuIteme3 = MenuItemImage::create(
		"Create_Button/Create_Button_01.png",
		"Create_Button/Create_Button_02.png");
	pMenuIteme3->setPosition(Vec2(600, 50));

	auto pMenu = Menu::create(pMenuItem1, pMenuItem2, pMenuIteme3, nullptr);
	pMenu->setPosition(Vec2(0, 0));
	this->addChild(pMenu);
	////////////////////////////////////
	
	//buttonStart = Sprite::create("Create_Button/Play_Button_01.png");
	//buttonStart->setPosition(Vec2(290, 300));
	//this->addChild(buttonStart);

	//buttonInfo = Sprite::create("Create_Button/Vibration_ON.png");
	//buttonInfo->setPosition(Vec2(420, 180));
	//this->addChild(buttonInfo);

	buttonFx = Sprite::create("Create_Button/Base.png");
	buttonFx->setPosition(Vec2(320, 280));
	buttonFx->setOpacity(0);
	this->addChild(buttonFx);
	

	logo = Sprite::create("Create_Button/Bubble_Logo.png");
	logo->setPosition(Vec2(320, 680));
	this->addChild(logo);
	
	//buttonEx = Sprite::create("Create_Button/Create_Button_01.png");
	//buttonEx->setPosition(Vec2(600, 50));
	//this->addChild(buttonEx);
	
	buttonExBase = Sprite::create("Create_Button/Create_base.png");
	buttonExBase->setPosition(Vec2(600, 50));
	buttonExBase->setScale(1.1f);
	this->addChild(buttonExBase);

	//빛 스프라이트
	topLite = Sprite::create("Bubble_Effect/Lighting_Background.png");
	topLite->setPosition(Vec2(320,800));
	this->addChild(topLite);

	leftLite = Sprite::create("Bubble_Effect/Title_Light_Effect.png");
	leftLite->setPosition(Vec2(280, 600));
	leftLite->setScale(1.5f);
	this->addChild(leftLite);

	bgLite = Sprite::create("Bubble_Effect/Flash_001.png");
	bgLite->setPosition(Vec2(280, 600));
	this->addChild(bgLite);

	bgLite2 = Sprite::create("Bubble_Effect/Flash_002.png");
	bgLite2->setPosition(Vec2(280, 600));
	this->addChild(bgLite2);

	bgLite3 = Sprite::create("Bubble_Effect/Flash_003.png");
	bgLite3->setPosition(Vec2(280, 600));
	this->addChild(bgLite3);

	//액션실행함수
	BubbleAction();
	LogoAction();
	ButtonAction();
	LiteAction();
	FishAction();
    return true;
}