diff options
| author | Ray <[email protected]> | 2021-10-03 12:09:59 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2021-10-03 12:09:59 +0200 |
| commit | f869229b7ff187a5f18feb0ba82e7e80c9c98a7b (patch) | |
| tree | 595a73831ab0f9aab2dd7ef34fb992d5f5d3a213 /src/rcore.c | |
| parent | 239c37246a533681953554a303e68f25b9ceba17 (diff) | |
| download | raylib-f869229b7ff187a5f18feb0ba82e7e80c9c98a7b.tar.gz raylib-f869229b7ff187a5f18feb0ba82e7e80c9c98a7b.zip | |
Minor format tweaks
Diffstat (limited to 'src/rcore.c')
| -rw-r--r-- | src/rcore.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/rcore.c b/src/rcore.c index 45b11fcf..cb212af3 100644 --- a/src/rcore.c +++ b/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 |
