浏览代码

Remove trail spaces

pull/832/head
Ray 6 年前
父节点
当前提交
97c8a28aaa
共有 4 个文件被更改,包括 29 次插入29 次删除
  1. +9
    -9
      src/core.c
  2. +14
    -14
      src/rlgl.h
  3. +4
    -4
      src/shapes.c
  4. +2
    -2
      src/textures.c

+ 9
- 9
src/core.c 查看文件

@ -1302,7 +1302,7 @@ void EndTextureMode(void)
// Set viewport to default framebuffer size // Set viewport to default framebuffer size
SetupViewport(renderWidth, renderHeight); SetupViewport(renderWidth, renderHeight);
// Reset current screen size // Reset current screen size
currentWidth = GetScreenWidth(); currentWidth = GetScreenWidth();
currentHeight = GetScreenHeight(); currentHeight = GetScreenHeight();
@ -2241,7 +2241,7 @@ Vector2 GetMousePosition(void)
#endif #endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
Vector2 pos = GetTouchPosition(0); Vector2 pos = GetTouchPosition(0);
// Touch position has priority over mouse position // Touch position has priority over mouse position
if ((pos.x > 0) && (pos.y > 0)) position = pos; // There was a touch! if ((pos.x > 0) && (pos.y > 0)) position = pos; // There was a touch!
#endif #endif
@ -2933,7 +2933,7 @@ static void SetupViewport(int width, int height)
{ {
renderWidth = width; renderWidth = width;
renderHeight = height; renderHeight = height;
// Set viewport width and height // Set viewport width and height
// NOTE: We consider render size and offset in case black bars are required and // NOTE: We consider render size and offset in case black bars are required and
// render area does not match full display area (this situation is only applicable on fullscreen mode) // render area does not match full display area (this situation is only applicable on fullscreen mode)
@ -2944,7 +2944,7 @@ static void SetupViewport(int width, int height)
// Set orthographic projection to current framebuffer size // Set orthographic projection to current framebuffer size
// NOTE: Configured top-left corner as (0, 0) // NOTE: Configured top-left corner as (0, 0)
rlOrtho(0, renderWidth, renderHeight, 0, 0.0f, 1.0f);
rlOrtho(0, renderWidth, renderHeight, 0, 0.0f, 1.0f);
rlMatrixMode(RL_MODELVIEW); // Switch back to MODELVIEW matrix rlMatrixMode(RL_MODELVIEW); // Switch back to MODELVIEW matrix
rlLoadIdentity(); // Reset current matrix (MODELVIEW) rlLoadIdentity(); // Reset current matrix (MODELVIEW)
@ -3382,7 +3382,7 @@ static void PollInputEvents(void)
// NOTE: Postprocessing texture is not scaled to new size // NOTE: Postprocessing texture is not scaled to new size
windowResized = true; windowResized = true;
} break; } break;
case UWP_MSG_SET_GAME_TIME: currentTime = msg->paramDouble0; break; case UWP_MSG_SET_GAME_TIME: currentTime = msg->paramDouble0; break;
default: break; default: break;
@ -3734,7 +3734,7 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height)
screenHeight = height; screenHeight = height;
currentWidth = width; currentWidth = width;
currentHeight = height; currentHeight = height;
// NOTE: Postprocessing texture is not scaled to new size // NOTE: Postprocessing texture is not scaled to new size
windowResized = true; windowResized = true;
@ -4361,7 +4361,7 @@ static void InitEvdevInput(void)
// Open the linux directory of "/dev/input" // Open the linux directory of "/dev/input"
directory = opendir(DEFAULT_EVDEV_PATH); directory = opendir(DEFAULT_EVDEV_PATH);
if (directory) if (directory)
{ {
while ((entity = readdir(directory)) != NULL) while ((entity = readdir(directory)) != NULL)
@ -4708,7 +4708,7 @@ static void *EventThread(void *arg)
if ((event.code >= 1) && (event.code <= 255)) //Keyboard keys appear for codes 1 to 255 if ((event.code >= 1) && (event.code <= 255)) //Keyboard keys appear for codes 1 to 255
{ {
keycode = keymap_US[event.code & 0xFF]; // The code we get is a scancode so we look up the apropriate keycode keycode = keymap_US[event.code & 0xFF]; // The code we get is a scancode so we look up the apropriate keycode
// Make sure we got a valid keycode // Make sure we got a valid keycode
if ((keycode > 0) && (keycode < sizeof(currentKeyState))) if ((keycode > 0) && (keycode < sizeof(currentKeyState)))
{ {
@ -4721,7 +4721,7 @@ static void *EventThread(void *arg)
lastKeyPressedEvdev.Head = (lastKeyPressedEvdev.Head + 1) & 0x07; // Increment the head pointer forwards and binary wraparound after 7 (fifo is 8 elements long) lastKeyPressedEvdev.Head = (lastKeyPressedEvdev.Head + 1) & 0x07; // Increment the head pointer forwards and binary wraparound after 7 (fifo is 8 elements long)
// TODO: This fifo is not fully threadsafe with multiple writers, so multiple keyboards hitting a key at the exact same time could miss a key (double write to head before it was incremented) // TODO: This fifo is not fully threadsafe with multiple writers, so multiple keyboards hitting a key at the exact same time could miss a key (double write to head before it was incremented)
} }
TraceLog(LOG_DEBUG, "KEY%s ScanCode: %4i KeyCode: %4i",event.value == 0 ? "UP":"DOWN", event.code, keycode); TraceLog(LOG_DEBUG, "KEY%s ScanCode: %4i KeyCode: %4i",event.value == 0 ? "UP":"DOWN", event.code, keycode);
} }
} }

