Guest User

Untitled

a guest
Jul 30th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class LTTGHUD extends HUD;
  2.  
  3. var LTTGMouseInput LTTGMouseInput;
  4.  
  5. var float CursorPosX, CursorPosY;
  6. var float DeCursorPosX, DeCursorPosY;
  7.  
  8. var Vector WorldOrigin, WorldDirection;
  9.  
  10. var vector2d MousePos;
  11. var Actor traceHit;
  12.  
  13. /***********************************************************
  14. ** DrawHud                                    **
  15. ***********************************************************/
  16.  
  17. Function PostRender()
  18. {
  19.       MousePos.X = DeCursorPosX;
  20.       MousePos.Y = DeCursorPosY;
  21.  
  22.       //Deproject the mouse from screen coordinate to world coordinate and store World Origin and Dir.
  23.       Canvas.DeProject(MousePos, WorldOrigin, WorldDirection);
  24.  
  25.       Super.PostRender();
  26. }
  27.  
  28. function DrawHud()
  29. {
  30.       DrawMouseCursor();
  31.       DrawDebug();
  32.  
  33.       //DrawDebugLine (WorldOrigin, end, 255, 0, 0, true);
  34. }
  35.  
  36.  
  37. /***********************************************************
  38. ** MouseCursor                                    **
  39. ***********************************************************/
  40.  
  41. function DrawMouseCursor()
  42. {
  43.       local Texture2d CursorTex;
  44.       local vector loc, norm;
  45.       var TraceHitInfo hitInfo;
  46.       //Typecast
  47.       LTTGMouseInput = LTTGMouseInput(PlayerOwner.PlayerInput);     //references the playerinput
  48.  
  49.       CursorPosX = LTTGMouseInput.MousePosition.X;
  50.       CursorPosY = LTTGMouseInput.MousePosition.Y;
  51.  
  52.       CursorTex = Texture2D'EngineResources.Cursors.Arrow';                       //Find our own cursorgfx here!
  53.  
  54.       // Set the canvas position to the mouse position & Draw Texture.
  55.       Canvas.SetPos(CursorPosX, CursorPosY);
  56.       Canvas.SetDrawColor(200, 200, 200, 200);
  57.       Canvas.DrawTile(CursorTex, Canvas.ClipX*1/30, Canvas.ClipX*1/30,  0.f, 0.f, CursorTex.SizeX, CursorTex.SizeY);
  58.  
  59.       //Trace
  60.       traceHit = trace(loc, norm, WorldOrigin + WorldDirection * 65536.f,  WorldOrigin, true,, hitInfo);
  61.  
  62.       DeCursorPosX = CursorPosX;
  63.       DeCursorPosY = CursorPosY;
  64. }
  65.  
  66.  
  67. function DrawDebug()
  68. {
  69.          Canvas.SetPos(10,10);
  70.          Canvas.SetDrawColor(255, 255, 255, 255);
  71.          Canvas.DrawText(WorldDirection);
  72.  
  73.          Canvas.SetPos(10,30);
  74.          Canvas.SetDrawColor(255, 255, 255, 255);
  75.          Canvas.DrawText(tracehit);
  76.  
  77.          Canvas.SetPos(10,50);
  78.          Canvas.SetDrawColor(255, 255, 255, 255);
  79.          Canvas.DrawText("Selected Unit:" @ LTTGMouseInput.SelectedUnit);
  80.  
  81. }
  82.  
  83. /********************************************
  84. * Default Properties                        *
  85. ********************************************/
  86.  
  87. defaultproperties
  88. {
  89.  
  90. }
Add Comment
Please, Sign In to add comment