2009-09-28 6 views

답변

2

베드로는 바로이 질문 마지막 시간이었다 (link)

여기에 그가 무엇에 대해 말하고에 자세히 설명하는 몇 가지 psudocode입니다 :., 새로운 I 마우스를 드래그

 
    on mouse down: 
    for each triangle, in reverse order of their drawing 
     if the pointer is within the triangle's area 
     set the "dragging" state in a member variable 
     add a reference to the triangle to a member variable 
     record the mouse position in a member variable 
     record the initial position of the triangle in a member variable 
     break 
     end if 
    end for 


    on mouse move: 
    if currently in the "dragging" state 
     move the triangle by the same amount the mouse has moved 
    end if 


    on mouse up: 
    if currently in the "dragging" state 
     move the triangle by the same amount as the mouse has moved 
     exit the "dragging" state 
    end if 
+0

everytimes가 삼각형 그려 :-( – Jessy

+0

당신이 페인트 메서드에서 배경을 다시 칠하는 것을 잊어 버린 것 같아요 super.paint (g)를 맨 위에 불러 오거나 Graphics :: clearRect (x, y, w, h) 삼각형을 그리기 전에 – Gunslinger47

+0

감사합니다. 문제는 지금 해결되었습니다 :-) – Jessy

관련 문제