Merge branch 'pure' of https://github.com/ColleagueRiley/raylib into pure
This commit is contained in:
commit
f6375d2bd8
|
|
@ -989,6 +989,7 @@ models/models_rlgl_solar_system: models/models_rlgl_solar_system.c
|
|||
models/models_skybox: models/models_skybox.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -sTOTAL_MEMORY=67108864 -sFORCE_FILESYSTEM=1 \
|
||||
--preload-file models/resources/dresden_square_2k.hdr@resources/dresden_square_2k.hdr \
|
||||
--preload-file models/resources/skybox.png@resources/skybox.png \
|
||||
--preload-file models/resources/shaders/glsl100/skybox.vs@resources/shaders/glsl100/skybox.vs \
|
||||
--preload-file models/resources/shaders/glsl100/skybox.fs@resources/shaders/glsl100/skybox.fs \
|
||||
--preload-file models/resources/shaders/glsl100/cubemap.vs@resources/shaders/glsl100/cubemap.vs \
|
||||
|
|
|
|||
|
|
@ -12119,7 +12119,7 @@
|
|||
},
|
||||
{
|
||||
"name": "AttachAudioStreamProcessor",
|
||||
"description": "Attach audio stream processor to stream, receives the samples as 'float'",
|
||||
"description": "Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo)",
|
||||
"returnType": "void",
|
||||
"params": [
|
||||
{
|
||||
|
|
@ -12149,7 +12149,7 @@
|
|||
},
|
||||
{
|
||||
"name": "AttachAudioMixedProcessor",
|
||||
"description": "Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'",
|
||||
"description": "Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo)",
|
||||
"returnType": "void",
|
||||
"params": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8276,7 +8276,7 @@ return {
|
|||
},
|
||||
{
|
||||
name = "AttachAudioStreamProcessor",
|
||||
description = "Attach audio stream processor to stream, receives the samples as 'float'",
|
||||
description = "Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo)",
|
||||
returnType = "void",
|
||||
params = {
|
||||
{type = "AudioStream", name = "stream"},
|
||||
|
|
@ -8294,7 +8294,7 @@ return {
|
|||
},
|
||||
{
|
||||
name = "AttachAudioMixedProcessor",
|
||||
description = "Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'",
|
||||
description = "Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo)",
|
||||
returnType = "void",
|
||||
params = {
|
||||
{type = "AudioCallback", name = "processor"}
|
||||
|
|
|
|||
|
|
@ -4659,7 +4659,7 @@ Function 578: SetAudioStreamCallback() (2 input parameters)
|
|||
Function 579: AttachAudioStreamProcessor() (2 input parameters)
|
||||
Name: AttachAudioStreamProcessor
|
||||
Return type: void
|
||||
Description: Attach audio stream processor to stream, receives the samples as 'float'
|
||||
Description: Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo)
|
||||
Param[1]: stream (type: AudioStream)
|
||||
Param[2]: processor (type: AudioCallback)
|
||||
Function 580: DetachAudioStreamProcessor() (2 input parameters)
|
||||
|
|
@ -4671,7 +4671,7 @@ Function 580: DetachAudioStreamProcessor() (2 input parameters)
|
|||
Function 581: AttachAudioMixedProcessor() (1 input parameters)
|
||||
Name: AttachAudioMixedProcessor
|
||||
Return type: void
|
||||
Description: Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'
|
||||
Description: Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo)
|
||||
Param[1]: processor (type: AudioCallback)
|
||||
Function 582: DetachAudioMixedProcessor() (1 input parameters)
|
||||
Name: DetachAudioMixedProcessor
|
||||
|
|
|
|||
|
|
@ -3104,7 +3104,7 @@
|
|||
<Param type="AudioStream" name="stream" desc="" />
|
||||
<Param type="AudioCallback" name="callback" desc="" />
|
||||
</Function>
|
||||
<Function name="AttachAudioStreamProcessor" retType="void" paramCount="2" desc="Attach audio stream processor to stream, receives the samples as 'float'">
|
||||
<Function name="AttachAudioStreamProcessor" retType="void" paramCount="2" desc="Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo)">
|
||||
<Param type="AudioStream" name="stream" desc="" />
|
||||
<Param type="AudioCallback" name="processor" desc="" />
|
||||
</Function>
|
||||
|
|
@ -3112,7 +3112,7 @@
|
|||
<Param type="AudioStream" name="stream" desc="" />
|
||||
<Param type="AudioCallback" name="processor" desc="" />
|
||||
</Function>
|
||||
<Function name="AttachAudioMixedProcessor" retType="void" paramCount="1" desc="Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'">
|
||||
<Function name="AttachAudioMixedProcessor" retType="void" paramCount="1" desc="Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo)">
|
||||
<Param type="AudioCallback" name="processor" desc="" />
|
||||
</Function>
|
||||
<Function name="DetachAudioMixedProcessor" retType="void" paramCount="1" desc="Detach audio stream processor from the entire audio pipeline">
|
||||
|
|
|
|||
|
|
@ -3634,7 +3634,7 @@
|
|||
</KeyWord>
|
||||
|
||||
<KeyWord name="AttachAudioStreamProcessor" func="yes">
|
||||
<Overload retVal="void" descr="Attach audio stream processor to stream, receives the samples as 'float'">
|
||||
<Overload retVal="void" descr="Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo)">
|
||||
<Param name="AudioStream stream" />
|
||||
<Param name="AudioCallback processor" />
|
||||
</Overload>
|
||||
|
|
@ -3647,7 +3647,7 @@
|
|||
</KeyWord>
|
||||
|
||||
<KeyWord name="AttachAudioMixedProcessor" func="yes">
|
||||
<Overload retVal="void" descr="Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'">
|
||||
<Overload retVal="void" descr="Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo)">
|
||||
<Param name="AudioCallback processor" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
|
|
|
|||
|
|
@ -734,9 +734,9 @@ RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan
|
|||
RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
|
||||
RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data
|
||||
|
||||
RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives the samples as 'float'
|
||||
RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo)
|
||||
RLAPI void DetachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Detach audio stream processor from stream
|
||||
|
||||
RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'
|
||||
RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo)
|
||||
RLAPI void DetachAudioMixedProcessor(AudioCallback processor); // Detach audio stream processor from the entire audio pipeline
|
||||
|
||||
|
|
|
|||
|
|
@ -460,17 +460,21 @@ int GetMonitorHeight(int monitor)
|
|||
}
|
||||
|
||||
// Get selected monitor physical width in millimetres
|
||||
// NOTE: It seems to return a slightly underestimated value on some devices
|
||||
int GetMonitorPhysicalWidth(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorPhysicalWidth() not implemented on target platform");
|
||||
return 0;
|
||||
int widthPixels = ANativeWindow_getWidth(platform.app->window);
|
||||
float dpi = AConfiguration_getDensity(platform.app->config);
|
||||
return (widthPixels/dpi)*25.4f;
|
||||
}
|
||||
|
||||
// Get selected monitor physical height in millimetres
|
||||
// NOTE: It seems to return a slightly underestimated value on some devices
|
||||
int GetMonitorPhysicalHeight(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorPhysicalHeight() not implemented on target platform");
|
||||
return 0;
|
||||
int heightPixels = ANativeWindow_getHeight(platform.app->window);
|
||||
float dpi = AConfiguration_getDensity(platform.app->config);
|
||||
return (heightPixels/dpi)*25.4f;
|
||||
}
|
||||
|
||||
// Get selected monitor refresh rate
|
||||
|
|
@ -497,8 +501,9 @@ Vector2 GetWindowPosition(void)
|
|||
// Get window scale DPI factor for current monitor
|
||||
Vector2 GetWindowScaleDPI(void)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetWindowScaleDPI() not implemented on target platform");
|
||||
return (Vector2){ 1.0f, 1.0f };
|
||||
int density = AConfiguration_getDensity(platform.app->config);
|
||||
float scale = (float)density/160;
|
||||
return (Vector2){ scale, scale };
|
||||
}
|
||||
|
||||
// Set clipboard text content
|
||||
|
|
@ -848,22 +853,20 @@ static int InitGraphicsDevice(void)
|
|||
TRACELOG(LOG_INFO, "DISPLAY: Trying to enable MSAA x4");
|
||||
}
|
||||
|
||||
const EGLint framebufferAttribs[] =
|
||||
{
|
||||
EGL_RENDERABLE_TYPE, (rlGetVersion() == RL_OPENGL_ES_30)? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT, // Type of context support
|
||||
const EGLint framebufferAttribs[] = {
|
||||
EGL_RENDERABLE_TYPE, (rlGetVersion() == RL_OPENGL_ES_30)? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT, // Type of context support
|
||||
EGL_RED_SIZE, 8, // RED color bit depth (alternative: 5)
|
||||
EGL_GREEN_SIZE, 8, // GREEN color bit depth (alternative: 6)
|
||||
EGL_BLUE_SIZE, 8, // BLUE color bit depth (alternative: 5)
|
||||
//EGL_TRANSPARENT_TYPE, EGL_NONE, // Request transparent framebuffer (EGL_TRANSPARENT_RGB does not work on RPI)
|
||||
EGL_DEPTH_SIZE, 16, // Depth buffer size (Required to use Depth testing!)
|
||||
//EGL_STENCIL_SIZE, 8, // Stencil buffer size
|
||||
EGL_SAMPLE_BUFFERS, sampleBuffer, // Activate MSAA
|
||||
EGL_SAMPLE_BUFFERS, sampleBuffer, // Activate MSAA
|
||||
EGL_SAMPLES, samples, // 4x Antialiasing if activated (Free on MALI GPUs)
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
const EGLint contextAttribs[] =
|
||||
{
|
||||
const EGLint contextAttribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_NONE
|
||||
};
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@
|
|||
#include "GLFW/glfw3native.h" // Required for: glfwGetCocoaWindow()
|
||||
#endif
|
||||
|
||||
#include <stddef.h> // Required for: size_t
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Types and Structures Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
@ -127,6 +129,11 @@ static void MouseScrollCallback(GLFWwindow *window, double xoffset, double yoffs
|
|||
static void CursorEnterCallback(GLFWwindow *window, int enter); // GLFW3 Cursor Enter Callback, cursor enters client area
|
||||
static void JoystickCallback(int jid, int event); // GLFW3 Joystick Connected/Disconnected Callback
|
||||
|
||||
// Wrappers used by glfwInitAllocator
|
||||
static void* AllocateWrapper(size_t size, void* user); // GLFW3 GLFWallocatefun, wrapps around RL_MALLOC macro
|
||||
static void* ReallocateWrapper(void* block, size_t size, void* user); // GLFW3 GLFWreallocatefun, wrapps around RL_MALLOC macro
|
||||
static void DeallocateWrapper(void* block, void* user); // GLFW3 GLFWdeallocatefun, wraps around RL_FREE macro
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
@ -1287,21 +1294,38 @@ static void SetDimensionsFromMonitor(GLFWmonitor *monitor)
|
|||
if (CORE.Window.screen.height == 0) CORE.Window.screen.height = CORE.Window.display.height;
|
||||
}
|
||||
|
||||
// Function wrappers around RL_*alloc macros, used by glfwInitAllocator() inside of InitPlatform()
|
||||
// We need to provide these because GLFWallocator expects function pointers with specific signatures.
|
||||
// Similar wrappers exist in utils.c but we cannot reuse them here due to declaration mismatch.
|
||||
// https://www.glfw.org/docs/latest/intro_guide.html#init_allocator
|
||||
static void* AllocateWrapper(size_t size, void* user)
|
||||
{
|
||||
(void)user;
|
||||
return RL_MALLOC(size);
|
||||
}
|
||||
static void* ReallocateWrapper(void* block, size_t size, void* user)
|
||||
{
|
||||
(void)user;
|
||||
return RL_REALLOC(block, size);
|
||||
}
|
||||
static void DeallocateWrapper(void* block, void* user)
|
||||
{
|
||||
(void)user;
|
||||
RL_FREE(block);
|
||||
}
|
||||
|
||||
// Initialize platform: graphics, inputs and more
|
||||
int InitPlatform(void)
|
||||
{
|
||||
glfwSetErrorCallback(ErrorCallback);
|
||||
/*
|
||||
// TODO: Setup GLFW custom allocators to match raylib ones
|
||||
const GLFWallocator allocator = {
|
||||
.allocate = MemAlloc,
|
||||
.deallocate = MemFree,
|
||||
.reallocate = MemRealloc,
|
||||
.user = NULL
|
||||
};
|
||||
|
||||
const GLFWallocator allocator = {
|
||||
.allocate = AllocateWrapper,
|
||||
.deallocate = DeallocateWrapper,
|
||||
.reallocate = ReallocateWrapper,
|
||||
.user = NULL, // RL_*ALLOC macros are not capable of handling user-provided data
|
||||
};
|
||||
glfwInitAllocator(&allocator);
|
||||
*/
|
||||
|
||||
#if defined(__APPLE__)
|
||||
glfwInitHint(GLFW_COCOA_CHDIR_RESOURCES, GLFW_FALSE);
|
||||
|
|
|
|||
|
|
@ -898,10 +898,9 @@ int InitPlatform(void)
|
|||
TRACELOG(LOG_INFO, "DISPLAY: Trying to enable MSAA x4");
|
||||
}
|
||||
|
||||
const EGLint framebufferAttribs[] =
|
||||
{
|
||||
EGL_RENDERABLE_TYPE, (rlGetVersion() == RL_OPENGL_ES_30)? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT, // Type of context support
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT, // Don't use it on Android!
|
||||
const EGLint framebufferAttribs[] = {
|
||||
EGL_RENDERABLE_TYPE, (rlGetVersion() == RL_OPENGL_ES_30)? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT, // Type of context support
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT, // Don't use it on Android!
|
||||
EGL_RED_SIZE, 8, // RED color bit depth (alternative: 5)
|
||||
EGL_GREEN_SIZE, 8, // GREEN color bit depth (alternative: 6)
|
||||
EGL_BLUE_SIZE, 8, // BLUE color bit depth (alternative: 5)
|
||||
|
|
@ -909,7 +908,7 @@ int InitPlatform(void)
|
|||
//EGL_TRANSPARENT_TYPE, EGL_NONE, // Request transparent framebuffer (EGL_TRANSPARENT_RGB does not work on RPI)
|
||||
EGL_DEPTH_SIZE, 16, // Depth buffer size (Required to use Depth testing!)
|
||||
//EGL_STENCIL_SIZE, 8, // Stencil buffer size
|
||||
EGL_SAMPLE_BUFFERS, sampleBuffer, // Activate MSAA
|
||||
EGL_SAMPLE_BUFFERS, sampleBuffer, // Activate MSAA
|
||||
EGL_SAMPLES, samples, // 4x Antialiasing if activated (Free on MALI GPUs)
|
||||
EGL_NONE
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1365,7 +1365,7 @@ RLAPI void ImageAlphaPremultiply(Image *image);
|
|||
RLAPI void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation
|
||||
RLAPI void ImageKernelConvolution(Image *image, const float *kernel, int kernelSize); // Apply custom square convolution kernel to image
|
||||
RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm)
|
||||
RLAPI void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
|
||||
RLAPI void ImageResizeNN(Image *image, int newWidth, int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
|
||||
RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color
|
||||
RLAPI void ImageMipmaps(Image *image); // Compute all mipmap levels for a provided image
|
||||
RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
||||
|
|
@ -1701,10 +1701,10 @@ RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan
|
|||
RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
|
||||
RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data
|
||||
|
||||
RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives the samples as 'float'
|
||||
RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo)
|
||||
RLAPI void DetachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Detach audio stream processor from stream
|
||||
|
||||
RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'
|
||||
RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo)
|
||||
RLAPI void DetachAudioMixedProcessor(AudioCallback processor); // Detach audio stream processor from the entire audio pipeline
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
|||
|
|
@ -3696,7 +3696,7 @@ static void ScanDirectoryFiles(const char *basePath, FilePathList *files, const
|
|||
}
|
||||
else
|
||||
{
|
||||
if (TextFindIndex(filter, DIRECTORY_FILTER_TAG) >= 0)
|
||||
if (strstr(filter, DIRECTORY_FILTER_TAG) != NULL)
|
||||
{
|
||||
strcpy(files->paths[files->count], path);
|
||||
files->count++;
|
||||
|
|
@ -3762,7 +3762,7 @@ static void ScanDirectoryFilesRecursively(const char *basePath, FilePathList *fi
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((filter != NULL) && (TextFindIndex(filter, DIRECTORY_FILTER_TAG) >= 0))
|
||||
if ((filter != NULL) && (strstr(filter, DIRECTORY_FILTER_TAG) != NULL))
|
||||
{
|
||||
strcpy(files->paths[files->count], path);
|
||||
files->count++;
|
||||
|
|
|
|||
|
|
@ -1307,7 +1307,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
|||
{
|
||||
// Default vertex attribute: normal
|
||||
// WARNING: Default value provided to shader if location available
|
||||
float value[3] = { 1.0f, 1.0f, 1.0f };
|
||||
float value[3] = { 0.0f, 0.0f, 1.0f };
|
||||
rlSetVertexAttributeDefault(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL, value, SHADER_ATTRIB_VEC3, 3);
|
||||
rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL);
|
||||
}
|
||||
|
|
@ -1339,7 +1339,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
|||
{
|
||||
// Default vertex attribute: tangent
|
||||
// WARNING: Default value provided to shader if location available
|
||||
float value[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
float value[4] = { 1.0f, 0.0f, 0.0f, 1.0f };
|
||||
rlSetVertexAttributeDefault(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT, value, SHADER_ATTRIB_VEC4, 4);
|
||||
rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2356,7 +2356,7 @@ bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshol
|
|||
return collision;
|
||||
}
|
||||
|
||||
// Check if circle collides with a line created betweeen two points [p1] and [p2]
|
||||
// Check if circle collides with a line created between two points [p1] and [p2]
|
||||
RLAPI bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2)
|
||||
{
|
||||
float dx = p1.x - p2.x;
|
||||
|
|
|
|||
12
src/rtext.c
12
src/rtext.c
|
|
@ -1540,21 +1540,21 @@ const char *TextSubtext(const char *text, int position, int length)
|
|||
|
||||
if (position >= textLength)
|
||||
{
|
||||
position = textLength - 1;
|
||||
length = 0;
|
||||
return buffer; //First char is already '\0' by memset
|
||||
}
|
||||
|
||||
if (length >= textLength) length = textLength;
|
||||
int maxLength = textLength - position;
|
||||
if (length > maxLength) length = maxLength;
|
||||
if (length >= MAX_TEXT_BUFFER_LENGTH) length = MAX_TEXT_BUFFER_LENGTH - 1;
|
||||
|
||||
// NOTE: Alternative: memcpy(buffer, text + position, length)
|
||||
|
||||
for (int c = 0 ; c < length ; c++)
|
||||
{
|
||||
*(buffer + c) = *(text + position);
|
||||
text++;
|
||||
buffer[c] = text[position + c];
|
||||
}
|
||||
|
||||
*(buffer + length) = '\0';
|
||||
buffer[length] = '\0';
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user