Kaynağa Gözat

Merge branch 'raysan5:master' into fix-clip

pull/4906/head
Le Juez Victor 1 hafta önce
işlemeyi yapan: GitHub
ebeveyn
işleme
c087144385
Veri tabanında bu imza için bilinen anahtar bulunamadı GPG Anahtar Kimliği: B5690EEEBB952194
10 değiştirilmiş dosya ile 74 ekleme ve 130 silme
  1. +1
    -1
      BINDINGS.md
  2. +3
    -10
      CMakeLists.txt
  3. +1
    -1
      CMakeOptions.txt
  4. +1
    -1
      build.zig
  5. +2
    -2
      examples/audio/audio_sound_positioning.c
  6. +53
    -111
      examples/text/text_draw_3d.c
  7. +0
    -1
      projects/CMake/CMakeLists.txt
  8. +1
    -1
      src/CMakeLists.txt
  9. +8
    -2
      src/platforms/rcore_desktop_glfw.c
  10. +4
    -0
      src/raudio.c

+ 1
- 1
BINDINGS.md Dosyayı Görüntüle

@ -13,7 +13,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
| [raylib-cs](https://github.com/raylib-cs/raylib-cs) | **5.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib |
| [Raylib-CsLo](https://github.com/NotNotTech/Raylib-CsLo) | 4.2 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
| [Raylib-CSharp-Vinculum](https://github.com/ZeroElectric/Raylib-CSharp-Vinculum) | **5.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
| [Raylib-CSharp](https://github.com/MrScautHD/Raylib-CSharp) | **5.1-dev** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MIT |
| [Raylib-CSharp](https://github.com/MrScautHD/Raylib-CSharp) | **5.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MIT |
| [cl-raylib](https://github.com/longlene/cl-raylib) | 4.0 | [Common Lisp](https://common-lisp.net) | MIT |
| [claylib/wrap](https://github.com/defun-games/claylib) | 4.5 | [Common Lisp](https://common-lisp.net) | Zlib |
| [claw-raylib](https://github.com/bohonghuang/claw-raylib) | **auto** | [Common Lisp](https://common-lisp.net) | Apache-2.0 |

+ 3
- 10
CMakeLists.txt Dosyayı Görüntüle

@ -23,14 +23,6 @@ cmake_policy(SET CMP0063 NEW)
# Anywhere you see include(...) you can check <root>/cmake for that file
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# RAYLIB_IS_MAIN determines whether the project is being used from root
# or if it is added as a dependency (through add_subdirectory for example).
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(RAYLIB_IS_MAIN TRUE)
else()
set(RAYLIB_IS_MAIN FALSE)
endif()
# Sets compiler flags and language standard
include(CompilerFlags)
@ -46,8 +38,9 @@ endif()
# Main sources directory (the second parameter sets the output directory name to raylib)
add_subdirectory(src raylib)
# Uninstall target
if(NOT TARGET uninstall)
# Uninstall target, only create when building raylib by itself
# Avoid conflicting target names when using raylib with other libraries
if(NOT TARGET uninstall AND PROJECT_IS_TOP_LEVEL)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Uninstall.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"

+ 1
- 1
CMakeOptions.txt Dosyayı Görüntüle

@ -11,7 +11,7 @@ enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM;SDL" "Platform to bui
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0" "Force a specific OpenGL Version?")
# Configuration options
option(BUILD_EXAMPLES "Build the examples." ${RAYLIB_IS_MAIN})
option(BUILD_EXAMPLES "Build the examples." ${PROJECT_IS_TOP_LEVEL})
option(CUSTOMIZE_BUILD "Show options for customizing your Raylib library build." OFF)
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)

+ 1
- 1
build.zig Dosyayı Görüntüle

@ -504,7 +504,7 @@ fn addExamples(
raylib: *std.Build.Step.Compile,
) !*std.Build.Step {
if (target.result.os.tag == .emscripten) {
@panic("Emscripten building via Zig unsupported");
return &b.addFail("Emscripten building via Zig unsupported").step;
}
const all = b.step(module, "All " ++ module ++ " examples");

+ 2
- 2
examples/audio/audio_sound_positioning.c Dosyayı Görüntüle

@ -108,7 +108,7 @@ static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, flo
// 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));
Vector3 right = Vector3Normalize(Vector3CrossProduct(listener.up, forward));
// Reduce volume for sounds behind the listener
float dotProduct = Vector3DotProduct(forward, normalizedDirection);
@ -120,4 +120,4 @@ static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, flo
// Apply final sound properties
SetSoundVolume(sound, attenuation);
SetSoundPan(sound, pan);
}
}

+ 53
- 111
examples/text/text_draw_3d.c Dosyayı Görüntüle

@ -65,8 +65,6 @@ typedef struct WaveTextConfig {
static void DrawTextCodepoint3D(Font font, int codepoint, Vector3 position, float fontSize, bool backface, Color tint);
// Draw a 2D text in 3D space
static void DrawText3D(Font font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, Color tint);
// Measure a text in 3D. For some reason `MeasureTextEx()` just doesn't seem to work so i had to use this instead.
static Vector3 MeasureText3D(Font font, const char *text, float fontSize, float fontSpacing, float lineSpacing);
// Draw a 2D text in 3D space and wave the parts that start with `~~` and end with `~~`.
// This is a modified version of the original code by @Nighten found here https://github.com/NightenDushi/Raylib_DrawTextStyle
@ -107,9 +105,9 @@ int main(void)
// Use the default font
Font font = GetFontDefault();
float fontSize = 8.0f;
float fontSpacing = 0.5f;
float lineSpacing = -1.0f;
float fontSize = 0.8f;
float fontSpacing = 0.05f;
float lineSpacing = -0.1f;
// Set the text (using markdown!)
char text[64] = "Hello ~~World~~ in 3D!";
@ -317,44 +315,44 @@ int main(void)
rlRotatef(180.0f, 0.0f, 1.0f, 0.0f);
char *opt = (char *)TextFormat("< SIZE: %2.1f >", fontSize);
quads += TextLength(opt);
Vector3 m = MeasureText3D(GetFontDefault(), opt, 8.0f, 1.0f, 0.0f);
Vector2 m = MeasureTextEx(GetFontDefault(), opt, 0.8f, 0.1f);
Vector3 pos = { -m.x/2.0f, 0.01f, 2.0f};
DrawText3D(GetFontDefault(), opt, pos, 8.0f, 1.0f, 0.0f, false, BLUE);
pos.z += 0.5f + m.z;
DrawText3D(GetFontDefault(), opt, pos, 0.8f, 0.1f, 0.0f, false, BLUE);
pos.z += 0.5f + m.y;
opt = (char *)TextFormat("< SPACING: %2.1f >", fontSpacing);
quads += TextLength(opt);
m = MeasureText3D(GetFontDefault(), opt, 8.0f, 1.0f, 0.0f);
m = MeasureTextEx(GetFontDefault(), opt, 0.8f, 0.1f);
pos.x = -m.x/2.0f;
DrawText3D(GetFontDefault(), opt, pos, 8.0f, 1.0f, 0.0f, false, BLUE);
pos.z += 0.5f + m.z;
DrawText3D(GetFontDefault(), opt, pos, 0.8f, 0.1f, 0.0f, false, BLUE);
pos.z += 0.5f + m.y;
opt = (char *)TextFormat("< LINE: %2.1f >", lineSpacing);
quads += TextLength(opt);
m = MeasureText3D(GetFontDefault(), opt, 8.0f, 1.0f, 0.0f);
m = MeasureTextEx(GetFontDefault(), opt, 0.8f, 0.1f);
pos.x = -m.x/2.0f;
DrawText3D(GetFontDefault(), opt, pos, 8.0f, 1.0f, 0.0f, false, BLUE);
pos.z += 1.0f + m.z;
DrawText3D(GetFontDefault(), opt, pos, 0.8f, 0.1f, 0.0f, false, BLUE);
pos.z += 0.5f + m.y;
opt = (char *)TextFormat("< LBOX: %3s >", slb? "ON" : "OFF");
quads += TextLength(opt);
m = MeasureText3D(GetFontDefault(), opt, 8.0f, 1.0f, 0.0f);
m = MeasureTextEx(GetFontDefault(), opt, 0.8f, 0.1f);
pos.x = -m.x/2.0f;
DrawText3D(GetFontDefault(), opt, pos, 8.0f, 1.0f, 0.0f, false, RED);
pos.z += 0.5f + m.z;
DrawText3D(GetFontDefault(), opt, pos, 0.8f, 0.1f, 0.0f, false, RED);
pos.z += 0.5f + m.y;
opt = (char *)TextFormat("< TBOX: %3s >", SHOW_TEXT_BOUNDRY? "ON" : "OFF");
quads += TextLength(opt);
m = MeasureText3D(GetFontDefault(), opt, 8.0f, 1.0f, 0.0f);
m = MeasureTextEx(GetFontDefault(), opt, 0.8f, 0.1f);
pos.x = -m.x/2.0f;
DrawText3D(GetFontDefault(), opt, pos, 8.0f, 1.0f, 0.0f, false, RED);
pos.z += 0.5f + m.z;
DrawText3D(GetFontDefault(), opt, pos, 0.8f, 0.1f, 0.0f, false, RED);
pos.z += 0.5f + m.y;
opt = (char *)TextFormat("< LAYER DISTANCE: %.3f >", layerDistance);
quads += TextLength(opt);
m = MeasureText3D(GetFontDefault(), opt, 8.0f, 1.0f, 0.0f);
m = MeasureTextEx(GetFontDefault(), opt, 0.8f, 0.1f);
pos.x = -m.x/2.0f;
DrawText3D(GetFontDefault(), opt, pos, 8.0f, 1.0f, 0.0f, false, DARKPURPLE);
DrawText3D(GetFontDefault(), opt, pos, 0.8f, 0.1f, 0.0f, false, DARKPURPLE);
rlPopMatrix();
//-------------------------------------------------------------------------
@ -362,44 +360,44 @@ int main(void)
//-------------------------------------------------------------------------
opt = "All the text displayed here is in 3D";
quads += 36;
m = MeasureText3D(GetFontDefault(), opt, 10.0f, 0.5f, 0.0f);
m = MeasureTextEx(GetFontDefault(), opt, 1.0f, 0.05f);
pos = (Vector3){-m.x/2.0f, 0.01f, 2.0f};
DrawText3D(GetFontDefault(), opt, pos, 10.0f, 0.5f, 0.0f, false, DARKBLUE);
pos.z += 1.5f + m.z;
DrawText3D(GetFontDefault(), opt, pos, 1.0f, 0.05f, 0.0f, false, DARKBLUE);
pos.z += 1.5f + m.y;
opt = "press [Left]/[Right] to change the font size";
quads += 44;
m = MeasureText3D(GetFontDefault(), opt, 6.0f, 0.5f, 0.0f);
m = MeasureTextEx(GetFontDefault(), opt, 0.6f, 0.05f);
pos.x = -m.x/2.0f;
DrawText3D(GetFontDefault(), opt, pos, 6.0f, 0.5f, 0.0f, false, DARKBLUE);
pos.z += 0.5f + m.z;
DrawText3D(GetFontDefault(), opt, pos, 0.6f, 0.05f, 0.0f, false, DARKBLUE);
pos.z += 0.5f + m.y;
opt = "press [Up]/[Down] to change the font spacing";
quads += 44;
m = MeasureText3D(GetFontDefault(), opt, 6.0f, 0.5f, 0.0f);
m = MeasureTextEx(GetFontDefault(), opt, 0.6f, 0.05f);
pos.x = -m.x/2.0f;
DrawText3D(GetFontDefault(), opt, pos, 6.0f, 0.5f, 0.0f, false, DARKBLUE);
pos.z += 0.5f + m.z;
DrawText3D(GetFontDefault(), opt, pos, 0.6f, 0.05f, 0.0f, false, DARKBLUE);
pos.z += 0.5f + m.y;
opt = "press [PgUp]/[PgDown] to change the line spacing";
quads += 48;
m = MeasureText3D(GetFontDefault(), opt, 6.0f, 0.5f, 0.0f);
m = MeasureTextEx(GetFontDefault(), opt, 0.6f, 0.05f);
pos.x = -m.x/2.0f;
DrawText3D(GetFontDefault(), opt, pos, 6.0f, 0.5f, 0.0f, false, DARKBLUE);
pos.z += 0.5f + m.z;
DrawText3D(GetFontDefault(), opt, pos, 0.6f, 0.05f, 0.0f, false, DARKBLUE);
pos.z += 0.5f + m.y;
opt = "press [F1] to toggle the letter boundry";
quads += 39;
m = MeasureText3D(GetFontDefault(), opt, 6.0f, 0.5f, 0.0f);
m = MeasureTextEx(GetFontDefault(), opt, 0.6f, 0.05f);
pos.x = -m.x/2.0f;
DrawText3D(GetFontDefault(), opt, pos, 6.0f, 0.5f, 0.0f, false, DARKBLUE);
pos.z += 0.5f + m.z;
DrawText3D(GetFontDefault(), opt, pos, 0.6f, 0.05f, 0.0f, false, DARKBLUE);
pos.z += 0.5f + m.y;
opt = "press [F2] to toggle the text boundry";
quads += 37;
m = MeasureText3D(GetFontDefault(), opt, 6.0f, 0.5f, 0.0f);
m = MeasureTextEx(GetFontDefault(), opt, 0.6f, 0.05f);
pos.x = -m.x/2.0f;
DrawText3D(GetFontDefault(), opt, pos, 6.0f, 0.5f, 0.0f, false, DARKBLUE);
DrawText3D(GetFontDefault(), opt, pos, 0.6f, 0.05f, 0.0f, false, DARKBLUE);
//-------------------------------------------------------------------------
SHOW_LETTER_BOUNDRY = slb;
@ -462,16 +460,16 @@ static void DrawTextCodepoint3D(Font font, int codepoint, Vector3 position, floa
// Character destination rectangle on screen
// NOTE: We consider charsPadding on drawing
position.x += (float)(font.glyphs[index].offsetX - font.glyphPadding)/(float)font.baseSize*scale;
position.z += (float)(font.glyphs[index].offsetY - font.glyphPadding)/(float)font.baseSize*scale;
position.x += (float)(font.glyphs[index].offsetX - font.glyphPadding)*scale;
position.z += (float)(font.glyphs[index].offsetY - font.glyphPadding)*scale;
// Character source rectangle from font texture atlas
// NOTE: We consider chars padding when drawing, it could be required for outline/glow shader effects
Rectangle srcRec = { font.recs[index].x - (float)font.glyphPadding, font.recs[index].y - (float)font.glyphPadding,
font.recs[index].width + 2.0f*font.glyphPadding, font.recs[index].height + 2.0f*font.glyphPadding };
float width = (float)(font.recs[index].width + 2.0f*font.glyphPadding)/(float)font.baseSize*scale;
float height = (float)(font.recs[index].height + 2.0f*font.glyphPadding)/(float)font.baseSize*scale;
float width = (float)(font.recs[index].width + 2.0f*font.glyphPadding)*scale;
float height = (float)(font.recs[index].height + 2.0f*font.glyphPadding)*scale;
if (font.texture.id > 0)
{
@ -544,7 +542,7 @@ static void DrawText3D(Font font, const char *text, Vector3 position, float font
{
// NOTE: Fixed line spacing of 1.5 line-height
// TODO: Support custom line spacing defined by user
textOffsetY += scale + lineSpacing/(float)font.baseSize*scale;
textOffsetY += fontSize + lineSpacing;
textOffsetX = 0.0f;
}
else
@ -554,69 +552,14 @@ static void DrawText3D(Font font, const char *text, Vector3 position, float font
DrawTextCodepoint3D(font, codepoint, (Vector3){ position.x + textOffsetX, position.y, position.z + textOffsetY }, fontSize, backface, tint);
}
if (font.glyphs[index].advanceX == 0) textOffsetX += (float)p">(font.recs[index].width + fontSpacing)/(float)font.baseSize*scale;
else textOffsetX += (float)p">(font.glyphs[index].advanceX + fontSpacing)/(float)font.baseSize*scale;
if (font.glyphs[index].advanceX == 0) textOffsetX += (float)font.recs[index].width*scale + fontSpacing;
else textOffsetX += (float)font.glyphs[index].advanceX*scale + fontSpacing;
}
i += codepointByteCount; // Move text bytes counter to next codepoint
}
}
// Measure a text in 3D. For some reason `MeasureTextEx()` just doesn't seem to work so i had to use this instead.
static Vector3 MeasureText3D(Font font, const char* text, float fontSize, float fontSpacing, float lineSpacing)
{
int len = TextLength(text);
int tempLen = 0; // Used to count longer text line num chars
int lenCounter = 0;
float tempTextWidth = 0.0f; // Used to count longer text line width
float scale = fontSize/(float)font.baseSize;
float textHeight = scale;
float textWidth = 0.0f;
int letter = 0; // Current character
int index = 0; // Index position in sprite font
for (int i = 0; i < len; i++)
{
lenCounter++;
int next = 0;
letter = GetCodepoint(&text[i], &next);
index = GetGlyphIndex(font, letter);
// NOTE: normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
// but we need to draw all of the bad bytes using the '?' symbol so to not skip any we set next = 1
if (letter == 0x3f) next = 1;
i += next - 1;
if (letter != '\n')
{
if (font.glyphs[index].advanceX != 0) textWidth += (font.glyphs[index].advanceX+fontSpacing)/(float)font.baseSize*scale;
else textWidth += (font.recs[index].width + font.glyphs[index].offsetX)/(float)font.baseSize*scale;
}
else
{
if (tempTextWidth < textWidth) tempTextWidth = textWidth;
lenCounter = 0;
textWidth = 0.0f;
textHeight += scale + lineSpacing/(float)font.baseSize*scale;
}
if (tempLen < lenCounter) tempLen = lenCounter;
}
if (tempTextWidth < textWidth) tempTextWidth = textWidth;
Vector3 vec = { 0 };
vec.x = tempTextWidth + (float)((tempLen - 1)*fontSpacing/(float)font.baseSize*scale); // Adds chars spacing to measure
vec.y = 0.25f;
vec.z = textHeight;
return vec;
}
// Draw a 2D text in 3D space and wave the parts that start with `~~` and end with `~~`.
// This is a modified version of the original code by @Nighten found here https://github.com/NightenDushi/Raylib_DrawTextStyle
static void DrawTextWave3D(Font font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, WaveTextConfig* config, float time, Color tint)
@ -645,7 +588,7 @@ static void DrawTextWave3D(Font font, const char *text, Vector3 position, float
{
// NOTE: Fixed line spacing of 1.5 line-height
// TODO: Support custom line spacing defined by user
textOffsetY += scale + lineSpacing/(float)font.baseSize*scale;
textOffsetY += fontSize + lineSpacing;
textOffsetX = 0.0f;
k = 0;
}
@ -672,8 +615,8 @@ static void DrawTextWave3D(Font font, const char *text, Vector3 position, float
DrawTextCodepoint3D(font, codepoint, (Vector3){ pos.x + textOffsetX, pos.y, pos.z + textOffsetY }, fontSize, backface, tint);
}
if (font.glyphs[index].advanceX == 0) textOffsetX += (float)p">(font.recs[index].width + fontSpacing)/(float)font.baseSize*scale;
else textOffsetX += (float)p">(font.glyphs[index].advanceX + fontSpacing)/(float)font.baseSize*scale;
if (font.glyphs[index].advanceX == 0) textOffsetX += (float)font.recs[index].width*scale + fontSpacing;
else textOffsetX += (float)font.glyphs[index].advanceX*scale + fontSpacing;
}
i += codepointByteCount; // Move text bytes counter to next codepoint
@ -698,8 +641,6 @@ static Vector3 MeasureTextWave3D(Font font, const char* text, float fontSize, fl
for (int i = 0; i < len; i++)
{
lenCounter++;
int next = 0;
letter = GetCodepoint(&text[i], &next);
index = GetGlyphIndex(font, letter);
@ -717,8 +658,9 @@ static Vector3 MeasureTextWave3D(Font font, const char* text, float fontSize, fl
}
else
{
if (font.glyphs[index].advanceX != 0) textWidth += (font.glyphs[index].advanceX+fontSpacing)/(float)font.baseSize*scale;
else textWidth += (font.recs[index].width + font.glyphs[index].offsetX)/(float)font.baseSize*scale;
lenCounter++;
if (font.glyphs[index].advanceX != 0) textWidth += font.glyphs[index].advanceX*scale;
else textWidth += (font.recs[index].width + font.glyphs[index].offsetX)*scale;
}
}
else
@ -726,7 +668,7 @@ static Vector3 MeasureTextWave3D(Font font, const char* text, float fontSize, fl
if (tempTextWidth < textWidth) tempTextWidth = textWidth;
lenCounter = 0;
textWidth = 0.0f;
textHeight += scale + lineSpacing/(float)font.baseSize*scale;
textHeight += fontSize + lineSpacing;
}
if (tempLen < lenCounter) tempLen = lenCounter;
@ -735,7 +677,7 @@ static Vector3 MeasureTextWave3D(Font font, const char* text, float fontSize, fl
if (tempTextWidth < textWidth) tempTextWidth = textWidth;
Vector3 vec = { 0 };
vec.x = tempTextWidth + (float)((tempLen - 1)*fontSpacingo">/(float)font.baseSize*scale); // Adds chars spacing to measure
vec.x = tempTextWidth + (float)((tempLen - 1)*fontSpacing); // Adds chars spacing to measure
vec.y = 0.25f;
vec.z = textHeight;
@ -749,4 +691,4 @@ static Color GenerateRandomColor(float s, float v)
float h = (float)GetRandomValue(0, 360);
h = fmodf((h + h*Phi), 360.0f);
return ColorFromHSV(h, s, v);
}
}

+ 0
- 1
projects/CMake/CMakeLists.txt Dosyayı Görüntüle

@ -18,7 +18,6 @@ if (NOT raylib_FOUND) # If there's none, fetch and build raylib
if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
set(FETCHCONTENT_QUIET NO)
FetchContent_MakeAvailable(raylib)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
endif()
endif()

+ 1
- 1
src/CMakeLists.txt Dosyayı Görüntüle

@ -8,7 +8,7 @@ include(JoinPaths)
# Sets build type if not set by now
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
if(RAYLIB_IS_MAIN)
if(PROJECT_IS_TOP_LEVEL)
set(default_build_type Debug)
else()
message(WARNING "Default build type is not set (CMAKE_BUILD_TYPE)")

+ 8
- 2
src/platforms/rcore_desktop_glfw.c Dosyayı Görüntüle

@ -1381,6 +1381,12 @@ int InitPlatform(void)
if ((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); // Transparent framebuffer
else glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_FALSE); // Opaque framebuffer
// HACK: Most of this was written before GLFW_SCALE_FRAMEBUFFER existed and
// was enabled by default. Disabling it gets back the old behavior. A
// complete fix will require removing a lot of CORE.Window.render
// manipulation code.
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
{
// Resize window content area based on the monitor content scale.
@ -1388,7 +1394,7 @@ int InitPlatform(void)
// On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); // Scale content area based on the monitor content scale where window is placed on
#if defined(__APPLE__)
glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_TRUE);
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
#endif
}
else glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE);
@ -1602,7 +1608,7 @@ int InitPlatform(void)
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
{
// NOTE: On APPLE platforms system should manage window/input scaling and also framebuffer scaling.
// Framebuffer scaling should be activated with: glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_TRUE);
// Framebuffer scaling should be activated with: glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
#if !defined(__APPLE__)
glfwGetFramebufferSize(platform.handle, &fbWidth, &fbHeight);

+ 4
- 0
src/raudio.c Dosyayı Görüntüle

@ -604,6 +604,7 @@ AudioBuffer *LoadAudioBuffer(ma_format format, ma_uint32 channels, ma_uint32 sam
audioBuffer->usage = usage;
audioBuffer->frameCursorPos = 0;
audioBuffer->framesProcessed = 0;
audioBuffer->sizeInFrames = sizeInFrames;
// Buffers should be marked as processed by default so that a call to
@ -650,6 +651,9 @@ void PlayAudioBuffer(AudioBuffer *buffer)
buffer->playing = true;
buffer->paused = false;
buffer->frameCursorPos = 0;
buffer->framesProcessed = 0;
buffer->isSubBufferProcessed[0] = true;
buffer->isSubBufferProcessed[1] = true;
ma_mutex_unlock(&AUDIO.System.lock);
}
}

Yükleniyor…
İptal
Kaydet