Merge branch 'raysan5:master' into master
This commit is contained in:
commit
a7b7538efd
8 changed files with 71 additions and 127 deletions
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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)(font.recs[index].width + fontSpacing)/(float)font.baseSize*scale;
|
||||
else textOffsetX += (float)(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)(font.recs[index].width + fontSpacing)/(float)font.baseSize*scale;
|
||||
else textOffsetX += (float)(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)*fontSpacing/(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;
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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)")
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue