|
|
@ -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 |
|
|
|