ソースを参照

Minor format tweaks

Ray 3 年 前
コミット
f869229b7f
7 ファイル変更27 行追加25 行削除
  1. 3 3
      examples/models/models_mesh_picking.c
  2. 1 1
      src/raylib.h
  3. 2 2
      src/raymath.h
  4. 15 13
      src/rcore.c
  5. 3 3
      src/rgestures.h
  6. 2 2
      src/rlgl.h
  7. 1 1
      src/rtext.c

+ 3 - 3
examples/models/models_mesh_picking.c

@@ -101,10 +101,10 @@ int main(void)
 
             bary = Vector3Barycenter(collision.point, ta, tb, tc);
         }
-        
+
         // Check ray collision against test sphere
         RayCollision sphereHitInfo = GetRayCollisionSphere(ray, sp, sr);
-        
+
         if ((sphereHitInfo.hit) && (sphereHitInfo.distance < collision.distance))
         {
             collision = sphereHitInfo;
@@ -173,7 +173,7 @@ int main(void)
                 }
 
                 DrawRay(ray, MAROON);
-                
+
                 DrawGrid(10, 10.0f);
 
             EndMode3D();

+ 1 - 1
src/raylib.h

@@ -1300,7 +1300,7 @@ RLAPI Vector3 ColorToHSV(Color color);                                      // G
 RLAPI Color ColorFromHSV(float hue, float saturation, float value);         // Get a Color from HSV values, hue [0..360], saturation/value [0..1]
 RLAPI Color ColorAlpha(Color color, float alpha);                           // Get color with alpha applied, alpha goes from 0.0f to 1.0f
 RLAPI Color ColorAlphaBlend(Color dst, Color src, Color tint);              // Get src alpha-blended into dst color with tint
-RLAPI Color GetColor(unsigned int hexValue);                                         // Get Color structure from hexadecimal value
+RLAPI Color GetColor(unsigned int hexValue);                                // Get Color structure from hexadecimal value
 RLAPI Color GetPixelColor(void *srcPtr, int format);                        // Get Color from a source pixel pointer of certain format
 RLAPI void SetPixelColor(void *dstPtr, Color color, int format);            // Set color formatted into destination pixel pointer
 RLAPI int GetPixelDataSize(int width, int height, int format);              // Get pixel data size in bytes for certain format

+ 2 - 2
src/raymath.h

@@ -17,8 +17,8 @@
 *
 *     - Functions are always self-contained, no function use another raymath function inside,
 *       required code is directly re-implemented inside
-*     - Functions input parameters are always received by value
-*     - Functions use always a "result" variable for return
+*     - Functions input parameters are always received by value (2 unavoidable exceptions)
+*     - Functions use always a "result" anmed variable for return
 *     - Functions are always defined inline
 *     - Angles are always in radians (DEG2RAD/RAD2DEG macros provided for convenience)
 *

+ 15 - 13
src/rcore.c

@@ -2285,7 +2285,7 @@ Shader LoadShader(const char *vsFileName, const char *fsFileName)
 
     char *vShaderStr = NULL;
     char *fShaderStr = NULL;
-    
+
     if (vsFileName != NULL) vShaderStr = LoadFileText(vsFileName);
     if (fsFileName != NULL) fShaderStr = LoadFileText(fsFileName);
 
@@ -2519,6 +2519,8 @@ Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int heigh
     // Calculate view matrix from camera look at (and transpose it)
     Matrix matView = MatrixLookAt(camera.position, camera.target, camera.up);
 
+    // TODO: Why not use Vector3Transform(Vector3 v, Matrix mat)?
+
     // Convert world position vector to quaternion
     Quaternion worldPos = { position.x, position.y, position.z, 1.0f };
 
@@ -3579,9 +3581,9 @@ Vector2 GetTouchPosition(int index)
 int GetTouchPointId(int index)
 {
     int id = -1;
-    
+
     if (index < MAX_TOUCH_POINTS) id = CORE.Input.Touch.pointId[index];
-    
+
     return id;
 }
 
@@ -4889,7 +4891,7 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height)
     // Set current screen size
     CORE.Window.screen.width = width;
     CORE.Window.screen.height = height;
-    
+
     // NOTE: Postprocessing texture is not scaled to new size
 }
 
@@ -5302,10 +5304,10 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
 
         return 0;
     }
-    
+
     // Register touch points count
     CORE.Input.Touch.pointCount = AMotionEvent_getPointerCount(event);
