Ejemplo n.º 1
0
int				delcenter(t_select **list, int argc)
{
	moove(*list);
	*list = (*list)->next;
	(*list)->curseur = 'y';
	ft_dellistelmt(&(*list)->prev);
	return (--argc);
}
Ejemplo n.º 2
0
static void			moove(t_select *list)
{
	if (list && list->pos < list->next->pos)
	{
		moove(list->next);
		list->next->pos = list->pos;
		list->next->col = list->col;
		list->next->row = list->row;
	}
}
Ejemplo n.º 3
0
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    BOOL newBall = true;
    static int nrBalls = 0;

    switch (message)                  /* handle the messages */
    {

        case WM_SIZE :
            width = LOWORD(lParam);
            height = HIWORD(lParam);
            if (newBall){
                create(hwnd, lParam, nrBalls);
                newBall = false;
            }
            for (int i = 0; i < nrBalls; i++) {
                ball[i].cxClient = width;
                ball[i].cyClient = height;
                ball[i].xCenter =width/2;
                ball[i].yCenter = height/ 2;
            }
            return 0;
        case WM_MOUSEWHEEL:
            if(GET_WHEEL_DELTA_WPARAM(wParam) < 0) {                            //// SStops to min/max speed
                if(speed < 100){speed += 10;}
                else{return 0;}
            } else {
                if(speed > 10){speed -= 10;}
                else{return 0;}
            }
            KillTimer(hwnd, ID_TIMER);
            SetTimer(hwnd, ID_TIMER, speed, NULL);
            return 0;
        case WM_LBUTTONDOWN :
            if(nrBalls < 19){                                                   //max number of 20 balls
                nrBalls++;
                create(hwnd, lParam, nrBalls);
            }
            return 0;
        case WM_TIMER :
            for (int i = 0; i <= nrBalls; i++){
                moove(hwnd, i);
            }
            return 0;

        case WM_DESTROY:
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}