Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Fill out your copyright notice in the Description page of Project Settings.
- #include "HUD/RTS_HUD.h"
- /* Constructor */
- ARTS_HUD::ARTS_HUD()
- {
- }
- /* Override - in the HUD Class, DrawHUD() is the equivelant to tick.... runs everyframe */
- void ARTS_HUD::DrawHUD()
- {
- //Super::DrawHUD();
- if (bStartMarqueeSelect == true)
- {
- CurrentPoint = GetMousePosition2D();
- //CurrentPoint XY distance from origin (initial) point of click
- float DraggedWidth = CurrentPoint.X - InitialPoint.X;
- float DraggedHeight = CurrentPoint.Y - InitialPoint.Y;
- UE_LOG(LogTemp, Warning, TEXT("MousePosition2D: %s "), *CurrentPoint.ToString());
- //Draw the rectangle - InitialPoint = mouse first clicked and held, CurrentPoint = where is the XY on the screen now. Then Draw.
- DrawRect(FLinearColor(0, 0, 1, .22f), InitialPoint.X, InitialPoint.Y, DraggedWidth, DraggedHeight);
- }
- }
- FVector2D ARTS_HUD::GetMousePosition2D()
- {
- float PositionX;
- float PositionY;
- //Get the mouse coordinates from the player controller
- FVector2D MousePosition = GetOwningPlayerController()->GetMousePosition(PositionX, PositionY);
- return MousePosition;
- }
Advertisement
Add Comment
Please, Sign In to add comment