Advertisement
xerpi

Methods.h 7-2-12_pre-alpha1

Feb 7th, 2012
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.06 KB | None | 0 0
  1. #ifndef _Methods_H_
  2. #define _Methods_H_
  3.  
  4. #include <grrlib.h>
  5. #include <stdlib.h>
  6. #include <math.h>
  7. #include <wiiuse/wpad.h>
  8.  
  9. #define byte unsigned char
  10. #define PI 3.1415926536f
  11.  
  12.  
  13. //Image-Draw
  14.     //Loads an image from a file
  15.         #define LoadImage GRRLIB_LoadTextureFromFile
  16.     //Draws an image passing all the parameters
  17.         #define DrawImg GRRLIB_DrawImg
  18.     //Draws an image passing X and Y
  19.         void DrawImageXY(const float x, const float y, const GRRLIB_texImg *tex);
  20.     //Draws an image passing one scale
  21.         void DrawImageScale(const float x, const float y, const GRRLIB_texImg *tex, const float degrees, const float scale, const u32 color);
  22.     //Center an image
  23.         void CenterImage(GRRLIB_texImg *tex);
  24. //Math
  25.     //2 Power of a number
  26.         float Pow2(float x);
  27.     //Distance between 2 pixels
  28.         float PtDistance(float x1, float y1, float x2, float y2);
  29.     //Distance between 2 circles
  30.         bool CircleCollision(float x1, float y1, float radius1, float x2, float y2, float radius2);
  31.     //If a pixel is in a circle
  32.         bool PtInCircle(float x1, float y1, float x2, float y2, float radius);
  33.     //Collision between a circle and a annulus
  34.         bool CircleOnAnnulus(float x1, float y1, float r1, float x2, float y2, float r2_R, float r2_r);
  35.     //Angle between 2 pixels
  36.         float PtAngle(float x1, float y1, float x2, float y2);
  37.     //Simple degree to radian conversion
  38.         float toRad(float angle);
  39.     //Simple radian to degree conversion
  40.         float toDeg(float angle);
  41.     //Returns a random float between two floats
  42.         float RandomFloat(float a, float b);
  43.     //Returns a random int between two int
  44.         int RandomInt(int min, int max);
  45.         //Converts the negative angle system to the normal system
  46.             float toNormalDeg(float deg);
  47. //Wii
  48.     //Returns de nunchuk angle
  49.         float NunchukAng(int pad);
  50.     //Returns de nunchuk magnitude
  51.         float NunchukMag(int pad);
  52.     //Gets de nunchuk angle and magnitude
  53.         void NunchukAngMag(int pad, float *ang, float *mag);
  54.     //Returns if nunchunk joystick is moving
  55.         bool NunJoyMoving(int pad);
  56.     //Angle between wiimote ir and a plot
  57.         float WiimoteIrAngle(int pad, float x, float y);
  58. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement