REVIEWED: Some PRs formating
This commit is contained in:
parent
cb111ad15e
commit
cc5739a6d7
11 changed files with 111 additions and 79 deletions
|
@ -15,40 +15,12 @@
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
#include <raylib.h>
|
#include "raylib.h"
|
||||||
#include <raymath.h>
|
|
||||||
|
#include "raymath.h"
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
// Sound positioning function
|
// Sound positioning function
|
||||||
//------------------------------------------------------------------------------------
|
static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, float maxDist);
|
||||||
static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, float maxDist)
|
|
||||||
{
|
|
||||||
// Calculate direction vector and distance between listener and sound source
|
|
||||||
Vector3 direction = Vector3Subtract(position, listener.position);
|
|
||||||
float distance = Vector3Length(direction);
|
|
||||||
|
|
||||||
// Apply logarithmic distance attenuation and clamp between 0-1
|
|
||||||
float attenuation = 1.0f / (1.0f + (distance / maxDist));
|
|
||||||
attenuation = Clamp(attenuation, 0.0f, 1.0f);
|
|
||||||
|
|
||||||
// Calculate normalized vectors for spatial positioning
|
|
||||||
Vector3 normalizedDirection = Vector3Normalize(direction);
|
|
||||||
Vector3 forward = Vector3Normalize(Vector3Subtract(listener.target, listener.position));
|
|
||||||
Vector3 right = Vector3Normalize(Vector3CrossProduct(forward, listener.up));
|
|
||||||
|
|
||||||
// Reduce volume for sounds behind the listener
|
|
||||||
float dotProduct = Vector3DotProduct(forward, normalizedDirection);
|
|
||||||
if (dotProduct < 0.0f) {
|
|
||||||
attenuation *= (1.0f + dotProduct * 0.5f);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set stereo panning based on sound position relative to listener
|
|
||||||
float pan = 0.5f + 0.5f * Vector3DotProduct(normalizedDirection, right);
|
|
||||||
|
|
||||||
// Apply final sound properties
|
|
||||||
SetSoundVolume(sound, attenuation);
|
|
||||||
SetSoundPan(sound, pan);
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
|
@ -57,11 +29,12 @@ int main(void)
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
InitWindow(800, 600, "Quick Spatial Sound");
|
const int screenWidth = 800;
|
||||||
InitAudioDevice();
|
const int screenHeight = 450;
|
||||||
|
|
||||||
SetTargetFPS(60);
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - Playing spatialized 3D sound");
|
||||||
DisableCursor();
|
|
||||||
|
InitAudioDevice();
|
||||||
|
|
||||||
Sound sound = LoadSound("resources/coin.wav");
|
Sound sound = LoadSound("resources/coin.wav");
|
||||||
|
|
||||||
|
@ -70,7 +43,12 @@ int main(void)
|
||||||
.target = (Vector3) { 0, 0, 0 },
|
.target = (Vector3) { 0, 0, 0 },
|
||||||
.up = (Vector3) { 0, 1, 0 },
|
.up = (Vector3) { 0, 1, 0 },
|
||||||
.fovy = 60,
|
.fovy = 60,
|
||||||
|
.projection = CAMERA_PERSPECTIVE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DisableCursor();
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
|
@ -83,9 +61,9 @@ int main(void)
|
||||||
float th = GetTime();
|
float th = GetTime();
|
||||||
|
|
||||||
Vector3 spherePos = {
|
Vector3 spherePos = {
|
||||||
.x = 5.0f * cosf(th),
|
.x = 5.0f*cosf(th),
|
||||||
.y = 0.0f,
|
.y = 0.0f,
|
||||||
.z = 5.0f * sinf(th)
|
.z = 5.0f*sinf(th)
|
||||||
};
|
};
|
||||||
|
|
||||||
SetSoundPosition(camera, sound, spherePos, 20.0f);
|
SetSoundPosition(camera, sound, spherePos, 20.0f);
|
||||||
|
@ -95,14 +73,14 @@ int main(void)
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
{
|
|
||||||
ClearBackground(BLACK);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
DrawGrid(10, 2);
|
DrawGrid(10, 2);
|
||||||
DrawSphere(spherePos, 0.5f, RED);
|
DrawSphere(spherePos, 0.5f, RED);
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
}
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
@ -110,6 +88,36 @@ int main(void)
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadSound(sound);
|
UnloadSound(sound);
|
||||||
CloseAudioDevice();
|
CloseAudioDevice(); // Close audio device
|
||||||
CloseWindow();
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sound positioning function
|
||||||
|
static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, float maxDist)
|
||||||
|
{
|
||||||
|
// Calculate direction vector and distance between listener and sound source
|
||||||
|
Vector3 direction = Vector3Subtract(position, listener.position);
|
||||||
|
float distance = Vector3Length(direction);
|
||||||
|
|
||||||
|
// Apply logarithmic distance attenuation and clamp between 0-1
|
||||||
|
float attenuation = 1.0f/(1.0f + (distance/maxDist));
|
||||||
|
attenuation = Clamp(attenuation, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
// Calculate normalized vectors for spatial positioning
|
||||||
|
Vector3 normalizedDirection = Vector3Normalize(direction);
|
||||||
|
Vector3 forward = Vector3Normalize(Vector3Subtract(listener.target, listener.position));
|
||||||
|
Vector3 right = Vector3Normalize(Vector3CrossProduct(forward, listener.up));
|
||||||
|
|
||||||
|
// Reduce volume for sounds behind the listener
|
||||||
|
float dotProduct = Vector3DotProduct(forward, normalizedDirection);
|
||||||
|
if (dotProduct < 0.0f) attenuation *= (1.0f + dotProduct*0.5f);
|
||||||
|
|
||||||
|
// Set stereo panning based on sound position relative to listener
|
||||||
|
float pan = 0.5f + 0.5f*Vector3DotProduct(normalizedDirection, right);
|
||||||
|
|
||||||
|
// Apply final sound properties
|
||||||
|
SetSoundVolume(sound, attenuation);
|
||||||
|
SetSoundPan(sound, pan);
|
||||||
}
|
}
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 26 KiB |
|
@ -10,12 +10,6 @@ uniform bool flipY;
|
||||||
float nearPlane = 0.1;
|
float nearPlane = 0.1;
|
||||||
float farPlane = 100.0;
|
float farPlane = 100.0;
|
||||||
|
|
||||||
// Function to linearize depth from non-linear depth buffer
|
|
||||||
float linearizeDepth(float depth)
|
|
||||||
{
|
|
||||||
return (2.0 * nearPlane) / (farPlane + nearPlane - depth * (farPlane - nearPlane));
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// Handle potential Y-flipping
|
// Handle potential Y-flipping
|
||||||
|
@ -27,7 +21,7 @@ void main()
|
||||||
float depth = texture2D(depthTexture, texCoord).r;
|
float depth = texture2D(depthTexture, texCoord).r;
|
||||||
|
|
||||||
// Linearize depth
|
// Linearize depth
|
||||||
float linearDepth = linearizeDepth(depth);
|
float linearDepth = (2.0*nearPlane)/(farPlane + nearPlane - depth*(farPlane - nearPlane));
|
||||||
|
|
||||||
// Output final color
|
// Output final color
|
||||||
gl_FragColor = vec4(vec3(linearDepth), 1.0);
|
gl_FragColor = vec4(vec3(linearDepth), 1.0);
|
||||||
|
|
|
@ -13,24 +13,17 @@ const float farPlane = 100.0;
|
||||||
// Output fragment color
|
// Output fragment color
|
||||||
out vec4 finalColor;
|
out vec4 finalColor;
|
||||||
|
|
||||||
// Linearizes the depth buffer value
|
|
||||||
float linearizeDepth(float depth)
|
|
||||||
{
|
|
||||||
return (2.0 * nearPlane) / (farPlane + nearPlane - depth * (farPlane - nearPlane));
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// Handle potential Y-flipping
|
// Handle potential Y-flipping
|
||||||
vec2 texCoord = fragTexCoord;
|
vec2 texCoord = fragTexCoord;
|
||||||
if (flipY)
|
if (flipY) texCoord.y = 1.0 - texCoord.y;
|
||||||
texCoord.y = 1.0 - texCoord.y;
|
|
||||||
|
|
||||||
// Sample depth
|
// Sample depth
|
||||||
float depth = texture(depthTexture, texCoord).r;
|
float depth = texture(depthTexture, texCoord).r;
|
||||||
|
|
||||||
// Linearize depth value
|
// Linearize depth value
|
||||||
float linearDepth = linearizeDepth(depth);
|
float linearDepth = (2.0*nearPlane)/(farPlane + nearPlane - depth*(farPlane - nearPlane));
|
||||||
|
|
||||||
// Output final color
|
// Output final color
|
||||||
finalColor = vec4(vec3(linearDepth), 1.0);
|
finalColor = vec4(vec3(linearDepth), 1.0);
|
||||||
|
|
|
@ -34,11 +34,11 @@ int main(void)
|
||||||
// Initialization
|
// Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 600;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [shader] example - render depth texture");
|
InitWindow(screenWidth, screenHeight, "raylib [shader] example - render depth texture");
|
||||||
|
|
||||||
// Load camera
|
// Init camera
|
||||||
Camera camera = { 0 };
|
Camera camera = { 0 };
|
||||||
camera.position = (Vector3){ 4.0f, 1.0f, 5.0f };
|
camera.position = (Vector3){ 4.0f, 1.0f, 5.0f };
|
||||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||||
|
@ -75,25 +75,19 @@ int main(void)
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginTextureMode(target);
|
BeginTextureMode(target);
|
||||||
|
|
||||||
ClearBackground(WHITE);
|
ClearBackground(WHITE);
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(cube, (Vector3){ 0.0f, 0.0f, 0.0f }, 3.0f, YELLOW);
|
DrawModel(cube, (Vector3){ 0.0f, 0.0f, 0.0f }, 3.0f, YELLOW);
|
||||||
DrawModel(floor, (Vector3){ 10.0f, 0.0f, 2.0f }, 2.0f, RED);
|
DrawModel(floor, (Vector3){ 10.0f, 0.0f, 2.0f }, 2.0f, RED);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
BeginShaderMode(depthShader);
|
BeginShaderMode(depthShader);
|
||||||
|
|
||||||
SetShaderValueTexture(depthShader, depthLoc, target.depth);
|
SetShaderValueTexture(depthShader, depthLoc, target.depth);
|
||||||
DrawTexture(target.depth, 0, 0, WHITE);
|
DrawTexture(target.depth, 0, 0, WHITE);
|
||||||
|
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
|
||||||
DrawRectangle( 10, 10, 320, 93, Fade(SKYBLUE, 0.5f));
|
DrawRectangle( 10, 10, 320, 93, Fade(SKYBLUE, 0.5f));
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 30 KiB |
|
@ -74,7 +74,6 @@ int main(void)
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw into our custom render texture (framebuffer)
|
// Draw into our custom render texture (framebuffer)
|
||||||
BeginTextureMode(target);
|
BeginTextureMode(target);
|
||||||
ClearBackground(WHITE);
|
ClearBackground(WHITE);
|
||||||
|
@ -93,7 +92,6 @@ int main(void)
|
||||||
// Draw into screen our custom render texture
|
// Draw into screen our custom render texture
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawTextureRec(target.texture, (Rectangle) { 0, 0, (float)screenWidth, (float)-screenHeight }, (Vector2) { 0, 0 }, WHITE);
|
DrawTextureRec(target.texture, (Rectangle) { 0, 0, (float)screenWidth, (float)-screenHeight }, (Vector2) { 0, 0 }, WHITE);
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{70B35F59-AFC2-4D8F-8833-5314D2047A81}</ProjectGuid>
|
<ProjectGuid>{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>shaders_view_depth</RootNamespace>
|
<RootNamespace>shaders_view_depth</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
|
|
@ -271,7 +271,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models_loading_m3d", "examp
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders_write_depth", "examples\shaders_write_depth.vcxproj", "{70B35F59-AFC2-4D8F-8833-5314D2047A81}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders_write_depth", "examples\shaders_write_depth.vcxproj", "{70B35F59-AFC2-4D8F-8833-5314D2047A81}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders_view_depth", "examples\shaders_view_depth.vcxproj", "{70B35F59-AFC2-4D8F-8833-5314D2047A81}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders_view_depth", "examples\shaders_view_depth.vcxproj", "{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders_hybrid_render", "examples\shaders_hybrid_render.vcxproj", "{3755E9F4-CB48-4EC3-B561-3B85964EBDEF}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders_hybrid_render", "examples\shaders_hybrid_render.vcxproj", "{3755E9F4-CB48-4EC3-B561-3B85964EBDEF}"
|
||||||
EndProject
|
EndProject
|
||||||
|
@ -761,6 +761,30 @@ Global
|
||||||
{0199E349-0701-40BC-8A7F-06A54FFA3E7C}.Release|x64.Build.0 = Release|x64
|
{0199E349-0701-40BC-8A7F-06A54FFA3E7C}.Release|x64.Build.0 = Release|x64
|
||||||
{0199E349-0701-40BC-8A7F-06A54FFA3E7C}.Release|x86.ActiveCfg = Release|Win32
|
{0199E349-0701-40BC-8A7F-06A54FFA3E7C}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{0199E349-0701-40BC-8A7F-06A54FFA3E7C}.Release|x86.Build.0 = Release|Win32
|
{0199E349-0701-40BC-8A7F-06A54FFA3E7C}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Debug.DLL|x64.Build.0 = Debug.DLL|x64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Release.DLL|x64.ActiveCfg = Release.DLL|x64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Release.DLL|x64.Build.0 = Release.DLL|x64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Release.DLL|x86.Build.0 = Release.DLL|Win32
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Release|ARM64.Build.0 = Release|ARM64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Release|x64.Build.0 = Release|x64
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{BCB71111-8505-4B35-8CEF-EC6115DC9D4D}.Release|x86.Build.0 = Release|Win32
|
||||||
{8F19E3DA-8929-4000-87B5-3CA6929636CC}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64
|
{8F19E3DA-8929-4000-87B5-3CA6929636CC}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64
|
||||||
{8F19E3DA-8929-4000-87B5-3CA6929636CC}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64
|
{8F19E3DA-8929-4000-87B5-3CA6929636CC}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64
|
||||||
{8F19E3DA-8929-4000-87B5-3CA6929636CC}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64
|
{8F19E3DA-8929-4000-87B5-3CA6929636CC}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64
|
||||||
|
@ -3293,6 +3317,30 @@ Global
|
||||||
{70B35F59-AFC2-4D8F-8833-5314D2047A81}.Release|x64.Build.0 = Release|x64
|
{70B35F59-AFC2-4D8F-8833-5314D2047A81}.Release|x64.Build.0 = Release|x64
|
||||||
{70B35F59-AFC2-4D8F-8833-5314D2047A81}.Release|x86.ActiveCfg = Release|Win32
|
{70B35F59-AFC2-4D8F-8833-5314D2047A81}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{70B35F59-AFC2-4D8F-8833-5314D2047A81}.Release|x86.Build.0 = Release|Win32
|
{70B35F59-AFC2-4D8F-8833-5314D2047A81}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Debug.DLL|x64.Build.0 = Debug.DLL|x64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Release.DLL|x64.ActiveCfg = Release.DLL|x64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Release.DLL|x64.Build.0 = Release.DLL|x64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Release.DLL|x86.Build.0 = Release.DLL|Win32
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Release|ARM64.Build.0 = Release|ARM64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Release|x64.Build.0 = Release|x64
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7}.Release|x86.Build.0 = Release|Win32
|
||||||
{3755E9F4-CB48-4EC3-B561-3B85964EBDEF}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64
|
{3755E9F4-CB48-4EC3-B561-3B85964EBDEF}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64
|
||||||
{3755E9F4-CB48-4EC3-B561-3B85964EBDEF}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64
|
{3755E9F4-CB48-4EC3-B561-3B85964EBDEF}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64
|
||||||
{3755E9F4-CB48-4EC3-B561-3B85964EBDEF}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64
|
{3755E9F4-CB48-4EC3-B561-3B85964EBDEF}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64
|
||||||
|
|
|
@ -1363,10 +1363,7 @@ void PollInputEvents(void)
|
||||||
for (int i = 0; i < MAX_TOUCH_POINTS; i++) CORE.Input.Touch.previousTouchState[i] = CORE.Input.Touch.currentTouchState[i];
|
for (int i = 0; i < MAX_TOUCH_POINTS; i++) CORE.Input.Touch.previousTouchState[i] = CORE.Input.Touch.currentTouchState[i];
|
||||||
|
|
||||||
// Map touch position to mouse position for convenience
|
// Map touch position to mouse position for convenience
|
||||||
if (CORE.Input.Touch.pointCount == 0)
|
if (CORE.Input.Touch.pointCount == 0) CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
|
||||||
{
|
|
||||||
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
int touchAction = -1; // 0-TOUCH_ACTION_UP, 1-TOUCH_ACTION_DOWN, 2-TOUCH_ACTION_MOVE
|
int touchAction = -1; // 0-TOUCH_ACTION_UP, 1-TOUCH_ACTION_DOWN, 2-TOUCH_ACTION_MOVE
|
||||||
bool realTouch = false; // Flag to differentiate real touch gestures from mouse ones
|
bool realTouch = false; // Flag to differentiate real touch gestures from mouse ones
|
||||||
|
|
|
@ -1879,8 +1879,8 @@ void TakeScreenshot(const char *fileName)
|
||||||
// Security check to (partially) avoid malicious code
|
// Security check to (partially) avoid malicious code
|
||||||
if (strchr(fileName, '\'') != NULL) { TRACELOG(LOG_WARNING, "SYSTEM: Provided fileName could be potentially malicious, avoid [\'] character"); return; }
|
if (strchr(fileName, '\'') != NULL) { TRACELOG(LOG_WARNING, "SYSTEM: Provided fileName could be potentially malicious, avoid [\'] character"); return; }
|
||||||
|
|
||||||
// apply a scale if we are doing HIGHDPI auto-scaling
|
// Apply a scale if we are doing HIGHDPI auto-scaling
|
||||||
Vector2 scale = { 1,1 };
|
Vector2 scale = { 1.0f, 1.0f };
|
||||||
if (IsWindowState(FLAG_WINDOW_HIGHDPI)) scale = GetWindowScaleDPI();
|
if (IsWindowState(FLAG_WINDOW_HIGHDPI)) scale = GetWindowScaleDPI();
|
||||||
|
|
||||||
unsigned char *imgData = rlReadScreenPixels((int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y));
|
unsigned char *imgData = rlReadScreenPixels((int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue