Advertisement
Guest User

unreal sdk

a guest
Oct 3rd, 2022
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.46 KB | None | 0 0
  1. /*ue4 sdk*/
  2. struct Vector2
  3. {
  4.  
  5.     float x = 0.f;
  6.     float y = 0.f;
  7.  
  8. };
  9.  
  10. class Vector3
  11. {
  12. public:
  13.     Vector3( ) : x( 0.f ), y( 0.f ), z( 0.f )
  14.     {
  15.  
  16.     }
  17.  
  18.     Vector3( float _x, float _y, float _z ) : x( _x ), y( _y ), z( _z )
  19.     {
  20.  
  21.     }
  22.     ~Vector3( )
  23.     {
  24.  
  25.     }
  26.  
  27.     float x = 0.f;
  28.     float y = 0.f;
  29.     float z = 0.f;
  30.  
  31.     float Dot( Vector3 v )
  32.     {
  33.         return x * v.x + y * v.y + z * v.z;
  34.     }
  35.  
  36.  
  37.     float Length2( ) const
  38.     {
  39.         return sqrt( x * x + y * y + z * z );
  40.     }
  41.  
  42.     float DistTo( const Vector3& vecEnd ) const
  43.     {
  44.         return ( *this - vecEnd ).Length2( );
  45.     }
  46.  
  47.  
  48.     float Distance( Vector3 v )
  49.     {
  50.         return float( sqrt( pow( v.x - x, 2.0 ) + pow( v.y - y, 2.0 ) + pow( v.z - z, 2.0 ) ) );
  51.     }
  52. };
  53.  
  54. template<class T>
  55. struct TArray
  56. {
  57.     friend struct FString;
  58.  
  59. public:
  60.     T* Data;
  61.     int32_t Count;
  62.     int32_t Max;
  63.  
  64.     TArray( )
  65.     {
  66.         Data = nullptr;
  67.         Count = Max = 0;
  68.     };
  69.  
  70.     int Num( ) const
  71.     {
  72.         return Count;
  73.     };
  74.  
  75.     T& operator[]( int i )
  76.     {
  77.         return Data[ i ];
  78.     };
  79.  
  80.     const T& operator[]( int i ) const
  81.     {
  82.         return Data[ i ];
  83.     };
  84.  
  85.     bool IsValidIndex( int i ) const
  86.     {
  87.         return i < Num( );
  88.     };
  89.  
  90. private:
  91.  
  92. };
  93.  
  94. struct FString : public TArray<wchar_t>
  95. {
  96.     FString( )
  97.     {};
  98.  
  99.     FString( const wchar_t* other )
  100.     {
  101.         Max = Count = *other ? wcslen( other ) + 1 : 0;
  102.  
  103.         if ( Count )
  104.             Data = const_cast< wchar_t* >( other );
  105.  
  106.     };
  107.  
  108.     bool IsValid( ) const
  109.     {
  110.         return Data != nullptr;
  111.     }
  112.  
  113.     const wchar_t* c_str( ) const
  114.     {
  115.         return Data;
  116.     }
  117.  
  118.  
  119. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement