Guest User

Untitled

a guest
Jul 30th, 2018
72
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.  
  7. var Vector WorldOrigin, WorldDirection;
  8.  
  9. var vector2d MousePos;
  10.  
  11. /***********************************************************
  12. ** DrawHud                                    **
  13. ***********************************************************/
  14.  
  15. Function PostRender()
  16. {
  17.       If (CursorPosX > 0 && CursorPosY > 0)
  18.       {
  19.                MousePos.X = CursorPosX;
  20.                MousePos.Y = CursorPosY;
  21.       }
  22.  
  23.       //Deproject the mouse from screen coordinate to world coordinate and store World Origin and Dir.
  24.       Canvas.DeProject(MousePos, WorldOrigin, WorldDirection);
  25.      
  26.       DrawHUD();
  27. }
  28.  
  29. function DrawHud()
  30. {
  31.       //Functions
  32.       DrawMouseCursor();
  33.  
  34.       DrawDebug();
  35. }
  36.  
  37.  
  38. /***********************************************************
  39. ** MouseCursor                                    **
  40. ***********************************************************/
  41.  
  42. function DrawMouseCursor()
  43. {
  44.       local Texture2d CursorTex;
  45.  
  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.  
  60.  
  61. function DrawDebug()
  62. {
  63.          Canvas.SetPos(10,10);
  64.          Canvas.SetDrawColor(255, 255, 255, 255);
  65.          Canvas.DrawText(WorldOrigin);
  66. }
  67.  
  68.  
  69. /********************************************
  70. * Default Properties                        *
  71. ********************************************/
  72.  
  73. defaultproperties
  74. {
  75.  
  76. }
Add Comment
Please, Sign In to add comment