Пример #1
0
void g2Controller::__MouseDrag(int x, int y)
{
    // Ignore if not visible
    if(!GetVisibility())
        return;
    
    // No need to change coordinates; they
    // are already localized by the calling parent
    
    // Update mouse drag
    MouseDrag(x, y);
    
    // Update all children
    int QueueSize = (int)ChildObjects.size();
    for(int i = 0; i < QueueSize; i++)
    {
        // Get child
        g2Controller* Child = ChildObjects.front();
        ChildObjects.pop();
        
        // Update child mouse drags
        Child->__MouseDrag(x, y);
        
        // Put back
        ChildObjects.push(Child);
    }
}
Пример #2
0
Bool ColorBox::InputEvent(const BaseContainer &msg)
{
	if(msg.GetInt32(BFM_INPUT_DEVICE) == BFM_INPUT_MOUSE){
		if(msg.GetInt32(BFM_INPUT_CHANNEL) == BFM_INPUT_MOUSELEFT){
			m_mouseX = msg.GetInt32(BFM_INPUT_X);
			m_mouseY = msg.GetInt32(BFM_INPUT_Y);
			m_mouseDown = TRUE;
			Global2Local(&m_mouseX, &m_mouseY);
			MouseDragStart(BFM_INPUT_MOUSELEFT,m_mouseX, m_mouseY,MOUSEDRAGFLAGS_0);
			MouseUpdate();
		}
	}
	Float x, y;
	BaseContainer channels;
	while (MouseDrag(&x, &y, &channels) == MOUSEDRAGRESULT_CONTINUE)
	{
		m_mouseX -= x;
		m_mouseY -= y;
		//Global2Local(&m_mouseX, &m_mouseY);
		MouseUpdate();
	}
	BaseContainer res;
	if(GetInputState(BFM_INPUT_MOUSE,BFM_INPUT_MOUSELEFT,res) && res.GetInt32(BFM_INPUT_VALUE) == 0){
		if(m_mouseDown){
			MouseDragEnd();
			m_mouseDown = FALSE;
		}
	}

	return FALSE;
}
Пример #3
0
void g2Controller::__MouseDrag(int x, int y)
{
    // Ignore if not visible
    if(!GetVisibility())
        return;
    
    // No need to change coordinates; they
    // are already localized by the calling parent
    
    // Update mouse drag
    MouseDrag(x, y);
    
    // Update all children
    for(ChildObjectsIt Child = ChildObjects.begin(); Child != ChildObjects.end(); Child++)
        (*Child)->__MouseDrag(x, y);
}
Пример #4
0
void Game::OnLoop()
{
    CapFrameRate(60);

    //Gravity

    //Character.Gravity(WindowHeight);

    //Collisions

    //if(Character.CheckEntityColl(Block) ==  true)
    //{
    //    cout<<"Character is in collision with the Block"<<endl;
    //    Character.CanMove = false;
   // }
    //else
    //    Character.CanMove = true;

    //Cursor

    SDL_SetCursor(SDL_GetDefaultCursor());

    //Drag Entities with mouse
    //MouseDrag(&Block);
    //MouseDrag(&Character);

    if(MouseDragReset(&Cloud) == true)
    {
        water += Raining;

        if(chorbi > 5)
        {
            CreateKapka();
            chorbi = 0;
        }
    }

    chorbi ++;

    if(MouseDragReset(&Fertilizer) == true)
    {
        if(Fertilizer.XPos + 30 < lineX1)
            beenDrop = true;
    }
    else if(beenDrop == true)
    {
        fertilize += BeRiching;
        beenDrop = false;
    }

    fertilize -= Disolving;

    // Water Function
    water -= Drying;

    for(int i = 0; i < maxKapki; i ++)
    {
        Kapka[i].YPos += 6;

        if(Kapka[i].YPos > 430)
        {
            Kapka[i].falling = false;
        }
    }

    if(water < desert) water = desert;
    if(water > ocean) water = ocean;

    if(fertilize < 1) fertilize = 1;
    if(fertilize > 10) fertilize = 10;

    waterPointer.x = waterX * water;
    fertilizePointer.x = fertilizeX * fertilize;

    cout<<waterPointer.x<< " " << water<<endl;
    cout<<"Soil fertily "<<fertilize<<" "<<fertilizeX<<"  "<<fertilizePointer.x<<endl;

    for(int i = 0; i < 10; i ++)
    {
        if(Rubish[i].falling == true)
        {
            if(MouseDragReset(&Rubish[i]) == true)
            {
                int mouseX = 0;
                int mouseY = 0;

                SDL_GetMouseState(&mouseX, &mouseY);

                if(RecycleBin.Hover(mouseX, mouseY) == true)
                {
                    Rubish[i].falling = false;
                    dragOne = false;
                    Rubish[i].draggable = false;
                }
            }
            cout<<"Xpos: "<<Rubish[i].XPos<<" Ypos: "<<Rubish[i].YPos<<endl;
        }
    }

    if(timeRub == 200)
    {
        RandomRubbish();
        timeRub = 0;
    }

    cout<<timeRub<<endl;

    timeRub ++;

    int help = 4;
    MouseDrag(&Level[help]);
    cout<<Level[help].XPos<<" "<<Level[help].YPos<<endl;

}