+ 14
- 14
src/rlgl.h 查看文件

@ -64,7 +64,7 @@
#if defined(RLGL_STANDALONE) #if defined(RLGL_STANDALONE)
#define RAYMATH_STANDALONE #define RAYMATH_STANDALONE
#define RAYMATH_HEADER_ONLY #define RAYMATH_HEADER_ONLY
#if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED) #if defined(_WIN32) && 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 raylib as a Win32 shared library (.dll)
#elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED) #elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED)
@ -72,7 +72,7 @@
#else #else
#define RLAPI // We are building or using raylib as a static library (or Linux shared library) #define RLAPI // We are building or using raylib as a static library (or Linux shared library)
#endif #endif
// Allow custom memory allocators // Allow custom memory allocators
#ifndef RL_MALLOC #ifndef RL_MALLOC
#define RL_MALLOC(sz) malloc(sz) #define RL_MALLOC(sz) malloc(sz)
@ -544,7 +544,7 @@ RLAPI void EndBlendMode(void); // End blending mode (re
RLAPI void InitVrSimulator(void); // Init VR simulator for selected device parameters RLAPI void InitVrSimulator(void); // Init VR simulator for selected device parameters
RLAPI void CloseVrSimulator(void); // Close VR simulator for current device RLAPI void CloseVrSimulator(void); // Close VR simulator for current device
RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
RLAPI void SetVrConfiguration(VrDeviceInfo info, Shader distortion); // Set stereo rendering configuration parameters
RLAPI void SetVrConfiguration(VrDeviceInfo info, Shader distortion); // Set stereo rendering configuration parameters
RLAPI bool IsVrSimulatorReady(void); // Detect if VR simulator is ready RLAPI bool IsVrSimulatorReady(void); // Detect if VR simulator is ready
RLAPI void ToggleVrMode(void); // Enable/Disable VR experience RLAPI void ToggleVrMode(void); // Enable/Disable VR experience
RLAPI void BeginVrDrawing(void); // Begin VR simulator stereo rendering RLAPI void BeginVrDrawing(void); // Begin VR simulator stereo rendering
@ -1567,11 +1567,11 @@ void rlglInit(int width, int height)
glBindVertexArray = (PFNGLBINDVERTEXARRAYOESPROC)eglGetProcAddress("glBindVertexArrayOES"); glBindVertexArray = (PFNGLBINDVERTEXARRAYOESPROC)eglGetProcAddress("glBindVertexArrayOES");
glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress("glDeleteVertexArraysOES"); glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress("glDeleteVertexArraysOES");
//glIsVertexArray = (PFNGLISVERTEXARRAYOESPROC)eglGetProcAddress("glIsVertexArrayOES"); // NOTE: Fails in WebGL, omitted //glIsVertexArray = (PFNGLISVERTEXARRAYOESPROC)eglGetProcAddress("glIsVertexArrayOES"); // NOTE: Fails in WebGL, omitted
if (glGenVertexArrays == NULL) printf("glGenVertexArrays is NULL.\n"); // WEB: ISSUE FOUND! ...but why? if (glGenVertexArrays == NULL) printf("glGenVertexArrays is NULL.\n"); // WEB: ISSUE FOUND! ...but why?
if (glBindVertexArray == NULL) printf("glBindVertexArray is NULL.\n"); // WEB: ISSUE FOUND! ...but why? if (glBindVertexArray == NULL) printf("glBindVertexArray is NULL.\n"); // WEB: ISSUE FOUND! ...but why?
} }
// TODO: HACK REVIEW! // TODO: HACK REVIEW!
// For some reason on raylib 2.5, VAO usage breaks the build // For some reason on raylib 2.5, VAO usage breaks the build
// error seems related to function pointers but I can not get detailed info... // error seems related to function pointers but I can not get detailed info...
@ -2488,19 +2488,19 @@ void rlLoadMesh(Mesh *mesh, bool dynamic)
unsigned int rlLoadAttribBuffer(unsigned int vaoId, int shaderLoc, void *buffer, int size, bool dynamic) unsigned int rlLoadAttribBuffer(unsigned int vaoId, int shaderLoc, void *buffer, int size, bool dynamic)
{ {
unsigned int id = 0; unsigned int id = 0;
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
int drawHint = GL_STATIC_DRAW; int drawHint = GL_STATIC_DRAW;
if (dynamic) drawHint = GL_DYNAMIC_DRAW; if (dynamic) drawHint = GL_DYNAMIC_DRAW;
if (vaoSupported) glBindVertexArray(vaoId); if (vaoSupported) glBindVertexArray(vaoId);
glGenBuffers(1, &id); glGenBuffers(1, &id);
glBindBuffer(GL_ARRAY_BUFFER, id); glBindBuffer(GL_ARRAY_BUFFER, id);
glBufferData(GL_ARRAY_BUFFER, size, buffer, drawHint); glBufferData(GL_ARRAY_BUFFER, size, buffer, drawHint);
glVertexAttribPointer(shaderLoc, 2, GL_FLOAT, 0, 0, 0); glVertexAttribPointer(shaderLoc, 2, GL_FLOAT, 0, 0, 0);
glEnableVertexAttribArray(shaderLoc); glEnableVertexAttribArray(shaderLoc);
if (vaoSupported) glBindVertexArray(0); if (vaoSupported) glBindVertexArray(0);
#endif #endif
@ -3536,7 +3536,7 @@ void InitVrSimulator(void)
// Initialize framebuffer and textures for stereo rendering // Initialize framebuffer and textures for stereo rendering
// NOTE: Screen size should match HMD aspect ratio // NOTE: Screen size should match HMD aspect ratio
stereoFbo = rlLoadRenderTexture(screenWidth, screenHeight, UNCOMPRESSED_R8G8B8A8, 24, false); stereoFbo = rlLoadRenderTexture(screenWidth, screenHeight, UNCOMPRESSED_R8G8B8A8, 24, false);
vrSimulatorReady = true; vrSimulatorReady = true;
#else #else
TraceLog(LOG_WARNING, "VR Simulator not supported on OpenGL 1.1"); TraceLog(LOG_WARNING, "VR Simulator not supported on OpenGL 1.1");
@ -3558,13 +3558,13 @@ void CloseVrSimulator(void)
#endif #endif
} }
// Set stereo rendering configuration parameters
// Set stereo rendering configuration parameters
void SetVrConfiguration(VrDeviceInfo hmd, Shader distortion) void SetVrConfiguration(VrDeviceInfo hmd, Shader distortion)
{ {
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
// Reset vrConfig for a new values assignment // Reset vrConfig for a new values assignment
memset(&vrConfig, 0, sizeof(vrConfig)); memset(&vrConfig, 0, sizeof(vrConfig));
// Assign distortion shader // Assign distortion shader
vrConfig.distortionShader = distortion; vrConfig.distortionShader = distortion;
@ -3620,7 +3620,7 @@ void SetVrConfiguration(VrDeviceInfo hmd, Shader distortion)
// Compute eyes Viewports // Compute eyes Viewports
vrConfig.eyeViewportRight[2] = hmd.hResolution/2; vrConfig.eyeViewportRight[2] = hmd.hResolution/2;
vrConfig.eyeViewportRight[3] = hmd.vResolution; vrConfig.eyeViewportRight[3] = hmd.vResolution;
vrConfig.eyeViewportLeft[0] = hmd.hResolution/2; vrConfig.eyeViewportLeft[0] = hmd.hResolution/2;
vrConfig.eyeViewportLeft[1] = 0; vrConfig.eyeViewportLeft[1] = 0;
vrConfig.eyeViewportLeft[2] = hmd.hResolution/2; vrConfig.eyeViewportLeft[2] = hmd.hResolution/2;
@ -3677,7 +3677,7 @@ void BeginVrDrawing(void)
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
if (vrSimulatorReady) if (vrSimulatorReady)
{ {
rlEnableRenderTexture(stereoFbo.id); // Setup framebuffer for stereo rendering rlEnableRenderTexture(stereoFbo.id); // Setup framebuffer for stereo rendering
//glEnable(GL_FRAMEBUFFER_SRGB); // Enable SRGB framebuffer (only if required) //glEnable(GL_FRAMEBUFFER_SRGB); // Enable SRGB framebuffer (only if required)

+ 4
- 4
src/shapes.c 查看文件

@ -777,9 +777,9 @@ void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color co
#if defined(SUPPORT_QUADS_DRAW_MODE) #if defined(SUPPORT_QUADS_DRAW_MODE)
if (rlCheckBufferLimit(16*segments/2 + 5*4)) rlglDraw(); if (rlCheckBufferLimit(16*segments/2 + 5*4)) rlglDraw();
rlEnableTexture(GetShapesTexture().id); rlEnableTexture(GetShapesTexture().id);
rlBegin(RL_QUADS); rlBegin(RL_QUADS);
// Draw all of the 4 corners: [1] Upper Left Corner, [3] Upper Right Corner, [5] Lower Right Corner, [7] Lower Left Corner // Draw all of the 4 corners: [1] Upper Left Corner, [3] Upper Right Corner, [5] Lower Right Corner, [7] Lower Left Corner
for (int k = 0; k < 4; ++k) // Hope the compiler is smart enough to unroll this loop for (int k = 0; k < 4; ++k) // Hope the compiler is smart enough to unroll this loop
@ -1010,9 +1010,9 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, int
{ {
#if defined(SUPPORT_QUADS_DRAW_MODE) #if defined(SUPPORT_QUADS_DRAW_MODE)
if (rlCheckBufferLimit(4*4*segments + 4*4)) rlglDraw(); // 4 corners with 4 vertices for each segment + 4 rectangles with 4 vertices each if (rlCheckBufferLimit(4*4*segments + 4*4)) rlglDraw(); // 4 corners with 4 vertices for each segment + 4 rectangles with 4 vertices each
rlEnableTexture(GetShapesTexture().id); rlEnableTexture(GetShapesTexture().id);
rlBegin(RL_QUADS); rlBegin(RL_QUADS);
// Draw all of the 4 corners first: Upper Left Corner, Upper Right Corner, Lower Right Corner, Lower Left Corner // Draw all of the 4 corners first: Upper Left Corner, Upper Right Corner, Lower Right Corner, Lower Left Corner
for (int k = 0; k < 4; ++k) // Hope the compiler is smart enough to unroll this loop for (int k = 0; k < 4; ++k) // Hope the compiler is smart enough to unroll this loop

+ 2
- 2
src/textures.c 查看文件

@ -112,11 +112,11 @@
defined(SUPPORT_FILEFORMAT_GIF) || \ defined(SUPPORT_FILEFORMAT_GIF) || \
defined(SUPPORT_FILEFORMAT_PIC) || \ defined(SUPPORT_FILEFORMAT_PIC) || \
defined(SUPPORT_FILEFORMAT_HDR)) defined(SUPPORT_FILEFORMAT_HDR))
#define STBI_MALLOC RL_MALLOC #define STBI_MALLOC RL_MALLOC
#define STBI_FREE RL_FREE #define STBI_FREE RL_FREE
#define STBI_REALLOC(p,newsz) realloc(p,newsz) #define STBI_REALLOC(p,newsz) realloc(p,newsz)
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "external/stb_image.h" // Required for: stbi_load_from_file() #include "external/stb_image.h" // Required for: stbi_load_from_file()
// NOTE: Used to read image data (multiple formats support) // NOTE: Used to read image data (multiple formats support)

正在加载...
取消
保存