-    
+
     for (int i = 0; (i < CORE.Input.Touch.pointCount) && (i < MAX_TOUCH_POINTS); i++)
     {
         // Register touch points id
@@ -5313,7 +5315,7 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
 
         // Register touch points position
         CORE.Input.Touch.position[i] = (Vector2){ AMotionEvent_getX(event, i), AMotionEvent_getY(event, i) };
-        
+
         // Normalize CORE.Input.Touch.position[x] for screenWidth and screenHeight
         CORE.Input.Touch.position[i].x /= (float)GetScreenWidth();
         CORE.Input.Touch.position[i].y /= (float)GetScreenHeight();
@@ -5327,7 +5329,7 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
 
 #if defined(SUPPORT_GESTURES_SYSTEM)        // PLATFORM_ANDROID
     GestureEvent gestureEvent = { 0 };
-    
+
     gestureEvent.pointCount = CORE.Input.Touch.pointCount;
 
     // Register touch actions
@@ -5363,14 +5365,14 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent
 {
     // Register touch points count
     CORE.Input.Touch.pointCount = touchEvent->numTouches;
-    
+
     double canvasWidth = 0.0;
     double canvasHeight = 0.0;
     // NOTE: emscripten_get_canvas_element_size() returns canvas.width and canvas.height but
     // we are looking for actual CSS size: canvas.style.width and canvas.style.height
     //EMSCRIPTEN_RESULT res = emscripten_get_canvas_element_size("#canvas", &canvasWidth, &canvasHeight);
     emscripten_get_element_css_size("#canvas", &canvasWidth, &canvasHeight);
-    
+
     for (int i = 0; (i < CORE.Input.Touch.pointCount) && (i < MAX_TOUCH_POINTS); i++)
     {
         // Register touch points id
@@ -5382,14 +5384,14 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent
         // Normalize gestureEvent.position[x] for CORE.Window.screen.width and CORE.Window.screen.height
         CORE.Input.Touch.position[i].x *= ((float)GetScreenWidth()/(float)canvasWidth);
         CORE.Input.Touch.position[i].y *= ((float)GetScreenHeight()/(float)canvasHeight);
-        
+
         if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) CORE.Input.Touch.currentTouchState[i] = 1;
         else if (eventType == EMSCRIPTEN_EVENT_TOUCHEND) CORE.Input.Touch.currentTouchState[i] = 0;
     }
 
 #if defined(SUPPORT_GESTURES_SYSTEM)        // PLATFORM_WEB
     GestureEvent gestureEvent = { 0 };
-    
+
     gestureEvent.pointCount = CORE.Input.Touch.pointCount;
 
     // Register touch actions
@@ -5427,7 +5429,7 @@ static EM_BOOL EmscriptenGamepadCallback(int eventType, const EmscriptenGamepadE
     {
         CORE.Input.Gamepad.ready[gamepadEvent->index] = true;
         sprintf(CORE.Input.Gamepad.name[gamepadEvent->index],"%s",gamepadEvent->id);
-    } 
+    }
     else CORE.Input.Gamepad.ready[gamepadEvent->index] = false;
 
     // TODO: Test gamepadEvent->index

+ 3 - 3
src/rgestures.h

@@ -94,9 +94,9 @@ typedef enum {
 } Gesture;
 #endif
 
-typedef enum { 
-    TOUCH_ACTION_UP = 0, 
-    TOUCH_ACTION_DOWN, 
+typedef enum {
+    TOUCH_ACTION_UP = 0,
+    TOUCH_ACTION_DOWN,
     TOUCH_ACTION_MOVE,
     TOUCH_ACTION_CANCEL
 } TouchAction;

+ 2 - 2
src/rlgl.h

@@ -111,9 +111,9 @@
 
 #if defined(_WIN32)
     #if defined(BUILD_LIBTYPE_SHARED)
-        #define RLAPI __declspec(dllexport)         // We are building raylib as a Win32 shared library (.dll)
+        #define RLAPI __declspec(dllexport)         // We are building rlgl as a Win32 shared library (.dll)
     #elif defined(USE_LIBTYPE_SHARED)
-        #define RLAPI __declspec(dllimport)         // We are using raylib as a Win32 shared library (.dll)
+        #define RLAPI __declspec(dllimport)         // We are using rlgl as a Win32 shared library (.dll)
     #endif
 #endif
 

+ 1 - 1
src/rtext.c

@@ -512,7 +512,7 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int
             }
 
             UnloadImage(atlas);
-            
+
             // TRACELOG(LOG_INFO, "FONT: Font loaded successfully (%i glyphs)", font.glyphCount);
         }
         else font = GetFontDefault();