Corrected some bugs and warnings
This commit is contained in:
parent
ceb7325727
commit
7db895ab5d
@ -718,7 +718,7 @@ Ray GetMouseRay(Vector2 mousePosition, Camera camera)
|
||||
|
||||
float realy = (float)GetScreenHeight() - mousePosition.y;
|
||||
|
||||
float z;
|
||||
//float z;
|
||||
// glReadPixels(mousePosition.x, mousePosition.y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);
|
||||
//http://www.bfilipek.com/2012/06/select-mouse-opengl.html
|
||||
|
||||
@ -955,7 +955,7 @@ bool IsCursorHidden()
|
||||
|
||||
// TODO: Enable gamepad usage on Rapsberry Pi
|
||||
// NOTE: emscripten not implemented
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||
// Detect if a gamepad is available
|
||||
bool IsGamepadAvailable(int gamepad)
|
||||
{
|
||||
|
@ -30,7 +30,8 @@
|
||||
#include <stdlib.h> // malloc(), free()
|
||||
#include <stdio.h> // printf(), fprintf()
|
||||
#include <math.h> // Used for ...
|
||||
#include <time.h>
|
||||
#include <time.h> // Used for clock functions
|
||||
#include <stdint.h> // Defines int32_t, int64_t
|
||||
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
#include <jni.h> // Java native interface
|
||||
@ -40,7 +41,7 @@
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
#include <emscripten/emscripten.h>
|
||||
#include <emscripten/emscripten/html5.h>
|
||||
#include <emscripten/html5.h>
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -78,7 +79,7 @@ typedef struct {
|
||||
static GestureType gestureType = TYPE_MOTIONLESS;
|
||||
|
||||
// Gestures detection variables
|
||||
static int32_t touchId;
|
||||
//static int32_t touchId; // Not used...
|
||||
|
||||
// Event
|
||||
static int64_t eventTime = 0;
|
||||
@ -616,13 +617,12 @@ static EM_BOOL EmscriptenInputCallback(int eventType, const EmscriptenTouchEvent
|
||||
else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) gestureEvent.action = MOVE;
|
||||
|
||||
// Points
|
||||
gestureEvent.pointCount = event->numTouches;
|
||||
gestureEvent.pointCount = touchEvent->numTouches;
|
||||
|
||||
// Position
|
||||
gestureEvent.position[0] = (Vector2){ touchEvent->touches[0].canvasX, touchEvent->touches[0].canvasY };
|
||||
gestureEvent.position[1] = (Vector2){ touchEvent->touches[1].canvasX, touchEvent->touches[1].canvasY };
|
||||
|
||||
|
||||
ProcessMotionEvent(gestureEvent);
|
||||
|
||||
return 1;
|
||||
|
@ -437,7 +437,7 @@ void HideCursor(void); // Hides cursor
|
||||
bool IsCursorHidden(void); // Returns true if cursor is not visible
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||
bool IsGamepadAvailable(int gamepad); // Detect if a gamepad is available
|
||||
Vector2 GetGamepadMovement(int gamepad); // Return axis movement vector for a gamepad
|
||||
bool IsGamepadButtonPressed(int gamepad, int button); // Detect if a gamepad button has been pressed once
|
||||
|
@ -920,13 +920,13 @@ Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount)
|
||||
|
||||
float cosHalfTheta = q1.x*q2.x + q1.y*q2.y + q1.z*q2.z + q1.w*q2.w;
|
||||
|
||||
if (abs(cosHalfTheta) >= 1.0f) result = q1;
|
||||
if (fabs(cosHalfTheta) >= 1.0f) result = q1;
|
||||
else
|
||||
{
|
||||
float halfTheta = acos(cosHalfTheta);
|
||||
float sinHalfTheta = sqrt(1.0f - cosHalfTheta*cosHalfTheta);
|
||||
|
||||
if (abs(sinHalfTheta) < 0.001f)
|
||||
if (fabs(sinHalfTheta) < 0.001f)
|
||||
{
|
||||
result.x = (q1.x*0.5f + q2.x*0.5f);
|
||||
result.y = (q1.y*0.5f + q2.y*0.5f);
|
||||
@ -1072,7 +1072,7 @@ Matrix QuaternionToMatrix(Quaternion q)
|
||||
// Returns the axis and the angle for a given quaternion
|
||||
void QuaternionToAxisAngle(Quaternion q, Vector3 *outAxis, float *outAngle)
|
||||
{
|
||||
if (abs(q.w) > 1.0f) QuaternionNormalize(&q);
|
||||
if (fabs(q.w) > 1.0f) QuaternionNormalize(&q);
|
||||
|
||||
Vector3 resAxis = { 0, 0, 0 };
|
||||
float resAngle = 0;
|
||||
|
@ -1411,12 +1411,14 @@ Vector3 rlglUnproject(Vector3 source, Matrix proj, Matrix view)
|
||||
//glGetIntegerv(GL_VIEWPORT, viewport);
|
||||
|
||||
// Viewport data
|
||||
/*
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int width = GetScreenWidth();
|
||||
int height = GetScreenHeight();
|
||||
float minDepth = 0.0f;
|
||||
float maxDepth = 1.0f;
|
||||
*/
|
||||
/*
|
||||
Matrix modelviewprojection = MatrixMultiply(modelview, projection);
|
||||
MatrixInvert(&modelviewprojection);
|
||||
|
@ -395,8 +395,8 @@ bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec)
|
||||
{
|
||||
bool collision = false;
|
||||
|
||||
float dx = abs((rec.x + rec.width/2) - center.x);
|
||||
float dy = abs((rec.y + rec.height/2) - center.y);
|
||||
float dx = fabs((rec.x + rec.width/2) - center.x);
|
||||
float dy = fabs((rec.y + rec.height/2) - center.y);
|
||||
|
||||
if ((dx <= (rec.width/2 + radius)) && (dy <= (rec.height/2 + radius))) collision = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user