Advertisement
Guest User

Untitled

a guest
Apr 14th, 2014
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1.  
  2. // Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
  3.  
  4. #include "Elemental.h"
  5. #include "Json.h"
  6. #include "FileManager.h"
  7.  
  8. DEFINE_LOG_CATEGORY_STATIC(LogGestures, All, All)
  9.  
  10. UElementalGestureListener::UElementalGestureListener(const class FPostConstructInitializeProperties& PCIP)
  11. : Super(PCIP)
  12. , bIsListening(false)
  13. {
  14.  
  15. }
  16.  
  17. void UElementalGestureListener::SetController(AElementalPlayerController* InOwner)
  18. {
  19. MyController = InOwner;
  20.  
  21. FOnDragStartEvent DragStartDelegate;
  22. DragStartDelegate.BindUObject(this, &UElementalGestureListener::OnDragStart);
  23. FOnDragUpdateEvent DragUpdateDelegate;
  24. DragUpdateDelegate.BindUObject(this, &UElementalGestureListener::OnDragUpdate);
  25. FOnDragEndEvent DragEndDelegate;
  26. DragEndDelegate.BindUObject(this, &UElementalGestureListener::OnDragEnd);
  27. MyController->RegisterDragEventDelegates(DragStartDelegate, DragUpdateDelegate, DragEndDelegate);
  28. }
  29.  
  30. void UElementalGestureListener::OnDragStart(FVector2D const& ScreenPosition)
  31. {
  32. bIsListening = true;
  33. UE_LOG(LogGestures, Log, TEXT("GestureStart"));
  34. //FGesture newGesture = FGesture();
  35. //CurrentGesture = FGesture(newGesture);
  36. //tmpArray.Reset();
  37. CurrentGesture = FGesture();
  38.  
  39. }
  40. void UElementalGestureListener::OnDragUpdate(FVector2D const& ScreenPosition)
  41. {
  42. if (bIsListening)
  43. {
  44. AddPointToShape(CurrentGesture.Shape, ScreenPosition);
  45. }
  46. }
  47. void UElementalGestureListener::OnDragEnd(FVector2D const& ScreenPosition)
  48. {
  49. bIsListening = false;
  50. }
  51.  
  52. const void UElementalGestureListener::AddPointToShape(FShape& Shape, FVector2D const& Point)
  53. {
  54. CurrentGesture.Shape.Points.Add(Point);
  55. //tmpPoints.Add(Point)
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement